Skip to content

Commit 1b776d5

Browse files
committed
more comments in test_decoding.c
1 parent 215d047 commit 1b776d5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

contrib/test_decoding/test_decoding.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,17 @@ pg_filter_prepare(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
311311
/*
312312
* For the sake of simplicity we just ignore in-progess transaction
313313
* in this extension, as they may abort during deconing.
314+
*
315+
* It is possible to move that LWLockRelease() to pg_decode_prepare_txn()
316+
* and allow decoding of running prepared tx, but such lock will prevent
317+
* any 2pc transaction commit during decoding time, that can be big
318+
* enough in case of massive changes/inserts in that tx.
319+
*
320+
* Better solution would be to use own custom lock here and register
321+
* XACT_EVENT_PRE_COMMIT callback in extension to conflict with this
322+
* lock. Decode should hold it in shared way, while commit in excluseve.
323+
* That will allow to lock stuff granularly ang block only tx that is
324+
* being decoded.
314325
*/
315326
LWLockRelease(TwoPhaseStateLock);
316327
return true;

0 commit comments

Comments
 (0)