From: | David Steele <david(at)pgmasters(dot)net> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Add timeline to partial WAL segments |
Date: | 2018-12-31 11:07:34 |
Message-ID: | c54fb93a-21cf-83c7-f44f-09b80327868a@pgmasters.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 12/21/18 2:10 AM, Michael Paquier wrote:
> On Thu, Dec 20, 2018 at 02:13:01PM +0200, David Steele wrote:
>> Or perhaps just always add the timeline to the .partial? That way it
>> doesn't need to be renamed later. Also, there would be a consistent name,
>> rather than sometimes .partial, sometimes .<timelime>.partial.
>
> Hm. A renaming still needs to happen afterwards anyway, no? When a
> segment is created with a given name pg_receivewal cannot know if the
> segment it is working on will be the last partial segment of a given
> timeline. And what would be changed in the segment name is the addition
> of the new TLI, not the previous one.
I was thinking the file would only be renamed on successful completion.
Suppose we are on timeline 1 pg_receivewal would be writing to:
000000010000000100000001.00000001.partial
If the WAL segment is never completed (server crashes, etc.) it would
keep that name.
If a cluster is promoted it would archive:
000000010000000100000001.00000002.partial
And then pg_receivewal would start writing on:
000000020000000100000001.00000002.partial
When that segment successfully completes it would be renamed by
pg_receivewal to 000000020000000100000001.
In short, the *initial* name of the WAL file is set to what it should be
if it doesn't complete so we don't need to run around and try to rename
files on failure. Only on success do we need to rename.
Sound plausible?
--
-David
david(at)pgmasters(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | David Steele | 2018-12-31 11:21:00 | Re: could recovery_target_timeline=latest be the default in standby mode? |
Previous Message | denty | 2018-12-31 10:41:15 | Re: Implementing Incremental View Maintenance |