diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-03-23 16:17:00 +0100 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-03-23 16:46:57 +0100 |
commit | dfdb2f3bf5c6ff4014de142a7b82b205224e01d3 (patch) | |
tree | ef05982992dfcc133e0ea392baf692f5747d4a73 /contrib/test_decoding/test_decoding.c | |
parent | 68d8f9bfb2f467c306d81b4f1cee1a5a0e5ede37 (diff) | |
download | postgresql-dfdb2f3bf5c6ff4014de142a7b82b205224e01d3.tar.gz postgresql-dfdb2f3bf5c6ff4014de142a7b82b205224e01d3.zip |
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
Diffstat (limited to 'contrib/test_decoding/test_decoding.c')
-rw-r--r-- | contrib/test_decoding/test_decoding.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/test_decoding/test_decoding.c b/contrib/test_decoding/test_decoding.c index ea22649e41d..c7a87f5fe5b 100644 --- a/contrib/test_decoding/test_decoding.c +++ b/contrib/test_decoding/test_decoding.c @@ -322,6 +322,10 @@ pg_decode_begin_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn) txndata->xact_wrote_changes = false; txn->output_plugin_private = txndata; + /* + * If asked to skip empty transactions, we'll emit BEGIN at the point where + * the first operation is received for this transaction. + */ if (data->skip_empty_xacts) return; @@ -378,6 +382,10 @@ pg_decode_begin_prepare_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn) txndata->xact_wrote_changes = false; txn->output_plugin_private = txndata; + /* + * If asked to skip empty transactions, we'll emit BEGIN at the point where + * the first operation is received for this transaction. + */ if (data->skip_empty_xacts) return; @@ -392,6 +400,10 @@ pg_decode_prepare_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, TestDecodingData *data = ctx->output_plugin_private; TestDecodingTxnData *txndata = txn->output_plugin_private; + /* + * If asked to skip empty transactions, we'll emit PREPARE at the point + * where the first operation is received for this transaction. + */ if (data->skip_empty_xacts && !txndata->xact_wrote_changes) return; |