pgsink icon indicating copy to clipboard operation
pgsink copied to clipboard

Transactions that are in-flight when adding a table to a publication might lose data

Open lawrencejones opened this issue 5 years ago • 0 comments

I'm unsure if a transaction that was in-flight and had created new data would be included in a publication if that table was added during the transaction.

That's confusing, this may be clearer:

begin;
  insert into example (msg) values ('hello');
  *
commit;

Imagine we add the example table to our publication at * in the transaction. Does our hello end up being replicated? I suspect it doesn't.

Proposal

Wait for any on-going transactions to complete, after adding a table to the publication, before we create an import job. This will ensure we capture any transactions that might have lost data in our import process.

lawrencejones avatar Jan 06 '20 14:01 lawrencejones