-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[FLINK-39315][mysql] Unregister listeners of BinaryLogClient to prevent snapshot reader hang during backfill #4334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
0a63c55
6b833d5
28e4e88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -586,6 +586,21 @@ void testMultipleSplitsWithBackfill() throws Exception { | |
| "UPDATE " + tableId + " SET address = 'Beijing' WHERE id = 103"); | ||
| mySqlConnection.commit(); | ||
| } else if (split.splitId().equals(tableId + ":1")) { | ||
| // To verify that FLINK-39315 is fixed, generate sufficient binlog events, | ||
| // so that the MySqlBinlogSplitReadTask runs long enough to exercise the | ||
| // context-running checks in binlog reading backfill phase. | ||
| for (int i = 0; i < 100; i++) { | ||
| mySqlConnection.execute( | ||
| "UPDATE " | ||
| + tableId | ||
| + " SET address = 'Beijing' WHERE id = 106"); | ||
| mySqlConnection.commit(); | ||
| mySqlConnection.execute( | ||
| "UPDATE " | ||
| + tableId | ||
| + " SET address = 'Shanghai' WHERE id = 106"); | ||
| mySqlConnection.commit(); | ||
| } | ||
|
Comment on lines
+589
to
+603
|
||
| mySqlConnection.execute( | ||
| "UPDATE " + tableId + " SET address = 'Beijing' WHERE id = 106"); | ||
| mySqlConnection.commit(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an exception occurs in the main
tryand anyunregister*call throws infinally, the cleanup exception will replace the original failure, making the root cause harder to diagnose. Consider using theexecutionErrorvariable to preserve the primary exception: record the original throwable, then wrapunregister*in a try/catch and attach cleanup failures viaaddSuppressed(or only throw cleanup failures when there was no primary error).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review. I agree that if unregister*() throws in finally , it can mask the original exception and make the root cause harder to diagnose.
After reconsideration, I moved the listener unregistration to the end of the normal execution path instead of the finally block. The reason is that the problematic case we want to avoid is cross-split reuse when the execution finishes normally; if an exception happens and we exit early, the task will fail and the BinaryLogClient will be recreated on recovery, so the listener accumulation issue should not be hit in that path.