Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8ae4ef4

Browse files
author
Amit Kapila
committed
Remove incorrect assertion in reorderbuffer.c.
We start recording changes in ReorderBufferTXN even before we reachSNAPBUILD_CONSISTENT state so that if the commit is encountered afterreaching that we should be able to send the changes of the entire transaction.Now, while recording changes if the reorder buffer memory has exceededlogical_decoding_work_mem then we can start streaming if it is allowed andwe haven't yet streamed that data. However, we must not allow streaming tostart unless the snapshot has reached SNAPBUILD_CONSISTENT state.In passing, improve the comments atop ReorderBufferResetTXN to mention thecase when we need to continue streaming after getting an error.Author: Amit KapilaReviewed-by: Dilip KumarDiscussion:https://postgr.es/m/CAA4eK1KoOH0byboyYY40NBcC7Fe812trwTa+WY3jQF7WQWZbQg@mail.gmail.com
1 parentbd94a9c commit8ae4ef4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎src/backend/replication/logical/reorderbuffer.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,8 @@ ReorderBufferSaveTXNSnapshot(ReorderBuffer *rb, ReorderBufferTXN *txn,
18911891
* Helper function for ReorderBufferProcessTXN to handle the concurrent
18921892
* abort of the streaming transaction. This resets the TXN such that it
18931893
* can be used to stream the remaining data of transaction being processed.
1894+
* This can happen when the subtransaction is aborted and we still want to
1895+
* continue processing the main or other subtransactions data.
18941896
*/
18951897
staticvoid
18961898
ReorderBufferResetTXN(ReorderBuffer*rb,ReorderBufferTXN*txn,
@@ -3461,18 +3463,18 @@ ReorderBufferCanStartStreaming(ReorderBuffer *rb)
34613463
LogicalDecodingContext*ctx=rb->private_data;
34623464
SnapBuild*builder=ctx->snapshot_builder;
34633465

3466+
/* We can't start streaming unless a consistent state is reached. */
3467+
if (SnapBuildCurrentState(builder)<SNAPBUILD_CONSISTENT)
3468+
return false;
3469+
34643470
/*
34653471
* We can't start streaming immediately even if the streaming is enabled
34663472
* because we previously decoded this transaction and now just are
34673473
* restarting.
34683474
*/
34693475
if (ReorderBufferCanStream(rb)&&
34703476
!SnapBuildXactNeedsSkip(builder,ctx->reader->EndRecPtr))
3471-
{
3472-
/* We must have a consistent snapshot by this time */
3473-
Assert(SnapBuildCurrentState(builder)==SNAPBUILD_CONSISTENT);
34743477
return true;
3475-
}
34763478

34773479
return false;
34783480
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp