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

Commitab9c433

Browse files
committed
Don't build full initial logical decoding snapshot if NOEXPORT_SNAPSHOT.
Earlier commits (56e19d9 and2bef06d) make it cheaper tocreate a logical slot if not exporting the initial snapshot. IfNOEXPORT_SNAPSHOT is specified, we can skip the overhead, not justwhen creating a slot via sql (which can't export snapshots). AsNOEXPORT_SNAPSHOT has only recently been introduced, this shouldn't bebackpatched.
1 parent56e19d9 commitab9c433

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎src/backend/replication/walsender.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,7 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
873873
if (cmd->kind==REPLICATION_KIND_LOGICAL)
874874
{
875875
LogicalDecodingContext*ctx;
876+
boolneed_full_snapshot= false;
876877

877878
/*
878879
* Do options check early so that we can bail before calling the
@@ -884,6 +885,8 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
884885
ereport(ERROR,
885886
(errmsg("CREATE_REPLICATION_SLOT ... EXPORT_SNAPSHOT "
886887
"must not be called inside a transaction")));
888+
889+
need_full_snapshot= true;
887890
}
888891
elseif (snapshot_action==CRS_USE_SNAPSHOT)
889892
{
@@ -906,10 +909,11 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
906909
ereport(ERROR,
907910
(errmsg("CREATE_REPLICATION_SLOT ... USE_SNAPSHOT "
908911
"must not be called in a subtransaction")));
912+
913+
need_full_snapshot= true;
909914
}
910915

911-
ctx=CreateInitDecodingContext(cmd->plugin,NIL,
912-
true,/* build snapshot */
916+
ctx=CreateInitDecodingContext(cmd->plugin,NIL,need_full_snapshot,
913917
logical_read_xlog_page,
914918
WalSndPrepareWrite,WalSndWriteData);
915919

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp