Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit dfdb2f3

Browse files
committed
test_decoding: Add comments about delaying BEGIN/PREPARE
It is not immediately obvious why we return early in these functions; these comments should make it so. Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com> Discussion: https://postgr.es/m/202202141336.xv35beswc6ec@alvherre.pgsql
1 parent 68d8f9b commit dfdb2f3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contrib/test_decoding/test_decoding.c

+12
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ pg_decode_begin_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
322322
txndata->xact_wrote_changes = false;
323323
txn->output_plugin_private = txndata;
324324

325+
/*
326+
* If asked to skip empty transactions, we'll emit BEGIN at the point where
327+
* the first operation is received for this transaction.
328+
*/
325329
if (data->skip_empty_xacts)
326330
return;
327331

@@ -378,6 +382,10 @@ pg_decode_begin_prepare_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
378382
txndata->xact_wrote_changes = false;
379383
txn->output_plugin_private = txndata;
380384

385+
/*
386+
* If asked to skip empty transactions, we'll emit BEGIN at the point where
387+
* the first operation is received for this transaction.
388+
*/
381389
if (data->skip_empty_xacts)
382390
return;
383391

@@ -392,6 +400,10 @@ pg_decode_prepare_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
392400
TestDecodingData *data = ctx->output_plugin_private;
393401
TestDecodingTxnData *txndata = txn->output_plugin_private;
394402

403+
/*
404+
* If asked to skip empty transactions, we'll emit PREPARE at the point
405+
* where the first operation is received for this transaction.
406+
*/
395407
if (data->skip_empty_xacts && !txndata->xact_wrote_changes)
396408
return;
397409

0 commit comments

Comments
 (0)