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

Commit3a66581

Browse files
committed
Prevent log_replication_commands from causing SQL commands to be logged.
Commit7c4f524 allowed walsender to execute normal SQL commandsto support table sync feature in logical replication. Previouslywhile log_statement caused such SQL commands to be logged,log_replication_commands caused them to be logged, too.That is, such SQL commands were logged twice unexpectedlywhen those settings were both enabled.This commit forces log_replication_commands to log only replicationcommands, to prevent normal SQL commands from being logged twice.Author: Masahiko SawadaReviewed-by: Kyotaro HoriguchiReported-by: Fujii MasaoDiscussion:http://postgr.es/m/CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com
1 parent88b0a31 commit3a66581

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

‎src/backend/replication/walsender.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,14 +1368,6 @@ exec_replication_command(const char *cmd_string)
13681368
MemoryContextcmd_context;
13691369
MemoryContextold_context;
13701370

1371-
/*
1372-
* Log replication command if log_replication_commands is enabled. Even
1373-
* when it's disabled, log the command with DEBUG1 level for backward
1374-
* compatibility.
1375-
*/
1376-
ereport(log_replication_commands ?LOG :DEBUG1,
1377-
(errmsg("received replication command: %s",cmd_string)));
1378-
13791371
/*
13801372
* CREATE_REPLICATION_SLOT ... LOGICAL exports a snapshot until the next
13811373
* command arrives. Clean up the old stuff if there's anything.
@@ -1399,6 +1391,16 @@ exec_replication_command(const char *cmd_string)
13991391

14001392
cmd_node=replication_parse_result;
14011393

1394+
/*
1395+
* Log replication command if log_replication_commands is enabled. Even
1396+
* when it's disabled, log the command with DEBUG1 level for backward
1397+
* compatibility. Note that SQL commands are not logged here, and will be
1398+
* logged later if log_statement is enabled.
1399+
*/
1400+
if (cmd_node->type!=T_SQLCmd)
1401+
ereport(log_replication_commands ?LOG :DEBUG1,
1402+
(errmsg("received replication command: %s",cmd_string)));
1403+
14021404
/*
14031405
* CREATE_REPLICATION_SLOT ... LOGICAL exports a snapshot. If it was
14041406
* called outside of transaction the snapshot should be cleared here.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp