Re: WAL Restore process during recovery

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: simon(at)2ndquadrant(dot)com
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WAL Restore process during recovery
Date: 2012-01-26 04:22:26
Message-ID: CAHGQGwEtyGYVbke1JxndyoNqNH_hYAUDTkzNTBGoh2LX1zKhEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 24, 2012 at 6:43 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>> Cleaned up the points noted, new patch attached in case you wish to
>> review further.
>>
>> Still has bug, so still with me to fix.
>
> Thanks! Will review further.

v3 patch contains lots of unrelated code changes like the following.

- <structfield>pid</structfield> column of the
+ <structfield>procpid</structfield> column of the

You seem to have failed to extract the patch from your repository correctly.
So I used v2 patch for the review. Sorry if I comment the things which you've
already fixed in v3 patch.

Here are the comments. They are almost not serious problems.

+/*
+ * GUC parameters
+ */
+int WalRestoreDelay = 10000;

You forget to change guc.c to define wal_restore_delay as a GUC parameter?
Or just that source code comment is incorrect?

+ elog(FATAL, "recovery_restore_command is too long");

Typo: s/recovery_restore_command/restore_command

+ InitLatch(&walrstr->WALRestoreLatch); /* initialize latch used in main loop */

That latch is shared one. OwnLatch() should be called instead of InitLatch()?
If yes, it's better to call DisownLatch() when walrestore exits. Though skipping
DisownLatch() would be harmless because the latch is never owned by new
process after walrestore exits.

+ {
+ /* use volatile pointer to prevent code rearrangement */
+ volatile WalRestoreData *walrstr = WalRstr;
+
+ nextFileTli = walrstr->nextFileTli;

The declaration of "walrstr" is not required here because it's already done
at the head of WalRestoreNextFile().

+ if (restoredFromArchive)
+ {
+ /* use volatile pointer to prevent code rearrangement */
+ volatile WalRestoreData *walrstr = WalRstr;

Same as above.

+#define TMPRECOVERYXLOG "RECOVERYXLOG"

ISTM that it's better to move this definition to an include file and we should
use it in all the places where the fixed value "RECOVERYXLOG" is still used.

Regards,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-01-26 04:53:10 Re: Second thoughts on CheckIndexCompatible() vs. operator families
Previous Message Alvaro Herrera 2012-01-26 04:03:20 cursors FOR UPDATE don't return most recent row