mysql_cdc(test): add connection drop integration tests#4241
Conversation
|
|
||
| go func() { | ||
| _ = streamOut.Run(t.Context()) |
There was a problem hiding this comment.
Test pattern violation: silently discarded stream.Run error
The documented async stream.Run pattern for integration tests is:
go func() {
if err := stream.Run(t.Context()); err != nil && !errors.Is(err, context.Canceled) {
t.Error(err)
}
}()Discarding the error with _ = silently swallows genuine stream failures (e.g., config errors, connection issues unrelated to the test scenario), which could mask real bugs in these reconnection tests.
This applies to all 4 new test functions (TestIntegrationMySQLCDCConnectionDrop, TestIntegrationMySQLCDCConnectionDropWithBinlogRotation, TestIntegrationMySQLCDCConnectionDropAfterSnapshot, TestIntegrationMySQLCDCRepeatedConnectionDrops).
CommitsLGTM ReviewAdds 4 well-structured MySQL CDC connection drop integration tests with shared helpers (
|
fa133ef to
cc9d0a0
Compare
|
Commits Review LGTM |
cc9d0a0 to
03c438a
Compare
|
Commits Review LGTM |
Add 4 integration tests validating no data loss during MySQL CDC connection drops and reconnections: - ConnectionDrop: mid-stream kill, no rotation - ConnectionDropWithBinlogRotation: FLUSH BINARY LOGS + kill + recovery - ConnectionDropAfterSnapshot: snapshot -> CDC -> kill -> recovery - RepeatedConnectionDrops: 3 rapid kill cycles with fake rotate events All tests use set-based assertions (tolerating at-least-once duplicates) and verify zero data loss across MySQL 8.0, 9.0, and 9.1.
03c438a to
c3d482f
Compare
|
Commits Review LGTM |
Summary
Context
Investigating a reported scenario where binlog rotation + connection drop + reconnect from cached checkpoint could theoretically cause data loss if old binlog files are purged. These tests confirm the canal reconnection logic correctly resumes from the cached position without losing events.