Skip to content

Instantly share code, notes, and snippets.

@dwelch2344
Last active June 18, 2017 09:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwelch2344/77279f1a62d751486721643624c4bf79 to your computer and use it in GitHub Desktop.
Save dwelch2344/77279f1a62d751486721643624c4bf79 to your computer and use it in GitHub Desktop.
root@29f186d8a68f:/# python3 -m venv /pg_chameleon
root@29f186d8a68f:/# /pg_chameleon/bin/chameleon.py create_schema
Jun 18 02:24:21: [DEBUG] - mysql_lib.py (474): getting table metadata
Jun 18 02:24:21: [INFO] - mysql_lib.py (477): table copy limited to tables: dummy_user
Jun 18 02:24:21: [INFO] - pg_lib.py (583): Installing service schema base
root@29f186d8a68f:/# /pg_chameleon/bin/chameleon.py add_source --config default;
Jun 18 02:24:21: [DEBUG] - mysql_lib.py (474): getting table metadata
Jun 18 02:24:21: [INFO] - mysql_lib.py (477): table copy limited to tables: dummy_user
root@29f186d8a68f:/# /pg_chameleon/bin/chameleon.py init_replica --config default;
Jun 18 02:24:24: [DEBUG] - mysql_lib.py (474): getting table metadata
Jun 18 02:24:24: [INFO] - mysql_lib.py (477): table copy limited to tables: dummy_user
Jun 18 02:24:24: [INFO] - global_lib.py (307): Importing mysql schema
Jun 18 02:24:24: [INFO] - mysql_lib.py (579): locking the tables
Jun 18 02:24:24: [INFO] - mysql_lib.py (670): releasing the lock
Jun 18 02:24:24: [DEBUG] - pg_lib.py (678): master data: table file t_log_replica_1, log name: mysql-bin.000003, log position: 154
Jun 18 02:24:24: [INFO] - pg_lib.py (706): saving master data id source: 1 log file: mysql-bin.000003 log position:154 Last event: None
Jun 18 02:24:24: [INFO] - pg_lib.py (711): cleaning not replayed batches for source 1
Jun 18 02:24:24: [INFO] - pg_lib.py (351): creating the indices
root@29f186d8a68f:/# /pg_chameleon/bin/chameleon.py start_replica --config default;
Jun 18 02:24:32: [DEBUG] - mysql_lib.py (474): getting table metadata
root@29f186d8a68f:/# /pg_chameleon/bin/chameleon.py start_replica
Jun 18 02:27:30: [DEBUG] - mysql_lib.py (474): getting table metadata
Jun 18 02:27:30: [INFO] - mysql_lib.py (477): table copy limited to tables: dummy_user
Jun 18 02:27:30: [INFO] - global_lib.py (348): exit file detected, removing the pid file and terminating the replica process
@dwelch2344
Copy link
Author

Having a simple dummy table with the following:

create table dummy_user (
  id SERIAL,
  name VARCHAR(60)
);

insert into dummy_user(name) values
  ('Dave'),
  ('Andre'),
  ('Kaleb');

We bottom out without the sync actually happening. If I force init_replica and then sync_replica, it'll actually copy the data over

Jun 18 02:36:26: [DEBUG] - mysql_lib.py (474): getting table metadata
Jun 18 02:36:26: [INFO] - mysql_lib.py (477): table copy limited to tables: dummy_user
Jun 18 02:36:26: [INFO] - global_lib.py (269): waiting for replica process to stop
Jun 18 02:36:26: [INFO] - global_lib.py (276): replica process stopped
Jun 18 02:36:26: [INFO] - pg_lib.py (1160): truncating table replicated_mysql.dummy_user
Jun 18 02:36:26: [INFO] - mysql_lib.py (579): locking the tables
Jun 18 02:36:26: [INFO] - mysql_lib.py (589): copying table dummy_user
Jun 18 02:36:26: [DEBUG] - mysql_lib.py (594): estimating rows in dummy_user
Jun 18 02:36:26: [DEBUG] - mysql_lib.py (623): dummy_user will be copied in 1 slices of 57604 rows
Jun 18 02:36:26: [DEBUG] - mysql_lib.py (630): Executing query for table dummy_user
Jun 18 02:36:26: [DEBUG] - mysql_lib.py (635): Starting extraction loop for table dummy_user
Jun 18 02:36:26: [DEBUG] - mysql_lib.py (514): Table dummy_user copied 100 %
Jun 18 02:36:26: [INFO] - mysql_lib.py (670): releasing the lock
Jun 18 02:36:26: [DEBUG] - pg_lib.py (678): master data: table file t_log_replica_2, log name: mysql-bin.000003, log position: 929 
Jun 18 02:36:26: [INFO] - pg_lib.py (706): saving master data id source: 1 log file: mysql-bin.000003  log position:929 Last event: None
Jun 18 02:36:26: [INFO] - pg_lib.py (711): cleaning not replayed batches for source 1
Jun 18 02:36:26: [INFO] - global_lib.py (298): Replica enabled```

@the4thdoctor
Copy link

the4thdoctor commented Jun 18, 2017

row 29 is strange. it seems to me the start_replica fails for some reasons. when re replica fail the source state is set to error and the exit file prevents the replica to start again until the issue is solved.

can you please attach the postgres and mysql logs ?
when starting the replica try to redirect the stdout to a file.
/pg_chameleon/bin/chameleon.py start_replica --config default > /pg_chameleon/replica.log 2>&1
this should give more info.
thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment