Skip to content

Pg_chameleon status incorrect if initialisation fails for single table due to lock timeout #152

@markosutic

Description

@markosutic

Describe the bug
When PostgreSQL replica initialisation is issued pg_chameleon needs to acquire short FLUSH TABLES WITH READ LOCK to get table snapshot. If it is not able to acquire lock it will fail for specified table with info message in the log:

2022-11-24 21:22:38 MainProcess INFO: Copying the source table t123 into testsch_tmp.t123
2022-11-24 21:23:08 MainProcess INFO: Could not copy the table t123. Excluding it from the replica.
2022-11-24 21:23:08 MainProcess CRITICAL: init replica for source mysql failed

But show status will not show that we have excluded table from the replication and we can proceed with replicating data.

To Reproduce

  • set lock_wait_timeout on source (MySQL) side
  • open transaction on source (MySQL)
  • run initialisation from pg_chameleon
  • wait for lock_wait_timeout to terminate pg_chameleon session
  • start replication
  • check pg_chameleon status

Expected behavior
It would be expected to see that we have excluded table from the replication if pg_chameleon fails to acquire lock to get snapshot for a table.

Environment(please complete the following information):

  • OS: Centos 7
  • MySQL Version 5.6.51
  • PostgreSQL Version 14
  • Python Version 3.6

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions