mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 01:51:18 +02:00
Prevent log_replication_commands from causing SQL commands to be logged.
Commit 7c4f524
allowed walsender to execute normal SQL commands
to support table sync feature in logical replication. Previously
while 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 unexpectedly
when those settings were both enabled.
This commit forces log_replication_commands to log only replication
commands, to prevent normal SQL commands from being logged twice.
Author: Masahiko Sawada
Reviewed-by: Kyotaro Horiguchi
Reported-by: Fujii Masao
Discussion: http://postgr.es/m/CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com
This commit is contained in:
parent
88b0a31926
commit
3a66581dd1
@ -1368,14 +1368,6 @@ exec_replication_command(const char *cmd_string)
|
||||
MemoryContext cmd_context;
|
||||
MemoryContext old_context;
|
||||
|
||||
/*
|
||||
* Log replication command if log_replication_commands is enabled. Even
|
||||
* when it's disabled, log the command with DEBUG1 level for backward
|
||||
* compatibility.
|
||||
*/
|
||||
ereport(log_replication_commands ? LOG : DEBUG1,
|
||||
(errmsg("received replication command: %s", cmd_string)));
|
||||
|
||||
/*
|
||||
* CREATE_REPLICATION_SLOT ... LOGICAL exports a snapshot until the next
|
||||
* command arrives. Clean up the old stuff if there's anything.
|
||||
@ -1399,6 +1391,16 @@ exec_replication_command(const char *cmd_string)
|
||||
|
||||
cmd_node = replication_parse_result;
|
||||
|
||||
/*
|
||||
* Log replication command if log_replication_commands is enabled. Even
|
||||
* when it's disabled, log the command with DEBUG1 level for backward
|
||||
* compatibility. Note that SQL commands are not logged here, and will be
|
||||
* logged later if log_statement is enabled.
|
||||
*/
|
||||
if (cmd_node->type != T_SQLCmd)
|
||||
ereport(log_replication_commands ? LOG : DEBUG1,
|
||||
(errmsg("received replication command: %s", cmd_string)));
|
||||
|
||||
/*
|
||||
* CREATE_REPLICATION_SLOT ... LOGICAL exports a snapshot. If it was
|
||||
* called outside of transaction the snapshot should be cleared here.
|
||||
|
Loading…
Reference in New Issue
Block a user