Table not found error

Hi,

We’re testing pt-online-schema-change to use it in production environment, and some of the tests fails due to “Base table or view not found”.

For testing purpose, I made a Symfony command that does "insert into " in an infinite loop, and another Symfony command that does a "select from " in loop. In parallel, I run pt-online-schema-changes to alter a table and add a new column. But when pt tries te swap the tables, in a very brief moment, the table does not exist, and my commands fails.

This tests simulates the same case that happened on the preproduction environment, were in a very brief moment, neither the readers nor the writers could access the table.

Here is the command I used for the reader command (nothing special) runs with Doctrine:

SELECT * FROM `demo` ORDER BY id limit 1;

and here is the command that inserts in loop :

INSERT INTO `demo`(name) values ('a random string each time');

and here is the pt-online-schema-changes command that runs while the reader and the writer are looping :

pt-online-schema-change --alter="ADD name_1 VARCHAR(250) DEFAULT NULL" D=***,t=demo,h=127.0.0.1,u=root,P=3306 --alter-foreign-keys-method=auto --ask-pass --execute --check-slave-lag=h=***,u=root,P=3306 --max-lag=2 --nocheck-replication-filters

to mention, we have a master and 1 slave, all configures in Doctrine ORM.

How can I put all queries on hold while pt-online-schema-change is renaming the tables, so I don’t get this “Base table or view not found” error ?