Re: Which process is actually doing the WAL writes/calls XLogFlush?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Daniel Westermann <daniel(dot)westermann(at)dbi-services(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Which process is actually doing the WAL writes/calls XLogFlush?
Date: 2017-06-27 23:18:47
Message-ID: CAKFQuwa3W=X8eJ_xCq+vBR6nwugTeemNWkQaR-_-_KwkO8AAEA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 27, 2017 at 3:52 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 06/27/2017 11:19 AM, Daniel Westermann wrote:
> >
> > Thanks, Adrian
> > It is clear now for the asynchronous stuff and wal_writer.
> > But I still did not figure out (or I am just not able to understand it
> from the README linked above)
> > which process is actually doing the write to the wal when you have
> synchronous commit set to on. Can
> > someone put some light on this?
>
> AFAIK the wal writer process.
>

​Um, no. "Synchronous" means that the caller has to wait for the result to
appear before it can move on. "Asynchronous" means that the caller can
issue the instruction and immediately move on. I guessing here but while
usually the caller would have to provide callback hook to get the answer in
the future in this case the caller is assuming a positive result and
doesn't listen for a response. It is for the asynchronous mode ​that
wal_writer exists. In synchronous mode it would be somewhat inefficient to
hand-off/leave the work to a separate process to perform while the main
process remains idle - better to just have the main process do it. Its not
a total win since the WAL file takes on the inherent contention.

The linked readme (and I suspect much of the docs) was written under the
assumption that the calling session performs all work not otherwise
explicitly designated as being handled by a separate process. That is why
you cannot find an affirmative answer to the posed question - it is taken
as something having been previously learned (or deduced in my case - the
others links being illustrative too).

Now, I'm still just going off of human documentation and not the actual
code - but my confidence level is quite high.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2017-06-27 23:39:38 Re: postgres: dbname dbuser 9.9.9.9[2222] PARSE waiting
Previous Message DrakoRod 2017-06-27 23:16:53 Re: postgres: dbname dbuser 9.9.9.9[2222] PARSE waiting