From: Christian Ullrich <chris@chrullrich.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin@postgresql.org
Subject: Re: Why does the WAL writer sit on completed segments (on Windows)?
Date: Mon, 17 Apr 2017 17:44:53 +0200
Message-ID: <b53e3f50-54b4-49ad-9344-97494ab5cbbd@chrullrich.net> (raw)
In-Reply-To: <17213.1492442911@sss.pgh.pa.us>
References: <od2lad$df0$1@blaine.gmane.org>
<17213.1492442911@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>
On 2017-04-17 17:28, Tom Lane wrote:
> Christian Ullrich <chris@chrullrich.net> writes:
>> The reason, as Process Monitor shows, is that the WAL writer process
>> keeps the file open for about one second after the
>> archive_status\*.ready file has been created. The archiver runs the
>> archive_command "too early", resulting in the sharing [1] violation seen
>> above.
>
> I'm not sure why that happens, but even if we changed the logic inside
> walwriter to avoid it, you'd still need to adapt your archiving script
> to deal with the case. The reason is that the walwriter isn't necessarily
> the only process writing WAL --- regular backends do it too, depending on
Such as in my test with pg_switch_xlog(), yes.
> timing. In such a case a backend would be holding an open-file reference
> until the next time it tries to write WAL, which might be awhile. It's
> not really practical to change that behavior; we certainly wouldn't want
> to open and close WAL files for every write.
So, just to be sure, you're saying that when the ".ready" file is
created, it is guaranteed that no process will write to a location
within that segment anymore even if it happens to have the file open?
(That's actually completely obvious, but bear with me, please.)
And further, that each such process will close the open file as soon as
it, intending to write WAL, finds out that the next available location
is not within the file?
Thanks,
--
Christian
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: chris@chrullrich.net, tgl@sss.pgh.pa.us
Subject: Re: Why does the WAL writer sit on completed segments (on Windows)?
In-Reply-To: <b53e3f50-54b4-49ad-9344-97494ab5cbbd@chrullrich.net>
References: <od2lad$df0$1@blaine.gmane.org> <17213.1492442911@sss.pgh.pa.us> <b53e3f50-54b4-49ad-9344-97494ab5cbbd@chrullrich.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox