Re: termination of backend waiting for sync rep generates a junk log message

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: termination of backend waiting for sync rep generates a junk log message
Date: 2011-10-18 19:28:05
Message-ID: CA+TgmoZ3dB_nVix-iwot5g+v+02c3F8viw=V6ubsshm5rQ848g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 17, 2011 at 6:53 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> WARNING:  canceling the wait for synchronous replication and
> terminating connection due to administrator command
> DETAIL:  The transaction has already committed locally, but might not
> have been replicated to the standby.
> backend> FATAL:  terminating connection due to administrator command
>
> The above is the server log messages that I got when I did the procedure.
> "backend> " is a junk. If a backend is terminated while it's waiting for
> synchronous replication, whereToSendOutput is set to DestNone. Then,
> whereToSendOutput=DestNone makes ReadCommand() call
> InteractiveBackend() which outputs "backend> ".
>
> This junk message might mess up the server log monitoring tools. I think
> it should be removed.
>
> The simple fix is to change InteractiveBackend() so that it calls
> CHECK_FOR_INTERRUPTS() before it outputs "backend> ". Thought?

I'm tempted to say we should do that in PostgresMain() instead, maybe
something like this:

diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 976a832..9e5557c 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3769,6 +3769,8 @@ PostgresMain(int argc, char *argv[], const char *username)
MemoryContextSwitchTo(MessageContext);
MemoryContextResetAndDeleteChildren(MessageContext);

+ CHECK_FOR_INTERRUPTS();
+
initStringInfo(&input_message);

/*

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-10-18 19:28:51 Re: new compiler warnings
Previous Message Peter Eisentraut 2011-10-18 19:25:20 Re: (patch) regression diffs on collate.linux.utf8 test