Commit a778272
replication: Support GTID tag in PreviousGTIDsEvent (#952)
* replication: Support GTID tag in PreviousGTIDsEvent
Issue: ref #845
The `PreviousGTIDsEvent` / `PREVIOUS_GTIDS_LOG_EVENT` has changed to
work with tagged GTIDs.
First the `uuidCount` has changed, it encodes the GTID format. Here
format 1 is tagged and format 0 is untagged.
Then each entry may have a tag. If there is a tag then the uuid itself
isn't printed but the tag is appended to the last entry.
Examples:
`896e7882-18fe-11ef-ab88-22222d34d411:1-3`
regular format, compatible with both formats
`896e7882-18fe-11ef-ab88-22222d34d411:1-4:aaaa:1`
tagged format.
Combination of
- `896e7882-18fe-11ef-ab88-22222d34d411:1-4`
- `896e7882-18fe-11ef-ab88-22222d34d411:aaaa:1`
`896e7882-18fe-11ef-ab88-22222d34d411:1-4:aaaa:1:abc:1-3:bbbbb:1:bbbbbb:1:x:1,896e7882-18fe-11ef-ab88-22222d34d412:1-2`
Combination of:
```
896e7882-18fe-11ef-ab88-22222d34d411:1-4
:aaaa:1
🔤1-3
:bbbbb:1
:bbbbbb:1
❌1,
896e7882-18fe-11ef-ab88-22222d34d412:1-2
```
Please also see: `mysqlbinlog --read-from-remote-server --hexdump $binlogfile` to see how MySQL encodes/decodes this.
See also:
- https://dev.mysql.com/doc/refman/8.4/en/replication-gtids-concepts.html
* Add test
* Add more tests
* Update replication/event.go
Co-authored-by: lance6716 <[email protected]>
* Update based on review
* add my suggestions
Signed-off-by: lance6716 <[email protected]>
* add test for long tag
Signed-off-by: lance6716 <[email protected]>
---------
Signed-off-by: lance6716 <[email protected]>
Co-authored-by: lance6716 <[email protected]>1 parent 6bb9e67 commit a778272
2 files changed
+121
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
232 | 263 | | |
233 | 264 | | |
234 | | - | |
| 265 | + | |
| 266 | + | |
235 | 267 | | |
236 | 268 | | |
237 | 269 | | |
238 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
239 | 274 | | |
240 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
241 | 297 | | |
242 | 298 | | |
243 | | - | |
244 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
245 | 302 | | |
246 | 303 | | |
247 | 304 | | |
248 | 305 | | |
249 | | - | |
250 | 306 | | |
251 | | - | |
| 307 | + | |
252 | 308 | | |
253 | | - | |
| 309 | + | |
254 | 310 | | |
255 | | - | |
256 | 311 | | |
257 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
258 | 315 | | |
259 | | - | |
| 316 | + | |
260 | 317 | | |
261 | 318 | | |
262 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
0 commit comments