-
-
Notifications
You must be signed in to change notification settings - Fork 95
Description
Describe the bug
I'm migrating from MySQL8 to PostgreSQL17 using AWS RDS for both. At the moment I had to manually edit a file to make the replica working. It fails cause probably it encounters statement like SAVEPOINT, RELEASE SAVEPOINT, ROLLBACK TO SAVEPOINT that are not supported. My fix skipped this statements. I edited the file mysql_lib.py at line 1340 right above the code sql_tokeniser.parse_sql(binlogevent.query) and added
q = binlogevent.query.strip()
qu = q.upper()
if qu.startswith("SAVEPOINT ") or qu.startswith("RELEASE SAVEPOINT ") or qu.startswith("ROLLBACK TO SAVEPOINT "):
continueDo you have suggestions? May you add the support?
At the moment the replica fails with this errors and cannot be restarted due to the same error that appears again.
2025-09-03 12:19:41 read_replica INFO mysql_lib.py (1409): CONSISTENT POINT FOR TABLE xxx.xxx REACHED - binlogfile mysql-bin-changelog.424932, position 72023 2025-09-03 12:19:41 read_replica INFO mysql_lib.py (1339): QUERY EVENT - binlogfile mysql-bin-changelog.424932, position 72112. -------- SAVEPOINT trans2 -------- 2025-09-03 12:19:42 MainProcess ERROR global_lib.py (609): Read process alive: False - Replay process alive: True 2025-09-03 12:19:42 MainProcess ERROR global_lib.py (610): Stack trace: Traceback (most recent call last): File "/home/local/.local/lib/python3.9/site-packages/pg_chameleon/lib/global_lib.py", line 535, in read_replica self.mysql_source.read_replica() File "/home/local/.local/lib/python3.9/site-packages/pg_chameleon/lib/mysql_lib.py", line 1527, in read_replica replica_data=self.__read_replica_stream(batch_data) File "/home/local/.local/lib/python3.9/site-packages/pg_chameleon/lib/mysql_lib.py", line 1340, in __read_replica_stream sql_tokeniser.parse_sql(binlogevent.query) File "/home/local/.local/lib/python3.9/site-packages/pg_chameleon/lib/sql_util.py", line 768, in parse_sql for stat_dic in multiple_sql_parser.parse(sql_string_cleanup): File "/home/local/.local/lib/python3.9/site-packages/parsy/__init__.py", line 98, in parse (result, _) = (self << eof).parse_partial(stream) File "/home/local/.local/lib/python3.9/site-packages/parsy/__init__.py", line 112, in parse_partial raise ParseError(result.expected, stream, result.furthest) parsy.ParseError: expected one of ';', 'ALTER', 'CREATE', 'DROP', 'EOF', 'RENAME', 'TRUNCATE', '\\s+' at 0:0
To Reproduce
Using the environment described above, start a replica and lunch a process that triggers the above statements.
Expected behavior
The replica must not stop
Screenshots
No one
Environment(please complete the following information):
- OS: Debian
- MySQL 8
- PostgreSQL 17
- Python 3.9
- Cloud hosted database AWS RDS
Additional context
Add any other context about the problem here.