mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
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
This commit is contained in:
@ -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 \
|
||||
)
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user