Re: BUG #5011: Standby recovery unable to follow timeline change

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5011: Standby recovery unable to follow timeline change
Дата
Msg-id 12968.1251297766@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #5011: Standby recovery unable to follow timeline change  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #5011: Standby recovery unable to follow timeline change  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgsql-bugs
I wrote:
> ... but this solution is astonishingly ugly.  I think we should move up
> the LocalSetXLogInsertAllowed call, instead.

Specifically, I propose this patch instead.  I'm not set up to try the
test case though, can you do that?

            regards, tom lane

Index: src/backend/access/transam/xlog.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v
retrieving revision 1.348
diff -c -r1.348 xlog.c
*** src/backend/access/transam/xlog.c    12 Aug 2009 20:53:30 -0000    1.348
--- src/backend/access/transam/xlog.c    26 Aug 2009 14:40:28 -0000
***************
*** 6445,6450 ****
--- 6445,6461 ----
      }

      /*
+      * An end-of-recovery checkpoint is created before anyone is allowed to
+      * write WAL. To allow us to write the checkpoint record, temporarily
+      * enable XLogInsertAllowed.  (This also ensures ThisTimeLineID is
+      * initialized, which we need here and in AdvanceXLInsertBuffer.)
+      */
+     if (flags & CHECKPOINT_END_OF_RECOVERY)
+         LocalSetXLogInsertAllowed();
+
+     checkPoint.ThisTimeLineID = ThisTimeLineID;
+
+     /*
       * Compute new REDO record ptr = location of next XLOG record.
       *
       * NB: this is NOT necessarily where the checkpoint record itself will be,
***************
*** 6567,6586 ****
      START_CRIT_SECTION();

      /*
-      * An end-of-recovery checkpoint is created before anyone is allowed to
-      * write WAL. To allow us to write the checkpoint record, temporarily
-      * enable XLogInsertAllowed.
-      */
-     if (flags & CHECKPOINT_END_OF_RECOVERY)
-         LocalSetXLogInsertAllowed();
-
-     /*
-      * This needs to be done after LocalSetXLogInsertAllowed(), else
-      * ThisTimeLineID might still be uninitialized.
-      */
-     checkPoint.ThisTimeLineID = ThisTimeLineID;
-
-     /*
       * Now insert the checkpoint record into XLOG.
       */
      rdata.data = (char *) (&checkPoint);
--- 6578,6583 ----

В списке pgsql-bugs по дате отправления:

Предыдущее
От: james bardin
Дата:
Сообщение: Re: BUG #5011: Standby recovery unable to follow timeline change
Следующее
От: "Gergely Czuczy"
Дата:
Сообщение: BUG #5012: mailing list VERP addresses not sender-verifiable