diff options
author | Amit Kapila <akapila@postgresql.org> | 2020-11-17 12:14:53 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2020-11-17 12:14:53 +0530 |
commit | 9653f24ad8307f393de51e0a64d9b10a49efa6e3 (patch) | |
tree | 1d2d83380772116a785a530f511e58b9c3f61d56 /src | |
parent | 2bd49b493a52f0a21bc3fc51c355963f99ac1a4e (diff) |
Fix 'skip-empty-xacts' option in test_decoding for streaming mode.
In streaming mode, the transaction can be decoded in multiple streams and
those streams can be interleaved with streams of other transactions. So,
we can't remember the transaction's write status in the logical decoding
context because that might get changed due to some other transactions and
lead to wrong answers for 'skip-empty-xacts' option. We decided to keep
each transaction's write status in the ReorderBufferTxn to avoid
interleaved streams changing the status of some unrelated transactions.
Diagnosed-by: Amit Kapila
Author: Dilip Kumar
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/CAA4eK1LR7=XNM_TLmpZMFuV8ZQpoxkem--NZJYf8YXmesbvwLA@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/replication/logical/reorderbuffer.c | 1 | ||||
-rw-r--r-- | src/include/replication/reorderbuffer.h | 5 | ||||
-rw-r--r-- | src/tools/pgindent/typedefs.list | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index c1bd68011c5..301baff2446 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -402,6 +402,7 @@ ReorderBufferGetTXN(ReorderBuffer *rb) /* InvalidCommandId is not zero, so set it explicitly */ txn->command_id = InvalidCommandId; + txn->output_plugin_private = NULL; return txn; } diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h index dfdda938b2a..bd9dd7ec676 100644 --- a/src/include/replication/reorderbuffer.h +++ b/src/include/replication/reorderbuffer.h @@ -378,6 +378,11 @@ typedef struct ReorderBufferTXN /* If we have detected concurrent abort then ignore future changes. */ bool concurrent_abort; + + /* + * Private data pointer of the output plugin. + */ + void *output_plugin_private; } ReorderBufferTXN; /* so we can define the callbacks used inside struct ReorderBuffer itself */ diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list index b146b3ea73d..fde701bfd4d 100644 --- a/src/tools/pgindent/typedefs.list +++ b/src/tools/pgindent/typedefs.list @@ -2505,6 +2505,7 @@ Tcl_Obj Tcl_Time TempNamespaceStatus TestDecodingData +TestDecodingTxnData TestSpec TextFreq TextPositionState |