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

Commit 6f4bdf8

Browse files
author
Amit Kapila
committed
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
1 parent 190fa5a commit 6f4bdf8

File tree

4 files changed

+73
-42
lines changed

4 files changed

+73
-42
lines changed

contrib/test_decoding/expected/stream.out

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,30 @@ SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL,NULL, 'incl
8282
committing streamed transaction
8383
(13 rows)
8484

85+
-- streaming test for toast with multi-insert
86+
\COPY stream_test FROM STDIN
87+
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL,NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'stream-changes', '1');
88+
data
89+
------------------------------------------
90+
opening a streamed block for transaction
91+
streaming change for transaction
92+
streaming change for transaction
93+
streaming change for transaction
94+
streaming change for transaction
95+
streaming change for transaction
96+
streaming change for transaction
97+
streaming change for transaction
98+
streaming change for transaction
99+
streaming change for transaction
100+
streaming change for transaction
101+
streaming change for transaction
102+
closing a streamed block for transaction
103+
opening a streamed block for transaction
104+
streaming change for transaction
105+
closing a streamed block for transaction
106+
committing streamed transaction
107+
(17 rows)
108+
85109
DROP TABLE stream_test;
86110
SELECT pg_drop_replication_slot('regression_slot');
87111
pg_drop_replication_slot

0 commit comments

Comments
 (0)