summaryrefslogtreecommitdiff
path: root/src/include/replication
diff options
context:
space:
mode:
authorAmit Kapila2021-05-27 02:29:43 +0000
committerAmit Kapila2021-05-27 02:29:43 +0000
commit6f4bdf81529fdaf6744875b0be99ecb9bfb3b7e0 (patch)
tree07b7ba80d33148f0b2948aa870fccecde5aa0a82 /src/include/replication
parent190fa5a00a8f9ecee8eef2c8e26136b772b94e19 (diff)
Fix assertion during streaming of multi-insert toast changes.
While decoding the multi-insert WAL we can't clean the toast untill we get the last insert of that WAL record. Now if we stream the changes before we get the last change, the memory for toast chunks won't be released and we expect the txn to have streamed all changes after streaming. This restriction is mainly to ensure the correctness of streamed transactions and it doesn't seem worth uplifting such a restriction just to allow this case because anyway we will stream the transaction once such an insert is complete. Previously we were using two different flags (one for toast tuples and another for speculative inserts) to indicate partial changes. Now instead we replaced both of them with a single flag to indicate partial changes. Reported-by: Pavan Deolasee Author: Dilip Kumar Reviewed-by: Pavan Deolasee, Amit Kapila Discussion: https://postgr.es/m/CABOikdN-_858zojYN-2tNcHiVTw-nhxPwoQS4quExeweQfG1Ug@mail.gmail.com
Diffstat (limited to 'src/include/replication')
-rw-r--r--src/include/replication/reorderbuffer.h27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h
index 53cdfa5d88f..0c6e9d1cb92 100644
--- a/src/include/replication/reorderbuffer.h
+++ b/src/include/replication/reorderbuffer.h
@@ -172,10 +172,9 @@ typedef struct ReorderBufferChange
#define RBTXN_IS_SERIALIZED 0x0004
#define RBTXN_IS_SERIALIZED_CLEAR 0x0008
#define RBTXN_IS_STREAMED 0x0010
-#define RBTXN_HAS_TOAST_INSERT 0x0020
-#define RBTXN_HAS_SPEC_INSERT 0x0040
-#define RBTXN_PREPARE 0x0080
-#define RBTXN_SKIPPED_PREPARE 0x0100
+#define RBTXN_HAS_PARTIAL_CHANGE 0x0020
+#define RBTXN_PREPARE 0x0040
+#define RBTXN_SKIPPED_PREPARE 0x0080
/* Does the transaction have catalog changes? */
#define rbtxn_has_catalog_changes(txn) \
@@ -201,24 +200,10 @@ typedef struct ReorderBufferChange
((txn)->txn_flags & RBTXN_IS_SERIALIZED_CLEAR) != 0 \
)
-/* This transaction's changes has toast insert, without main table insert. */
-#define rbtxn_has_toast_insert(txn) \
+/* Has this transaction contains partial changes? */
+#define rbtxn_has_partial_change(txn) \
( \
- ((txn)->txn_flags & RBTXN_HAS_TOAST_INSERT) != 0 \
-)
-/*
- * This transaction's changes has speculative insert, without speculative
- * confirm.
- */
-#define rbtxn_has_spec_insert(txn) \
-( \
- ((txn)->txn_flags & RBTXN_HAS_SPEC_INSERT) != 0 \
-)
-
-/* Check whether this transaction has an incomplete change. */
-#define rbtxn_has_incomplete_tuple(txn) \
-( \
- rbtxn_has_toast_insert(txn) || rbtxn_has_spec_insert(txn) \
+ ((txn)->txn_flags & RBTXN_HAS_PARTIAL_CHANGE) != 0 \
)
/*