The last WAL segment of the old timeline is not archived for a while after archive recovery

Lists: pgsql-hackers
From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: The last WAL segment of the old timeline is not archived for a while after archive recovery
Date: 2009-04-22 09:20:49
Message-ID: 3f0b79eb0904220220n24259cadqf6c31a97d9544e4e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

In archive recovery, the last applied WAL segment may not have
.ready file in spite of not having been archived yet. Then, this
segment is not archived until a future checkpoint creates .ready
file. It's a little dangerous that there is the WAL segment which
is not archived for a while.

Attached patch fixes this problem. Is this worth committing?

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachment Content-Type Size
archive_last_wal_0422.patch application/octet-stream 1.0 KB

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: The last WAL segment of the old timeline is not archived for a while after archive recovery
Date: 2009-04-22 19:51:17
Message-ID: 49EF7535.40006@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Fujii Masao wrote:
> In archive recovery, the last applied WAL segment may not have
> .ready file in spite of not having been archived yet. Then, this
> segment is not archived until a future checkpoint creates .ready
> file. It's a little dangerous that there is the WAL segment which
> is not archived for a while.
>
> Attached patch fixes this problem. Is this worth committing?

Yeah, I think it is. Applied.

BTW, I notice that we have the same problem with WAL files that have
been manually copied into pg_xlog, in the unlikely corner case that the
"backup redo point", ControlData->checkpointCopy, points to the
first-ever WAL file. That's because we then skip the
RemoveOldXlogFiles() step in the startup checkpoint, which normally
creates the .ready files for all but the last WAL file. I don't think
that happens in practice, and if it does, the files will still be
archived at the next checkpoint, so I think we can leave it as it is.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: The last WAL segment of the old timeline is not archived for a while after archive recovery
Date: 2009-04-23 04:09:30
Message-ID: 3f0b79eb0904222109y69350c3fw6d4d3a6538c49d7a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

On Thu, Apr 23, 2009 at 4:51 AM, Heikki Linnakangas
<heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
> Fujii Masao wrote:
>>
>> In archive recovery, the last applied WAL segment may not have
>> .ready file in spite of not having been archived yet. Then, this
>> segment is not archived until a future checkpoint creates .ready
>> file. It's a little dangerous that there is the WAL segment which
>> is not archived for a while.
>>
>> Attached patch fixes this problem. Is this worth committing?
>
> Yeah, I think it is. Applied.

Thanks a lot!

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center