Here are some comments for patch v7-0002. ====== Commit Message
1. This commit extends START_REPLICATION to accept SHUTDOWN_MODE clause. It is currently implemented only for logical replication. ~ "to accept SHUTDOWN_MODE clause." --> "to accept a SHUTDOWN_MODE clause." ====== doc/src/sgml/protocol.sgml 2. START_REPLICATION SLOT slot_name LOGICAL XXX/XXX [ SHUTDOWN_MODE { 'wait_flush' | 'immediate' } ] [ ( option_name [ option_value ] [, ...] ) ] ~ IMO this should say shutdown_mode as it did before: START_REPLICATION SLOT slot_name LOGICAL XXX/XXX [ SHUTDOWN_MODE shutdown_mode ] [ ( option_name [ option_value ] [, ...] ) ] ~~~ 3. + <varlistentry> + <term><literal>shutdown_mode</literal></term> + <listitem> + <para> + Determines the behavior of the walsender process at shutdown. If + shutdown_mode is <literal>'wait_flush'</literal>, the walsender waits + for all the sent WALs to be flushed on the subscriber side. This is + the default when SHUTDOWN_MODE is not specified. If shutdown_mode is + <literal>'immediate'</literal>, the walsender exits without + confirming the remote flush. + </para> + </listitem> + </varlistentry> Is the font of the "shutdown_mode" correct? I expected it to be like the others (e.g. slot_name) ====== src/backend/replication/walsender.c 4. +static void +CheckWalSndOptions(const StartReplicationCmd *cmd) +{ + if (cmd->shutdownmode) + { + char *mode = cmd->shutdownmode; + + if (pg_strcasecmp(mode, "wait_flush") == 0) + shutdown_mode = WALSND_SHUTDOWN_MODE_WAIT_FLUSH; + else if (pg_strcasecmp(mode, "immediate") == 0) + shutdown_mode = WALSND_SHUTDOWN_MODE_IMMEDIATE; + else + ereport(ERROR, + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("invalid value for shutdown mode: \"%s\"", mode), + errhint("Available values: wait_flush, immediate.")); + } + +} Unnecessary extra whitespace at end of the function. ====== src/include/nodes/replnodes. 5. @@ -83,6 +83,7 @@ typedef struct StartReplicationCmd char *slotname; TimeLineID timeline; XLogRecPtr startpoint; + char *shutdownmode; List *options; } StartReplicationCmd; IMO I those the last 2 members should have a comment something like: /* Only for logical replication */ because that will make it more clear why sometimes they are assigned and sometimes they are not. ====== src/include/replication/walreceiver.h 6. Should the protocol version be bumped (and documented) now that the START REPLICATION supports a new extended syntax? Or is that done only for messages sent by pgoutput? ------ Kind Regards, Peter Smith. Fujitsu Australia.