On Wed, Dec 20, 2017 at 6:07 PM, Magnus Hagander <mag...@hagander.net> wrote:
> What about the attached?

The new positions look good to me, still aren't you missing the case
where a SQL command is found and exec_replication_command returns
false? This should be switched to idle as well.

+   /* Report to pgstat that this process is running */
+   pgstat_report_activity(STATE_RUNNING, NULL);
Bonus points if cmd_string is used instead of string? This way, you
can know what is the replication command running ;)

> Also, I noticed that the docs for exec_replication_command() says " *
> Returns true if the cmd_string was recognized as WalSender command, false
>  * if not.". But it doesn't actually do that, it ereport(ERROR):s if it's
> not. There is one "return false", but it's after an ERROR.

WAL senders can connect to a specific database, and if a WAL sender
command is not used in this case this goes through the normal query
processing.

> It's still quite a bit weird that we call this process "walsender" when it
> does other things as well. But the ship sailed on that many years ago,
> changing that completely now would not be worth the breakage.

ps shows walsender as well, that's a reason why "walsender" has been decided.
-- 
Michael

Reply via email to