You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make the tablesync worker's replication origen drop logic robust.
In commit f6c5edb, we started to drop the replication origen slots
before tablesync worker exits to avoid consuming more slots than required.
We were dropping the replication origen in the same transaction where we
were marking the tablesync state as SYNCDONE. Now, if there is any error
after we have dropped the origen but before we commit the containing
transaction, the in-memory state of replication progress won't be rolled
back. Due to this, after the restart, tablesync worker can start streaming
from the wrong location and can apply the already processed transaction.
To fix this, we need to opportunistically drop the origen after marking
the tablesync state as SYNCDONE. Even, if the tablesync worker fails to
remove the replication origen before exit, the apply worker ensures to
clean it up afterward.
Reported by Tom Lane as per buildfarm.
Diagnosed-by: Masahiko Sawada
Author: Hou Zhijie
Reviewed-By: Masahiko Sawada, Amit Kapila
Discussion: https://postgr.es/m/20220714115155.GA5439@depesz.com
Discussion: https://postgr.es/m/CAD21AoAw0Oofi4kiDpJBOwpYyBBBkJj=sLUOn4Gd2GjUAKG-fw@mail.gmail.com
0 commit comments