Re: What is CheckPoint.undo needed for? - Mailing list pgsql-hackers

From Florian G. Pflug
Subject Re: What is CheckPoint.undo needed for?
Date
Msg-id 45DDCCA0.3010907@phlo.org
Whole thread Raw
In response to Re: What is CheckPoint.undo needed for?  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: What is CheckPoint.undo needed for?  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
Alvaro Herrera wrote:
> Florian G. Pflug wrote:
>> Heikki Linnakangas wrote:
>>> No you're right, it's related to the WAL undo stuff that was never
>>> actually implemented. It's dead code.
>>>
>>> Teodor Sigaev wrote:
>>>> Opps, sorry, I missed checkpoint keyword
>>>>
>>>> Teodor Sigaev wrote:
>>>>>> What am I missing?
>>>>> Seems, it's about that
>>>>> http://archives.postgresql.org/pgsql-committers/2005-06/msg00085.php
>> Thanks - everything makes much more sense now ;-)
>
> So if you want to submit a patch to remove it, it'll make sense for
> future readers as well ;-)

Here you go. I'm not subscribe to pgsql-patches, so I posted this here.

greetings, Florian Pflug


Index: src/backend/access/transam/xlog.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/xlog.c,v
retrieving revision 1.264
diff -a -u -r1.264 xlog.c
--- src/backend/access/transam/xlog.c    14 Feb 2007 05:00:40 -0000    1.264
+++ src/backend/access/transam/xlog.c    22 Feb 2007 15:47:52 -0000
@@ -4039,7 +4039,6 @@
     /* Set up information for the initial checkpoint record */
     checkPoint.redo.xlogid = 0;
     checkPoint.redo.xrecoff = SizeOfXLogLongPHD;
-    checkPoint.undo = checkPoint.redo;
     checkPoint.ThisTimeLineID = ThisTimeLineID;
     checkPoint.nextXidEpoch = 0;
     checkPoint.nextXid = FirstNormalTransactionId;
@@ -4698,9 +4697,8 @@
     wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN);

     ereport(LOG,
-     (errmsg("redo record is at %X/%X; undo record is at %X/%X; shutdown %s",
+     (errmsg("redo record is at %X/%X; ; shutdown %s",
              checkPoint.redo.xlogid, checkPoint.redo.xrecoff,
-             checkPoint.undo.xlogid, checkPoint.undo.xrecoff,
              wasShutdown ? "TRUE" : "FALSE")));
     ereport(LOG,
             (errmsg("next transaction ID: %u/%u; next OID: %u",
@@ -4730,20 +4728,17 @@
     if (XLByteLT(RecPtr, checkPoint.redo))
         ereport(PANIC,
                 (errmsg("invalid redo in checkpoint record")));
-    if (checkPoint.undo.xrecoff == 0)
-        checkPoint.undo = RecPtr;

     /*
      * Check whether we need to force recovery from WAL.  If it appears to
      * have been a clean shutdown and we did not have a recovery.conf file,
      * then assume no recovery needed.
      */
-    if (XLByteLT(checkPoint.undo, RecPtr) ||
-        XLByteLT(checkPoint.redo, RecPtr))
+    if (XLByteLT(checkPoint.redo, RecPtr))
     {
         if (wasShutdown)
             ereport(PANIC,
-                (errmsg("invalid redo/undo record in shutdown checkpoint")));
+                (errmsg("invalid redo record in shutdown checkpoint")));
         InRecovery = true;
     }
     else if (ControlFile->state != DB_SHUTDOWNED)
@@ -5850,10 +5845,9 @@
     {
         CheckPoint *checkpoint = (CheckPoint *) rec;

-        appendStringInfo(buf, "checkpoint: redo %X/%X; undo %X/%X; "
+        appendStringInfo(buf, "checkpoint: redo %X/%X; "
                          "tli %u; xid %u/%u; oid %u; multi %u; offset %u; %s",
                          checkpoint->redo.xlogid, checkpoint->redo.xrecoff,
-                         checkpoint->undo.xlogid, checkpoint->undo.xrecoff,
                          checkpoint->ThisTimeLineID,
                          checkpoint->nextXidEpoch, checkpoint->nextXid,
                          checkpoint->nextOid,
Index: src/bin/pg_controldata/pg_controldata.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_controldata/pg_controldata.c,v
retrieving revision 1.32
diff -a -u -r1.32 pg_controldata.c
--- src/bin/pg_controldata/pg_controldata.c    8 Dec 2006 19:50:53 -0000    1.32
+++ src/bin/pg_controldata/pg_controldata.c    22 Feb 2007 15:47:52 -0000
@@ -168,9 +168,6 @@
     printf(_("Latest checkpoint's REDO location:    %X/%X\n"),
            ControlFile.checkPointCopy.redo.xlogid,
            ControlFile.checkPointCopy.redo.xrecoff);
-    printf(_("Latest checkpoint's UNDO location:    %X/%X\n"),
-           ControlFile.checkPointCopy.undo.xlogid,
-           ControlFile.checkPointCopy.undo.xrecoff);
     printf(_("Latest checkpoint's TimeLineID:       %u\n"),
            ControlFile.checkPointCopy.ThisTimeLineID);
     printf(_("Latest checkpoint's NextXID:          %u/%u\n"),
Index: src/include/catalog/pg_control.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_control.h,v
retrieving revision 1.35
diff -a -u -r1.35 pg_control.h
--- src/include/catalog/pg_control.h    5 Jan 2007 22:19:52 -0000    1.35
+++ src/include/catalog/pg_control.h    22 Feb 2007 15:47:53 -0000
@@ -32,9 +32,6 @@
 {
     XLogRecPtr    redo;            /* next RecPtr available when we began to
                                  * create CheckPoint (i.e. REDO start point) */
-    XLogRecPtr    undo;            /* first record of oldest in-progress
-                                 * transaction when we started (i.e. UNDO end
-                                 * point) */
     TimeLineID    ThisTimeLineID; /* current TLI */
     uint32        nextXidEpoch;    /* higher-order bits of nextXid */
     TransactionId nextXid;        /* next free XID */

pgsql-hackers by date:

Previous
From: Markus Schiltknecht
Date:
Subject: Re: [Monotone-devel] Re: SCMS question
Next
From: Andrew Dunstan
Date:
Subject: Re: [Monotone-devel] Re: SCMS question