-
Notifications
You must be signed in to change notification settings - Fork 135
TAP-MYSQL: Fix MySQL 8.4 compatibility for binlog status retrieval #1273
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
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |||||||||||||
| from unittest import TestCase | ||||||||||||||
| from unittest.mock import patch, Mock, call, MagicMock | ||||||||||||||
|
|
||||||||||||||
| from pymysql import InternalError | ||||||||||||||
| from pymysql import InternalError, ProgrammingError | ||||||||||||||
| from pymysql.cursors import Cursor | ||||||||||||||
| from pymysqlreplication.constants import FIELD_TYPE | ||||||||||||||
| from pymysqlreplication.event import RotateEvent, MariadbGtidEvent, GtidEvent | ||||||||||||||
|
|
@@ -1826,6 +1826,36 @@ def test_fetch_current_log_file_and_pos_success(self, connect_with_backoff): | |||||||||||||
| connect_with_backoff.assert_called_with(mysql_con) | ||||||||||||||
| cur_mock.__enter__.return_value.execute.assert_has_calls( | ||||||||||||||
| [ | ||||||||||||||
| call('SHOW BINARY LOG STATUS'), | ||||||||||||||
| ] | ||||||||||||||
| ) | ||||||||||||||
|
Comment on lines
1827
to
+1831
|
||||||||||||||
| cur_mock.__enter__.return_value.execute.assert_has_calls( | |
| [ | |
| call('SHOW BINARY LOG STATUS'), | |
| ] | |
| ) | |
| cur_mock.__enter__.return_value.execute.assert_called_once_with('SHOW BINARY LOG STATUS') |
Copilot
AI
Apr 17, 2026
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.
Same as the success case: this assert_has_calls allows additional execute calls (including an unintended fallback to SHOW MASTER STATUS) without failing. Tighten the assertion to ensure the non-fallback path executes exactly the expected statement(s) so the test can catch regressions in fallback behavior.
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.
The fallback currently triggers on any
pymysql.err.ProgrammingError, which can hide real problems (e.g., permission/privilege errors, server-side SQL mode issues) by logging a misleading “not supported” warning and then attempting a different statement. Consider catching the exception asexand only falling back for the specific “syntax/unsupported” case(s) (e.g., MySQL error 1064 or the specific message), otherwise re-raise so genuine configuration/auth issues fail fast with the original error.