pt-online-schema swapping tables

.I did some research on pt-online-schema-change but still couldn’t figure out on when table swapping happens – if my application is still running and rows are still being added continuously then at what point percona makes decisions to swap the old and new tables? – anyone ideas or suggestions on when swapping tables happens without losing my incoming data-- I really don’t want to lose any data as there is no way to recover the lost rows. – any help would be appreciated

At the end of the process, online-schema-change does a table rename like

RENAME TABLE original_table TO table_new, temp_table TO original_table.

Since this is an atomic operation, even if there are queries being executed on the server, they won’t be affected and they will be executed in the new altered table.

Regards

will there be any lock on the table during the rename operation happens?

The program is not adding any extra lock. RENAME is an atomic operation and there won’t be queries affected by it.