Closed metdos closed 2 years ago
@marcocitus my impression was that pending prepare transactions will hold on to those write locks, causing other write commands to block. Is this something we need to handle on the Citus side instead of Postgres?
@sumedhpathak Locks are indeed retained. But in this case there's no lock conflict because the deleting transaction didn't see the to-be-deleted rows, hence didn't try to delete them. Normally the resource locks on the master prevent that from being an issue, but those are released after the failed commit prepared ...;
.
(just as an aside: with serializable mode this would have resulted in a serialization failure)
If a 2PC Copy fails during COMMIT PREPARED phase, we leave some uncommitted PREPARE TRANSACTIONs as expected, but still allow modifications on the table. This causes data inconsistencies after PREPARED TRANSACTIONs are manually committed.
How to replicate;
Make 2PC Copy fails during COMMIT PREPARED phase by using a breakpoint at commit stage and killing the worker node which didn't get commits yet.
Restart the failing worker node. Switch to 1PC and run delete command inside master_modify_multiple_shards()
Commit waiting 2PC transactions on the worker node.
Now we have same shards with different row counts. Running master_modify_multiple_shards() shows it.