Unix Technical Forum

Re: What is CheckPoint.undo needed for?

This is a discussion on Re: What is CheckPoint.undo needed for? within the pgsql Hackers forums, part of the PostgreSQL category; --> Your patch has been added to the PostgreSQL unapplied patches list at: http://momjian.postgresql.org/cgi-bin/pgpatches It will be applied as soon ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 08:28 AM
Bruce Momjian
 
Posts: n/a
Default Re: What is CheckPoint.undo needed for?


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------


Florian G. Pflug wrote:
> Tom Lane wrote:
> > Alvaro Herrera <alvherre@commandprompt.com> writes:
> >> I think you should increase pg_control version.

> >
> > And the WAL page-header version, since this also changes WAL contents.

>
> Here is an updated version. I've incremeted XLOG_PAGE_MAGIC and
> PG_CONTROL_VERSION by one.
>
> 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 23 Feb 2007 15:09:09 -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 23 Feb 2007 15:09:09 -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/bin/pg_resetxlog/pg_resetxlog.c
> ================================================== =================
> RCS file: /projects/cvsroot/pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v
> retrieving revision 1.57
> diff -a -u -r1.57 pg_resetxlog.c
> --- src/bin/pg_resetxlog/pg_resetxlog.c 10 Feb 2007 14:58:55 -0000 1.57
> +++ src/bin/pg_resetxlog/pg_resetxlog.c 23 Feb 2007 15:09:09 -0000
> @@ -464,7 +464,6 @@
>
> ControlFile.checkPointCopy.redo.xlogid = 0;
> ControlFile.checkPointCopy.redo.xrecoff = SizeOfXLogLongPHD;
> - ControlFile.checkPointCopy.undo = ControlFile.checkPointCopy.redo;
> ControlFile.checkPointCopy.ThisTimeLineID = 1;
> ControlFile.checkPointCopy.nextXidEpoch = 0;
> ControlFile.checkPointCopy.nextXid = (TransactionId) 514; /* XXX */
> @@ -600,7 +599,6 @@
> ControlFile.checkPointCopy.redo.xlogid = newXlogId;
> ControlFile.checkPointCopy.redo.xrecoff =
> newXlogSeg * XLogSegSize + SizeOfXLogLongPHD;
> - ControlFile.checkPointCopy.undo = ControlFile.checkPointCopy.redo;
> ControlFile.checkPointCopy.time = time(NULL);
>
> ControlFile.state = DB_SHUTDOWNED;
> Index: src/include/access/xlog_internal.h
> ================================================== =================
> RCS file: /projects/cvsroot/pgsql/src/include/access/xlog_internal.h,v
> retrieving revision 1.18
> diff -a -u -r1.18 xlog_internal.h
> --- src/include/access/xlog_internal.h 5 Jan 2007 22:19:51 -0000 1.18
> +++ src/include/access/xlog_internal.h 23 Feb 2007 15:09:09 -0000
> @@ -71,7 +71,7 @@
> /*
> * Each page of XLOG file has a header like this:
> */
> -#define XLOG_PAGE_MAGIC 0xD05E /* can be used as WAL version indicator */
> +#define XLOG_PAGE_MAGIC 0xD05F /* can be used as WAL version indicator */
>
> typedef struct XLogPageHeaderData
> {
> 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 23 Feb 2007 15:09:09 -0000
> @@ -22,7 +22,7 @@
>
>
> /* Version identifier for this pg_control format */
> -#define PG_CONTROL_VERSION 831
> +#define PG_CONTROL_VERSION 832
>
> /*
> * Body of CheckPoint XLOG records. This is declared here because we keep
> @@ -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 */
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly


--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:53 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com