Обсуждение: pgsql: Fix a couple of problems pointed out by Fujii Masao in the

Поиск
Список
Период
Сортировка

pgsql: Fix a couple of problems pointed out by Fujii Masao in the

От
tgl@postgresql.org (Tom Lane)
Дата:
Log Message:
-----------
Fix a couple of problems pointed out by Fujii Masao in the 2008-Apr-05 patch
for pg_stop_backup.  First, it is possible that the history file name is not
alphabetically later than the last WAL file name, so we should explicitly
check that both have been archived.  Second, the previous coding would wait
forever if a checkpoint had managed to remove the WAL file before we look for
it.

Simon Riggs, plus some code cleanup by me.

Modified Files:
--------------
    pgsql/src/backend/access/transam:
        xlog.c (r1.317 -> r1.318)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/xlog.c?r1=1.317&r2=1.318)

Re: pgsql: Fix a couple of problems pointed out by Fujii Masao in the

От
Simon Riggs
Дата:
On Mon, 2008-09-08 at 16:42 +0000, Tom Lane wrote:
> Log Message:
> -----------
> Fix a couple of problems pointed out by Fujii Masao in the 2008-Apr-05 patch
> for pg_stop_backup.

Thanks. Just a couple of notes there:

> First, it is possible that the history file name is not

...always...

> alphabetically later than the last WAL file name, so we should explicitly
> check that both have been archived.

My test case for the original patch worked, though there were other
cases also.

> Second, the previous coding would wait
> forever if a checkpoint had managed to remove the WAL file before we look for
> it.

The original code was safe from this error. That point applies to
discussion of solution to the first point.

--
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Training, Services and Support


Re: pgsql: Fix a couple of problems pointed out by Fujii Masao in the

От
"Fujii Masao"
Дата:
On Tue, Sep 9, 2008 at 2:28 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
>> First, it is possible that the history file name is not
>
> ...always...

Not always.
If the stoppoint is as same as the startpoint, the history file name
is alphabetically
later than the last WAL file name. Because the leading 24 characters
of each file name
are the same and the history file name has additional characters. On
the other hand,
if the stoppoint is larger than the startpoint, the last WAL file name
is alphabetically
later than the history file name. Because the leading 24 characters of
the last WAL
file name is later than those of the history file name.

BTW, I have one question. Why does BackupHistoryFilePath need to be duplicated
in pg_stop_backup? I think that the latter one is redundant. Am I
missing something?

regards

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

Re: pgsql: Fix a couple of problems pointed out by Fujii Masao in the

От
Simon Riggs
Дата:
On Tue, 2008-09-09 at 03:12 +0900, Fujii Masao wrote:
> On Tue, Sep 9, 2008 at 2:28 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> >> First, it is possible that the history file name is not
> >
> > ...always...
>
> Not always.

Agreed. I was adding the word "always" after the word "not", sorry if
that wasn't clear.

> BTW, I have one question. Why does BackupHistoryFilePath need to be duplicated
> in pg_stop_backup? I think that the latter one is redundant. Am I
> missing something?

Duplicated? It's a different filename each time its used. One piece of
code writes the file and the other piece reads it (sometime later). The
code is executed in different processes, at different times.

--
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Training, Services and Support