-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Description
Hi,
I ran alter commands in MySQL for adding new columns, but the replication fails when schema changes with index out of range. I tried restarting and also manually creating tables directly in clickhouse, but it wasn't helpful. To resolve this I killed the replication process clear state and binlog files and restarted replication.
During this schema change initial replication was successfully complete and normal binlog replication was taking place.
I have a huge data in my DB and the initial replication takes around 4 hours to complete, my users will see stale data during this process. Is there a way to continue replication with existing data when new schema changes are done in MySQL ?
MySQL Alter Commands:
ALTER TABLE production
ADD COLUMN number_of_batches DECIMAL(20, 2) NOT NULL;
ALTER TABLE sales_invoice
MODIFY COLUMN gst_in VARCHAR(50) NULL;
ALTER TABLE daily_transaction_item
DROP COLUMN return_quantity,
DROP COLUMN return_stock_id;
ALTER TABLE production
DROP COLUMN end_time;
Error Logs:-
Apr 04 14:40:09 : records = self.converter.convert_records(event.records, mysql_table_structure, clickhouse_tab
Apr 04 14:40:09 : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : clickhouse_record = self.convert_record(
Apr 04 14:40:09 : ^^^^^^^^^^^^^^^^^^^^
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : mysql_field_type = mysql_field_types[idx]
Apr 04 14:40:09 : ~~~~~~~~~~~~~~~~~^^^^^
Apr 04 14:40:09 : IndexError: list index out of range
Apr 04 14:40:09 : Searching for transaction ('binlog.000093', 90862479) in files: [1, 2]
Apr 04 14:40:09 : Checking file 1...
Apr 04 14:40:09 : Checking file 2...
Apr 04 14:40:09 : Traceback (most recent call last):
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/bin/mysql_ch_replicator", line 8, in <module>
Apr 04 14:40:09 : sys.exit(main())
Apr 04 14:40:09 : ^^^^^^
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : self.run_realtime_replication()
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : self.handle_event(event)
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : event_handlers[event.event_type](event)
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : records = self.converter.convert_records(event.records, mysql_table_structure, clickhouse_tab
Apr 04 14:40:09 : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : clickhouse_record = self.convert_record(
Apr 04 14:40:09 : ^^^^^^^^^^^^^^^^^^^^
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : mysql_field_type = mysql_field_types[idx]
Apr 04 14:40:09 : ~~~~~~~~~~~~~~~~~^^^^^
Apr 04 14:40:09 : IndexError: list index out of range
Apr 04 14:40:09 : Searching for transaction ('binlog.000093', 90862479) in files: [1, 2]
Apr 04 14:40:09 : Checking file 1...
Apr 04 14:40:09 : Checking file 2...
Apr 04 14:40:09 : Traceback (most recent call last):
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/bin/mysql_ch_replicator", line 8, in <module>
Apr 04 14:40:09 : sys.exit(main())
Apr 04 14:40:09 : ^^^^^^
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : run_db_replicator(args, config)
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : db_replicator.run()
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : self.run_realtime_replication()
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : self.handle_event(event)
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : event_handlers[event.event_type](event)
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : records = self.converter.convert_records(event.records, mysql_table_structure, clickhouse_tab
Apr 04 14:40:09 : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : clickhouse_record = self.convert_record(
Apr 04 14:40:09 : ^^^^^^^^^^^^^^^^^^^^
Apr 04 14:40:09 : File "/home/ec2-user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/mysql_ch_replicator/
Apr 04 14:40:09 : mysql_field_type = mysql_field_types[idx]
Apr 04 14:40:09 : ~~~~~~~~~~~~~~~~~^^^^^
Apr 04 14:40:09 : IndexError: list index out of range
Metadata
Metadata
Assignees
Labels
No labels