Commit d49bebe
authored
[MySQL] Extend replication keep alive mechanism. (#314)
* Removed zongji type mappings which are now provided by the Zongji package directly
Added check for tablemap events
* Moved most of the binlog event handling logic to a separate BinlogListener class.
Introduced a mechanism to limit the maximum size of the binlog processing queue, thus also limiting memory usage.
This maximum processing queue size is configurable
* Updated the BinLogStream to use the new BinLogListener
* Renamed BinlogListener to BinLogListener
* Added changeset
* Simplified BinLogListener stopping mechanism
Cleaned up BinLogStream logs a bit
* Corrected BinLogListener name.
Simplified BinLogListener stopping mechanism
* Supply port for binlog listener connections.
* Only set up binlog heartbeat once the listener is fully started up.
Added a few more defensive stopped checks to the binlog listener
* Updated changeset
* Changed binlog backpressure mechanism to be based on processing queue memory usage rather than number of events
* Changed binlog backpressure mechanism to be based on processing queue memory usage rather than number of events.
Introduced a maximum timeout that the binlog processing queue can be paused before auto-resuming. This is to prevent the replication connection timing out.
* Added optional columns field to SourceEntityDescriptor
Made SourceTable implement SourceEntityDescriptor interface
* Cleanup unused imports
* Ensure column values are preserved when available Report 0 storage metrics instead of ignoring them. SourceTable.
Moved MySQL table detail retrieval logic to utility function.
* Added basic schema change handling for MySQL
* Revert columns field addition to SourceEntityDescriptor
* Added schema change handling for the MySQL binlog replication.
* Include powersync core version in metrics metadata
* Code analysis cleanup
* Merge conflicts
* Fixed parser import
* Fixed mysql->sqlite rows parsing that would filter out columns with null values
* Cleaned up SchemaChange handling in BinLogListener
Improved binlog table filtering
Added extended type definitions for node-sql-parser package
* Added schema change tests
Cleaned up MySQL tests in general and added a few new test utils
* Change binlog event receive log message to debug
* Revert and fix mysql->sqlite row conversion for null value columns
* Added conditional skip of mysql schema test for syntax that does not exist in version 5.7
* Fixed version checking for mysql 5.7 incompatible test
* Fix skip test on mysql 5.7 schema change
* Reverted mysql dev docker compose
Updated to released zongji listener version
* Moved schema change handling to processing queue
Catch parsing errors, and log an error if the DDL query might apply to one of the tables in the sync rules.
* Fixed bug where multiple zongji listeners could be started if multiple schema change events were in the processing queue
Added small timeout to test to prevent rare race condition
* Extended node-sql-parser type definitions
Added util functions to identify the different types of DDL statements
* - Simplified schema change types
- Added more detections of constraint changes
- Removed detection of create table statements since they can be detected and reacted to when row events are received for new tables
- Added multiple extra test cases
* Removed unused constant
* Skip unsupported schema test for MySQL 5.7
* Added error handling for zongji emitted schema errors
* Added changeset
* Typo fixes from pr feedback
* Removed filters from mysql dev docker config
* Added safeguard for gtid splitting when no transactions have been run on the mysql database yet.
* BinLog listener now correctly takes schema into account for replication.
TableFilter creation is now internally handled in the BinLog listener
Pause/unpause binlog listening now uses the same stop start functionality used for schema change handling.
* BinLog stream now correctly honors multiple schemas in the sync rules.
* Added tests for multi schema support
* MySQL util fix post merge
* Removed accidentally commited keepalive code in BinLogStream.
* Cleaned up Binlog docs and comments a bit
* Added keepalive support for MySQL replication.
* Removed potentially spammy log entry.
* Increased MySQL keepalive table timestamp granularity
Added tests for keepalive
Moved common test functions to utils
* Added check to skip MySQL keepalive table creation if present and correctly set up.
* Added success check for mysql keepalive
* Reworked MySQL keepalive mechanism by hooking into heartbeat events on the binlog.
* Bucket Keepalives now bump the syncrules keepalive timestamp even if the LSN stayed the same.
* Switched keepalive logs to debug
Added a few more comments for keepalives
Updated to released Zongji package
* Added changeset
* Small cleanup of reverted code1 parent c0bdbbe commit d49bebe
File tree
13 files changed
+251
-143
lines changed- .changeset
- modules
- module-mongodb-storage/src/storage/implementation
- module-mysql
- src/replication
- zongji
- test/src
- module-postgres-storage/src/storage/batch
- packages/service-core/src/api
13 files changed
+251
-143
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
807 | 807 | | |
808 | 808 | | |
809 | 809 | | |
810 | | - | |
| 810 | + | |
811 | 811 | | |
812 | 812 | | |
813 | 813 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
401 | | - | |
402 | 401 | | |
403 | 402 | | |
404 | 403 | | |
| |||
409 | 408 | | |
410 | 409 | | |
411 | 410 | | |
412 | | - | |
| 411 | + | |
413 | 412 | | |
414 | 413 | | |
415 | 414 | | |
| |||
455 | 454 | | |
456 | 455 | | |
457 | 456 | | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
458 | 463 | | |
459 | 464 | | |
460 | 465 | | |
| |||
Lines changed: 72 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
75 | | - | |
| 80 | + | |
76 | 81 | | |
| 82 | + | |
77 | 83 | | |
78 | 84 | | |
79 | 85 | | |
| |||
85 | 91 | | |
86 | 92 | | |
87 | 93 | | |
88 | | - | |
| 94 | + | |
89 | 95 | | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
93 | 104 | | |
94 | 105 | | |
95 | 106 | | |
96 | | - | |
97 | | - | |
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
| |||
104 | 113 | | |
105 | 114 | | |
106 | 115 | | |
107 | | - | |
108 | | - | |
| 116 | + | |
| 117 | + | |
109 | 118 | | |
110 | 119 | | |
111 | 120 | | |
| |||
130 | 139 | | |
131 | 140 | | |
132 | 141 | | |
133 | | - | |
134 | | - | |
135 | | - | |
| 142 | + | |
| 143 | + | |
136 | 144 | | |
137 | 145 | | |
138 | 146 | | |
139 | 147 | | |
140 | | - | |
| 148 | + | |
141 | 149 | | |
142 | 150 | | |
143 | 151 | | |
| |||
158 | 166 | | |
159 | 167 | | |
160 | 168 | | |
161 | | - | |
162 | | - | |
163 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
164 | 182 | | |
165 | 183 | | |
166 | 184 | | |
| |||
289 | 307 | | |
290 | 308 | | |
291 | 309 | | |
292 | | - | |
| 310 | + | |
| 311 | + | |
293 | 312 | | |
| 313 | + | |
294 | 314 | | |
295 | 315 | | |
| 316 | + | |
296 | 317 | | |
297 | 318 | | |
298 | 319 | | |
299 | 320 | | |
300 | 321 | | |
| 322 | + | |
301 | 323 | | |
302 | 324 | | |
303 | 325 | | |
304 | 326 | | |
| 327 | + | |
305 | 328 | | |
306 | 329 | | |
307 | 330 | | |
| |||
312 | 335 | | |
313 | 336 | | |
314 | 337 | | |
| 338 | + | |
315 | 339 | | |
316 | 340 | | |
317 | 341 | | |
318 | 342 | | |
319 | 343 | | |
320 | 344 | | |
| 345 | + | |
321 | 346 | | |
322 | 347 | | |
323 | 348 | | |
324 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
325 | 360 | | |
| 361 | + | |
326 | 362 | | |
327 | 363 | | |
328 | | - | |
| 364 | + | |
329 | 365 | | |
330 | 366 | | |
331 | 367 | | |
| |||
336 | 372 | | |
337 | 373 | | |
338 | 374 | | |
339 | | - | |
340 | | - | |
341 | 375 | | |
342 | 376 | | |
343 | 377 | | |
344 | 378 | | |
345 | 379 | | |
346 | 380 | | |
347 | 381 | | |
348 | | - | |
| 382 | + | |
349 | 383 | | |
| 384 | + | |
350 | 385 | | |
351 | 386 | | |
352 | 387 | | |
353 | 388 | | |
354 | 389 | | |
355 | | - | |
| 390 | + | |
356 | 391 | | |
357 | 392 | | |
358 | 393 | | |
359 | 394 | | |
360 | 395 | | |
361 | 396 | | |
362 | 397 | | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
372 | 408 | | |
373 | 409 | | |
374 | 410 | | |
375 | 411 | | |
| 412 | + | |
376 | 413 | | |
377 | 414 | | |
378 | 415 | | |
| |||
381 | 418 | | |
382 | 419 | | |
383 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
384 | 428 | | |
385 | 429 | | |
386 | 430 | | |
| |||
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
24 | 34 | | |
25 | 35 | | |
26 | 36 | | |
| |||
0 commit comments