]> granicus.if.org Git - postgresql/commitdiff
Remove the mostly-stubbed-out-anyway support routines for WAL UNDO.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Jun 2005 17:01:25 +0000 (17:01 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Jun 2005 17:01:25 +0000 (17:01 +0000)
That code is never going to be used in the foreseeable future, and
where it's more than a stub it's making the redo routines harder to
read.

30 files changed:
src/backend/access/gist/gist.c
src/backend/access/hash/hash.c
src/backend/access/heap/heapam.c
src/backend/access/nbtree/nbtxlog.c
src/backend/access/rtree/rtree.c
src/backend/access/transam/clog.c
src/backend/access/transam/rmgr.c
src/backend/access/transam/xact.c
src/backend/access/transam/xlog.c
src/backend/access/transam/xlogutils.c
src/backend/commands/dbcommands.c
src/backend/commands/sequence.c
src/backend/commands/tablespace.c
src/backend/storage/smgr/smgr.c
src/backend/utils/init/flatfiles.c
src/include/access/clog.h
src/include/access/gist_private.h
src/include/access/hash.h
src/include/access/heapam.h
src/include/access/nbtree.h
src/include/access/rmgr.h
src/include/access/rtree.h
src/include/access/xact.h
src/include/access/xlog.h
src/include/access/xlog_internal.h
src/include/access/xlogutils.h
src/include/commands/dbcommands.h
src/include/commands/sequence.h
src/include/commands/tablespace.h
src/include/storage/smgr.h

index fd160670ce8676b2891f05f62e42875620c68960..2a55c91f0df347138cec17f62d19b2b399fee7ca 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.117 2005/05/17 03:34:18 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.118 2005/06/06 17:01:21 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1732,12 +1732,6 @@ gist_redo(XLogRecPtr lsn, XLogRecord *record)
        elog(PANIC, "gist_redo: unimplemented");
 }
 
-void
-gist_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-       elog(PANIC, "gist_undo: unimplemented");
-}
-
 void
 gist_desc(char *buf, uint8 xl_info, char *rec)
 {
index 6eda509114111d9a9d0da2311b9ddedbdce82793..f8611ce46a0747a4efa31f45e2a5870bc0c56ee2 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.79 2005/05/11 06:24:51 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.80 2005/06/06 17:01:21 tgl Exp $
  *
  * NOTES
  *       This file contains only the public interface routines.
@@ -671,12 +671,6 @@ hash_redo(XLogRecPtr lsn, XLogRecord *record)
        elog(PANIC, "hash_redo: unimplemented");
 }
 
-void
-hash_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-       elog(PANIC, "hash_undo: unimplemented");
-}
-
 void
 hash_desc(char *buf, uint8 xl_info, char *rec)
 {
index bffd56dd54c1c2b5dca8f22186e1ba5de937a52c..fa9f1a207635f5d0aacfe6dc6305d3d13fa9dba7 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.191 2005/05/19 21:35:44 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.192 2005/06/06 17:01:22 tgl Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -2452,17 +2452,17 @@ log_heap_move(Relation reln, Buffer oldbuf, ItemPointerData from,
 }
 
 static void
-heap_xlog_clean(bool redo, XLogRecPtr lsn, XLogRecord *record)
+heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record)
 {
        xl_heap_clean *xlrec = (xl_heap_clean *) XLogRecGetData(record);
        Relation        reln;
        Buffer          buffer;
        Page            page;
 
-       if (!redo || (record->xl_info & XLR_BKP_BLOCK_1))
+       if (record->xl_info & XLR_BKP_BLOCK_1)
                return;
 
-       reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->node);
+       reln = XLogOpenRelation(xlrec->node);
        if (!RelationIsValid(reln))
                return;
 
@@ -2507,7 +2507,7 @@ heap_xlog_clean(bool redo, XLogRecPtr lsn, XLogRecord *record)
 }
 
 static void
-heap_xlog_newpage(bool redo, XLogRecPtr lsn, XLogRecord *record)
+heap_xlog_newpage(XLogRecPtr lsn, XLogRecord *record)
 {
        xl_heap_newpage *xlrec = (xl_heap_newpage *) XLogRecGetData(record);
        Relation        reln;
@@ -2519,10 +2519,10 @@ heap_xlog_newpage(bool redo, XLogRecPtr lsn, XLogRecord *record)
         * do not do anything that assumes we are touching a heap.
         */
 
-       if (!redo || (record->xl_info & XLR_BKP_BLOCK_1))
+       if (record->xl_info & XLR_BKP_BLOCK_1)
                return;
 
-       reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->node);
+       reln = XLogOpenRelation(xlrec->node);
        if (!RelationIsValid(reln))
                return;
        buffer = XLogReadBuffer(true, reln, xlrec->blkno);
@@ -2540,7 +2540,7 @@ heap_xlog_newpage(bool redo, XLogRecPtr lsn, XLogRecord *record)
 }
 
 static void
-heap_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
+heap_xlog_delete(XLogRecPtr lsn, XLogRecord *record)
 {
        xl_heap_delete *xlrec = (xl_heap_delete *) XLogRecGetData(record);
        Relation        reln;
@@ -2550,10 +2550,10 @@ heap_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
        ItemId          lp = NULL;
        HeapTupleHeader htup;
 
-       if (redo && (record->xl_info & XLR_BKP_BLOCK_1))
+       if (record->xl_info & XLR_BKP_BLOCK_1)
                return;
 
-       reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
+       reln = XLogOpenRelation(xlrec->target.node);
 
        if (!RelationIsValid(reln))
                return;
@@ -2561,153 +2561,129 @@ heap_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
        buffer = XLogReadBuffer(false, reln,
                                                ItemPointerGetBlockNumber(&(xlrec->target.tid)));
        if (!BufferIsValid(buffer))
-               elog(PANIC, "heap_delete_%sdo: no block", (redo) ? "re" : "un");
+               elog(PANIC, "heap_delete_redo: no block");
 
        page = (Page) BufferGetPage(buffer);
        if (PageIsNew((PageHeader) page))
-               elog(PANIC, "heap_delete_%sdo: uninitialized page", (redo) ? "re" : "un");
+               elog(PANIC, "heap_delete_redo: uninitialized page");
 
-       if (redo)
+       if (XLByteLE(lsn, PageGetLSN(page)))    /* changes are applied */
        {
-               if (XLByteLE(lsn, PageGetLSN(page)))    /* changes are applied */
-               {
-                       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-                       ReleaseBuffer(buffer);
-                       return;
-               }
+               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+               ReleaseBuffer(buffer);
+               return;
        }
-       else if (XLByteLT(PageGetLSN(page), lsn))       /* changes are not applied
-                                                                                                * ?! */
-               elog(PANIC, "heap_delete_undo: bad page LSN");
 
        offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
        if (PageGetMaxOffsetNumber(page) >= offnum)
                lp = PageGetItemId(page, offnum);
 
        if (PageGetMaxOffsetNumber(page) < offnum || !ItemIdIsUsed(lp))
-               elog(PANIC, "heap_delete_%sdo: invalid lp", (redo) ? "re" : "un");
+               elog(PANIC, "heap_delete_redo: invalid lp");
 
        htup = (HeapTupleHeader) PageGetItem(page, lp);
 
-       if (redo)
-       {
-               htup->t_infomask &= ~(HEAP_XMAX_COMMITTED |
-                                                         HEAP_XMAX_INVALID |
-                                                         HEAP_XMAX_IS_MULTI |
-                                                         HEAP_IS_LOCKED |
-                                                         HEAP_MOVED);
-               HeapTupleHeaderSetXmax(htup, record->xl_xid);
-               HeapTupleHeaderSetCmax(htup, FirstCommandId);
-               /* Make sure there is no forward chain link in t_ctid */
-               htup->t_ctid = xlrec->target.tid;
-               PageSetLSN(page, lsn);
-               PageSetTLI(page, ThisTimeLineID);
-               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-               WriteBuffer(buffer);
-               return;
-       }
-
-       elog(PANIC, "heap_delete_undo: unimplemented");
+       htup->t_infomask &= ~(HEAP_XMAX_COMMITTED |
+                                                 HEAP_XMAX_INVALID |
+                                                 HEAP_XMAX_IS_MULTI |
+                                                 HEAP_IS_LOCKED |
+                                                 HEAP_MOVED);
+       HeapTupleHeaderSetXmax(htup, record->xl_xid);
+       HeapTupleHeaderSetCmax(htup, FirstCommandId);
+       /* Make sure there is no forward chain link in t_ctid */
+       htup->t_ctid = xlrec->target.tid;
+       PageSetLSN(page, lsn);
+       PageSetTLI(page, ThisTimeLineID);
+       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+       WriteBuffer(buffer);
 }
 
 static void
-heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
+heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record)
 {
        xl_heap_insert *xlrec = (xl_heap_insert *) XLogRecGetData(record);
        Relation        reln;
        Buffer          buffer;
        Page            page;
        OffsetNumber offnum;
+       struct
+       {
+               HeapTupleHeaderData hdr;
+               char    data[MaxTupleSize];
+       }                       tbuf;
+       HeapTupleHeader htup;
+       xl_heap_header xlhdr;
+       uint32          newlen;
 
-       if (redo && (record->xl_info & XLR_BKP_BLOCK_1))
+       if (record->xl_info & XLR_BKP_BLOCK_1)
                return;
 
-       reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
+       reln = XLogOpenRelation(xlrec->target.node);
 
        if (!RelationIsValid(reln))
                return;
 
-       buffer = XLogReadBuffer((redo) ? true : false, reln,
+       buffer = XLogReadBuffer(true, reln,
                                                ItemPointerGetBlockNumber(&(xlrec->target.tid)));
        if (!BufferIsValid(buffer))
                return;
 
        page = (Page) BufferGetPage(buffer);
        if (PageIsNew((PageHeader) page) &&
-               (!redo || !(record->xl_info & XLOG_HEAP_INIT_PAGE)))
-               elog(PANIC, "heap_insert_%sdo: uninitialized page", (redo) ? "re" : "un");
+               !(record->xl_info & XLOG_HEAP_INIT_PAGE))
+               elog(PANIC, "heap_insert_redo: uninitialized page");
 
-       if (redo)
-       {
-               struct
-               {
-                       HeapTupleHeaderData hdr;
-                       char            data[MaxTupleSize];
-               }                       tbuf;
-               HeapTupleHeader htup;
-               xl_heap_header xlhdr;
-               uint32          newlen;
-
-               if (record->xl_info & XLOG_HEAP_INIT_PAGE)
-                       PageInit(page, BufferGetPageSize(buffer), 0);
-
-               if (XLByteLE(lsn, PageGetLSN(page)))    /* changes are applied */
-               {
-                       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-                       ReleaseBuffer(buffer);
-                       return;
-               }
-
-               offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
-               if (PageGetMaxOffsetNumber(page) + 1 < offnum)
-                       elog(PANIC, "heap_insert_redo: invalid max offset number");
-
-               newlen = record->xl_len - SizeOfHeapInsert - SizeOfHeapHeader;
-               Assert(newlen <= MaxTupleSize);
-               memcpy((char *) &xlhdr,
-                          (char *) xlrec + SizeOfHeapInsert,
-                          SizeOfHeapHeader);
-               htup = &tbuf.hdr;
-               MemSet((char *) htup, 0, sizeof(HeapTupleHeaderData));
-               /* PG73FORMAT: get bitmap [+ padding] [+ oid] + data */
-               memcpy((char *) htup + offsetof(HeapTupleHeaderData, t_bits),
-                          (char *) xlrec + SizeOfHeapInsert + SizeOfHeapHeader,
-                          newlen);
-               newlen += offsetof(HeapTupleHeaderData, t_bits);
-               htup->t_natts = xlhdr.t_natts;
-               htup->t_infomask = xlhdr.t_infomask;
-               htup->t_hoff = xlhdr.t_hoff;
-               HeapTupleHeaderSetXmin(htup, record->xl_xid);
-               HeapTupleHeaderSetCmin(htup, FirstCommandId);
-               htup->t_ctid = xlrec->target.tid;
+       if (record->xl_info & XLOG_HEAP_INIT_PAGE)
+               PageInit(page, BufferGetPageSize(buffer), 0);
 
-               offnum = PageAddItem(page, (Item) htup, newlen, offnum,
-                                                        LP_USED | OverwritePageMode);
-               if (offnum == InvalidOffsetNumber)
-                       elog(PANIC, "heap_insert_redo: failed to add tuple");
-               PageSetLSN(page, lsn);
-               PageSetTLI(page, ThisTimeLineID);
+       if (XLByteLE(lsn, PageGetLSN(page)))    /* changes are applied */
+       {
                LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-               WriteBuffer(buffer);
+               ReleaseBuffer(buffer);
                return;
        }
 
-       /* undo insert */
-       if (XLByteLT(PageGetLSN(page), lsn))            /* changes are not applied
-                                                                                                * ?! */
-               elog(PANIC, "heap_insert_undo: bad page LSN");
-
-       elog(PANIC, "heap_insert_undo: unimplemented");
+       offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
+       if (PageGetMaxOffsetNumber(page) + 1 < offnum)
+               elog(PANIC, "heap_insert_redo: invalid max offset number");
+
+       newlen = record->xl_len - SizeOfHeapInsert - SizeOfHeapHeader;
+       Assert(newlen <= MaxTupleSize);
+       memcpy((char *) &xlhdr,
+                  (char *) xlrec + SizeOfHeapInsert,
+                  SizeOfHeapHeader);
+       htup = &tbuf.hdr;
+       MemSet((char *) htup, 0, sizeof(HeapTupleHeaderData));
+       /* PG73FORMAT: get bitmap [+ padding] [+ oid] + data */
+       memcpy((char *) htup + offsetof(HeapTupleHeaderData, t_bits),
+                  (char *) xlrec + SizeOfHeapInsert + SizeOfHeapHeader,
+                  newlen);
+       newlen += offsetof(HeapTupleHeaderData, t_bits);
+       htup->t_natts = xlhdr.t_natts;
+       htup->t_infomask = xlhdr.t_infomask;
+       htup->t_hoff = xlhdr.t_hoff;
+       HeapTupleHeaderSetXmin(htup, record->xl_xid);
+       HeapTupleHeaderSetCmin(htup, FirstCommandId);
+       htup->t_ctid = xlrec->target.tid;
+
+       offnum = PageAddItem(page, (Item) htup, newlen, offnum,
+                                                LP_USED | OverwritePageMode);
+       if (offnum == InvalidOffsetNumber)
+               elog(PANIC, "heap_insert_redo: failed to add tuple");
+       PageSetLSN(page, lsn);
+       PageSetTLI(page, ThisTimeLineID);
+       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+       WriteBuffer(buffer);
 }
 
 /*
  * Handles UPDATE & MOVE
  */
 static void
-heap_xlog_update(bool redo, XLogRecPtr lsn, XLogRecord *record, bool move)
+heap_xlog_update(XLogRecPtr lsn, XLogRecord *record, bool move)
 {
        xl_heap_update *xlrec = (xl_heap_update *) XLogRecGetData(record);
-       Relation        reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
+       Relation        reln = XLogOpenRelation(xlrec->target.node);
        Buffer          buffer;
        bool            samepage =
        (ItemPointerGetBlockNumber(&(xlrec->newtid)) ==
@@ -2716,11 +2692,19 @@ heap_xlog_update(bool redo, XLogRecPtr lsn, XLogRecord *record, bool move)
        OffsetNumber offnum;
        ItemId          lp = NULL;
        HeapTupleHeader htup;
+       struct
+       {
+               HeapTupleHeaderData hdr;
+               char    data[MaxTupleSize];
+       }                       tbuf;
+       xl_heap_header xlhdr;
+       int                     hsize;
+       uint32          newlen;
 
        if (!RelationIsValid(reln))
                return;
 
-       if (redo && (record->xl_info & XLR_BKP_BLOCK_1))
+       if (record->xl_info & XLR_BKP_BLOCK_1)
                goto newt;
 
        /* Deal with old tuple version */
@@ -2728,81 +2712,68 @@ heap_xlog_update(bool redo, XLogRecPtr lsn, XLogRecord *record, bool move)
        buffer = XLogReadBuffer(false, reln,
                                                ItemPointerGetBlockNumber(&(xlrec->target.tid)));
        if (!BufferIsValid(buffer))
-               elog(PANIC, "heap_update_%sdo: no block", (redo) ? "re" : "un");
+               elog(PANIC, "heap_update_redo: no block");
 
        page = (Page) BufferGetPage(buffer);
        if (PageIsNew((PageHeader) page))
-               elog(PANIC, "heap_update_%sdo: uninitialized old page", (redo) ? "re" : "un");
+               elog(PANIC, "heap_update_redo: uninitialized old page");
 
-       if (redo)
+       if (XLByteLE(lsn, PageGetLSN(page)))    /* changes are applied */
        {
-               if (XLByteLE(lsn, PageGetLSN(page)))    /* changes are applied */
-               {
-                       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-                       ReleaseBuffer(buffer);
-                       if (samepage)
-                               return;
-                       goto newt;
-               }
+               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+               ReleaseBuffer(buffer);
+               if (samepage)
+                       return;
+               goto newt;
        }
-       else if (XLByteLT(PageGetLSN(page), lsn))       /* changes are not applied
-                                                                                                * ?! */
-               elog(PANIC, "heap_update_undo: bad old tuple page LSN");
 
        offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
        if (PageGetMaxOffsetNumber(page) >= offnum)
                lp = PageGetItemId(page, offnum);
 
        if (PageGetMaxOffsetNumber(page) < offnum || !ItemIdIsUsed(lp))
-               elog(PANIC, "heap_update_%sdo: invalid lp", (redo) ? "re" : "un");
+               elog(PANIC, "heap_update_redo: invalid lp");
 
        htup = (HeapTupleHeader) PageGetItem(page, lp);
 
-       if (redo)
+       if (move)
        {
-               if (move)
-               {
-                       htup->t_infomask &= ~(HEAP_XMIN_COMMITTED |
-                                                                 HEAP_XMIN_INVALID |
-                                                                 HEAP_MOVED_IN);
-                       htup->t_infomask |= HEAP_MOVED_OFF;
-                       HeapTupleHeaderSetXvac(htup, record->xl_xid);
-                       /* Make sure there is no forward chain link in t_ctid */
-                       htup->t_ctid = xlrec->target.tid;
-               }
-               else
-               {
-                       htup->t_infomask &= ~(HEAP_XMAX_COMMITTED |
-                                                                 HEAP_XMAX_INVALID |
-                                                                 HEAP_XMAX_IS_MULTI |
-                                                                 HEAP_IS_LOCKED |
-                                                                 HEAP_MOVED);
-                       HeapTupleHeaderSetXmax(htup, record->xl_xid);
-                       HeapTupleHeaderSetCmax(htup, FirstCommandId);
-                       /* Set forward chain link in t_ctid */
-                       htup->t_ctid = xlrec->newtid;
-               }
-               if (samepage)
-                       goto newsame;
-               PageSetLSN(page, lsn);
-               PageSetTLI(page, ThisTimeLineID);
-               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-               WriteBuffer(buffer);
-               goto newt;
+               htup->t_infomask &= ~(HEAP_XMIN_COMMITTED |
+                                                         HEAP_XMIN_INVALID |
+                                                         HEAP_MOVED_IN);
+               htup->t_infomask |= HEAP_MOVED_OFF;
+               HeapTupleHeaderSetXvac(htup, record->xl_xid);
+               /* Make sure there is no forward chain link in t_ctid */
+               htup->t_ctid = xlrec->target.tid;
        }
-
-       elog(PANIC, "heap_update_undo: unimplemented");
+       else
+       {
+               htup->t_infomask &= ~(HEAP_XMAX_COMMITTED |
+                                                         HEAP_XMAX_INVALID |
+                                                         HEAP_XMAX_IS_MULTI |
+                                                         HEAP_IS_LOCKED |
+                                                         HEAP_MOVED);
+               HeapTupleHeaderSetXmax(htup, record->xl_xid);
+               HeapTupleHeaderSetCmax(htup, FirstCommandId);
+               /* Set forward chain link in t_ctid */
+               htup->t_ctid = xlrec->newtid;
+       }
+       if (samepage)
+               goto newsame;
+       PageSetLSN(page, lsn);
+       PageSetTLI(page, ThisTimeLineID);
+       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+       WriteBuffer(buffer);
 
        /* Deal with new tuple */
 
 newt:;
 
-       if (redo &&
-               ((record->xl_info & XLR_BKP_BLOCK_2) ||
-                ((record->xl_info & XLR_BKP_BLOCK_1) && samepage)))
+       if ((record->xl_info & XLR_BKP_BLOCK_2) ||
+               ((record->xl_info & XLR_BKP_BLOCK_1) && samepage))
                return;
 
-       buffer = XLogReadBuffer((redo) ? true : false, reln,
+       buffer = XLogReadBuffer(true, reln,
                                                        ItemPointerGetBlockNumber(&(xlrec->newtid)));
        if (!BufferIsValid(buffer))
                return;
@@ -2811,94 +2782,74 @@ newt:;
 
 newsame:;
        if (PageIsNew((PageHeader) page) &&
-               (!redo || !(record->xl_info & XLOG_HEAP_INIT_PAGE)))
-               elog(PANIC, "heap_update_%sdo: uninitialized page", (redo) ? "re" : "un");
+               !(record->xl_info & XLOG_HEAP_INIT_PAGE))
+               elog(PANIC, "heap_update_redo: uninitialized page");
 
-       if (redo)
-       {
-               struct
-               {
-                       HeapTupleHeaderData hdr;
-                       char            data[MaxTupleSize];
-               }                       tbuf;
-               xl_heap_header xlhdr;
-               int                     hsize;
-               uint32          newlen;
-
-               if (record->xl_info & XLOG_HEAP_INIT_PAGE)
-                       PageInit(page, BufferGetPageSize(buffer), 0);
-
-               if (XLByteLE(lsn, PageGetLSN(page)))    /* changes are applied */
-               {
-                       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-                       ReleaseBuffer(buffer);
-                       return;
-               }
-
-               offnum = ItemPointerGetOffsetNumber(&(xlrec->newtid));
-               if (PageGetMaxOffsetNumber(page) + 1 < offnum)
-                       elog(PANIC, "heap_update_redo: invalid max offset number");
-
-               hsize = SizeOfHeapUpdate + SizeOfHeapHeader;
-               if (move)
-                       hsize += (2 * sizeof(TransactionId));
-
-               newlen = record->xl_len - hsize;
-               Assert(newlen <= MaxTupleSize);
-               memcpy((char *) &xlhdr,
-                          (char *) xlrec + SizeOfHeapUpdate,
-                          SizeOfHeapHeader);
-               htup = &tbuf.hdr;
-               MemSet((char *) htup, 0, sizeof(HeapTupleHeaderData));
-               /* PG73FORMAT: get bitmap [+ padding] [+ oid] + data */
-               memcpy((char *) htup + offsetof(HeapTupleHeaderData, t_bits),
-                          (char *) xlrec + hsize,
-                          newlen);
-               newlen += offsetof(HeapTupleHeaderData, t_bits);
-               htup->t_natts = xlhdr.t_natts;
-               htup->t_infomask = xlhdr.t_infomask;
-               htup->t_hoff = xlhdr.t_hoff;
-
-               if (move)
-               {
-                       TransactionId xid[2];           /* xmax, xmin */
-
-                       memcpy((char *) xid,
-                                  (char *) xlrec + SizeOfHeapUpdate + SizeOfHeapHeader,
-                                  2 * sizeof(TransactionId));
-                       HeapTupleHeaderSetXmin(htup, xid[1]);
-                       HeapTupleHeaderSetXmax(htup, xid[0]);
-                       HeapTupleHeaderSetXvac(htup, record->xl_xid);
-               }
-               else
-               {
-                       HeapTupleHeaderSetXmin(htup, record->xl_xid);
-                       HeapTupleHeaderSetCmin(htup, FirstCommandId);
-               }
-               /* Make sure there is no forward chain link in t_ctid */
-               htup->t_ctid = xlrec->newtid;
+       if (record->xl_info & XLOG_HEAP_INIT_PAGE)
+               PageInit(page, BufferGetPageSize(buffer), 0);
 
-               offnum = PageAddItem(page, (Item) htup, newlen, offnum,
-                                                        LP_USED | OverwritePageMode);
-               if (offnum == InvalidOffsetNumber)
-                       elog(PANIC, "heap_update_redo: failed to add tuple");
-               PageSetLSN(page, lsn);
-               PageSetTLI(page, ThisTimeLineID);
+       if (XLByteLE(lsn, PageGetLSN(page)))    /* changes are applied */
+       {
                LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-               WriteBuffer(buffer);
+               ReleaseBuffer(buffer);
                return;
        }
 
-       /* undo */
-       if (XLByteLT(PageGetLSN(page), lsn))            /* changes not applied?! */
-               elog(PANIC, "heap_update_undo: bad new tuple page LSN");
-
-       elog(PANIC, "heap_update_undo: unimplemented");
+       offnum = ItemPointerGetOffsetNumber(&(xlrec->newtid));
+       if (PageGetMaxOffsetNumber(page) + 1 < offnum)
+               elog(PANIC, "heap_update_redo: invalid max offset number");
+
+       hsize = SizeOfHeapUpdate + SizeOfHeapHeader;
+       if (move)
+               hsize += (2 * sizeof(TransactionId));
+
+       newlen = record->xl_len - hsize;
+       Assert(newlen <= MaxTupleSize);
+       memcpy((char *) &xlhdr,
+                  (char *) xlrec + SizeOfHeapUpdate,
+                  SizeOfHeapHeader);
+       htup = &tbuf.hdr;
+       MemSet((char *) htup, 0, sizeof(HeapTupleHeaderData));
+       /* PG73FORMAT: get bitmap [+ padding] [+ oid] + data */
+       memcpy((char *) htup + offsetof(HeapTupleHeaderData, t_bits),
+                  (char *) xlrec + hsize,
+                  newlen);
+       newlen += offsetof(HeapTupleHeaderData, t_bits);
+       htup->t_natts = xlhdr.t_natts;
+       htup->t_infomask = xlhdr.t_infomask;
+       htup->t_hoff = xlhdr.t_hoff;
+
+       if (move)
+       {
+               TransactionId xid[2];           /* xmax, xmin */
+
+               memcpy((char *) xid,
+                          (char *) xlrec + SizeOfHeapUpdate + SizeOfHeapHeader,
+                          2 * sizeof(TransactionId));
+               HeapTupleHeaderSetXmin(htup, xid[1]);
+               HeapTupleHeaderSetXmax(htup, xid[0]);
+               HeapTupleHeaderSetXvac(htup, record->xl_xid);
+       }
+       else
+       {
+               HeapTupleHeaderSetXmin(htup, record->xl_xid);
+               HeapTupleHeaderSetCmin(htup, FirstCommandId);
+       }
+       /* Make sure there is no forward chain link in t_ctid */
+       htup->t_ctid = xlrec->newtid;
 
+       offnum = PageAddItem(page, (Item) htup, newlen, offnum,
+                                                LP_USED | OverwritePageMode);
+       if (offnum == InvalidOffsetNumber)
+               elog(PANIC, "heap_update_redo: failed to add tuple");
+       PageSetLSN(page, lsn);
+       PageSetTLI(page, ThisTimeLineID);
+       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+       WriteBuffer(buffer);
 }
 
 static void
-heap_xlog_lock(bool redo, XLogRecPtr lsn, XLogRecord *record)
+heap_xlog_lock(XLogRecPtr lsn, XLogRecord *record)
 {
        xl_heap_lock *xlrec = (xl_heap_lock *) XLogRecGetData(record);
        Relation        reln;
@@ -2908,10 +2859,10 @@ heap_xlog_lock(bool redo, XLogRecPtr lsn, XLogRecord *record)
        ItemId          lp = NULL;
        HeapTupleHeader htup;
 
-       if (redo && (record->xl_info & XLR_BKP_BLOCK_1))
+       if (record->xl_info & XLR_BKP_BLOCK_1)
                return;
 
-       reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
+       reln = XLogOpenRelation(xlrec->target.node);
 
        if (!RelationIsValid(reln))
                return;
@@ -2919,58 +2870,46 @@ heap_xlog_lock(bool redo, XLogRecPtr lsn, XLogRecord *record)
        buffer = XLogReadBuffer(false, reln,
                                                ItemPointerGetBlockNumber(&(xlrec->target.tid)));
        if (!BufferIsValid(buffer))
-               elog(PANIC, "heap_lock_%sdo: no block", (redo) ? "re" : "un");
+               elog(PANIC, "heap_lock_redo: no block");
 
        page = (Page) BufferGetPage(buffer);
        if (PageIsNew((PageHeader) page))
-               elog(PANIC, "heap_lock_%sdo: uninitialized page", (redo) ? "re" : "un");
+               elog(PANIC, "heap_lock_redo: uninitialized page");
 
-       if (redo)
+       if (XLByteLE(lsn, PageGetLSN(page)))    /* changes are applied */
        {
-               if (XLByteLE(lsn, PageGetLSN(page)))    /* changes are applied */
-               {
-                       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-                       ReleaseBuffer(buffer);
-                       return;
-               }
+               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+               ReleaseBuffer(buffer);
+               return;
        }
-       else if (XLByteLT(PageGetLSN(page), lsn))       /* changes are not applied
-                                                                                                * ?! */
-               elog(PANIC, "heap_lock_undo: bad page LSN");
 
        offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
        if (PageGetMaxOffsetNumber(page) >= offnum)
                lp = PageGetItemId(page, offnum);
 
        if (PageGetMaxOffsetNumber(page) < offnum || !ItemIdIsUsed(lp))
-               elog(PANIC, "heap_lock_%sdo: invalid lp", (redo) ? "re" : "un");
+               elog(PANIC, "heap_lock_redo: invalid lp");
 
        htup = (HeapTupleHeader) PageGetItem(page, lp);
 
-       if (redo)
-       {
-               /*
-                * Presently, we don't bother to restore the locked state, but
-                * just set the XMAX_INVALID bit.
-                */
-               htup->t_infomask &= ~(HEAP_XMAX_COMMITTED |
-                                                         HEAP_XMAX_INVALID |
-                                                         HEAP_XMAX_IS_MULTI |
-                                                         HEAP_IS_LOCKED |
-                                                         HEAP_MOVED);
-               htup->t_infomask |= HEAP_XMAX_INVALID;
-               HeapTupleHeaderSetXmax(htup, record->xl_xid);
-               HeapTupleHeaderSetCmax(htup, FirstCommandId);
-               /* Make sure there is no forward chain link in t_ctid */
-               htup->t_ctid = xlrec->target.tid;
-               PageSetLSN(page, lsn);
-               PageSetTLI(page, ThisTimeLineID);
-               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-               WriteBuffer(buffer);
-               return;
-       }
-
-       elog(PANIC, "heap_lock_undo: unimplemented");
+       /*
+        * Presently, we don't bother to restore the locked state, but
+        * just set the XMAX_INVALID bit.
+        */
+       htup->t_infomask &= ~(HEAP_XMAX_COMMITTED |
+                                                 HEAP_XMAX_INVALID |
+                                                 HEAP_XMAX_IS_MULTI |
+                                                 HEAP_IS_LOCKED |
+                                                 HEAP_MOVED);
+       htup->t_infomask |= HEAP_XMAX_INVALID;
+       HeapTupleHeaderSetXmax(htup, record->xl_xid);
+       HeapTupleHeaderSetCmax(htup, FirstCommandId);
+       /* Make sure there is no forward chain link in t_ctid */
+       htup->t_ctid = xlrec->target.tid;
+       PageSetLSN(page, lsn);
+       PageSetTLI(page, ThisTimeLineID);
+       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+       WriteBuffer(buffer);
 }
 
 void
@@ -2980,47 +2919,23 @@ heap_redo(XLogRecPtr lsn, XLogRecord *record)
 
        info &= XLOG_HEAP_OPMASK;
        if (info == XLOG_HEAP_INSERT)
-               heap_xlog_insert(true, lsn, record);
+               heap_xlog_insert(lsn, record);
        else if (info == XLOG_HEAP_DELETE)
-               heap_xlog_delete(true, lsn, record);
+               heap_xlog_delete(lsn, record);
        else if (info == XLOG_HEAP_UPDATE)
-               heap_xlog_update(true, lsn, record, false);
+               heap_xlog_update(lsn, record, false);
        else if (info == XLOG_HEAP_MOVE)
-               heap_xlog_update(true, lsn, record, true);
+               heap_xlog_update(lsn, record, true);
        else if (info == XLOG_HEAP_CLEAN)
-               heap_xlog_clean(true, lsn, record);
+               heap_xlog_clean(lsn, record);
        else if (info == XLOG_HEAP_NEWPAGE)
-               heap_xlog_newpage(true, lsn, record);
+               heap_xlog_newpage(lsn, record);
        else if (info == XLOG_HEAP_LOCK)
-               heap_xlog_lock(true, lsn, record);
+               heap_xlog_lock(lsn, record);
        else
                elog(PANIC, "heap_redo: unknown op code %u", info);
 }
 
-void
-heap_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-       uint8           info = record->xl_info & ~XLR_INFO_MASK;
-
-       info &= XLOG_HEAP_OPMASK;
-       if (info == XLOG_HEAP_INSERT)
-               heap_xlog_insert(false, lsn, record);
-       else if (info == XLOG_HEAP_DELETE)
-               heap_xlog_delete(false, lsn, record);
-       else if (info == XLOG_HEAP_UPDATE)
-               heap_xlog_update(false, lsn, record, false);
-       else if (info == XLOG_HEAP_MOVE)
-               heap_xlog_update(false, lsn, record, true);
-       else if (info == XLOG_HEAP_CLEAN)
-               heap_xlog_clean(false, lsn, record);
-       else if (info == XLOG_HEAP_NEWPAGE)
-               heap_xlog_newpage(false, lsn, record);
-       else if (info == XLOG_HEAP_LOCK)
-               heap_xlog_lock(false, lsn, record);
-       else
-               elog(PANIC, "heap_undo: unknown op code %u", info);
-}
-
 static void
 out_target(char *buf, xl_heaptid *target)
 {
index 536bc17718039860b30e048fe4a9726cd7882e06..078d8529241417f9aa0afa20a0b5d993ab5d78f4 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.21 2005/06/02 05:55:28 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.22 2005/06/06 17:01:22 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -149,7 +149,7 @@ _bt_restore_meta(Relation reln, XLogRecPtr lsn,
 }
 
 static void
-btree_xlog_insert(bool redo, bool isleaf, bool ismeta,
+btree_xlog_insert(bool isleaf, bool ismeta,
                                  XLogRecPtr lsn, XLogRecord *record)
 {
        xl_btree_insert *xlrec = (xl_btree_insert *) XLogRecGetData(record);
@@ -170,70 +170,51 @@ btree_xlog_insert(bool redo, bool isleaf, bool ismeta,
                datalen -= sizeof(xl_btree_metadata);
        }
 
-       if (redo && (record->xl_info & XLR_BKP_BLOCK_1) && !ismeta &&
+       if ((record->xl_info & XLR_BKP_BLOCK_1) && !ismeta &&
                incomplete_splits == NIL)
                return;                                 /* nothing to do */
 
-       reln = XLogOpenRelation(redo, RM_BTREE_ID, xlrec->target.node);
+       reln = XLogOpenRelation(xlrec->target.node);
        if (!RelationIsValid(reln))
                return;
 
-       if (!redo || !(record->xl_info & XLR_BKP_BLOCK_1))
+       if (!(record->xl_info & XLR_BKP_BLOCK_1))
        {
                buffer = XLogReadBuffer(false, reln,
                                                ItemPointerGetBlockNumber(&(xlrec->target.tid)));
                if (!BufferIsValid(buffer))
-                       elog(PANIC, "btree_insert_%sdo: block unfound", (redo) ? "re" : "un");
+                       elog(PANIC, "btree_insert_redo: block unfound");
                page = (Page) BufferGetPage(buffer);
                if (PageIsNew((PageHeader) page))
-                       elog(PANIC, "btree_insert_%sdo: uninitialized page", (redo) ? "re" : "un");
+                       elog(PANIC, "btree_insert_redo: uninitialized page");
                pageop = (BTPageOpaque) PageGetSpecialPointer(page);
 
-               if (redo)
+               if (XLByteLE(lsn, PageGetLSN(page)))
                {
-                       if (XLByteLE(lsn, PageGetLSN(page)))
-                       {
-                               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-                               ReleaseBuffer(buffer);
-                       }
-                       else
-                       {
-                               if (PageAddItem(page, (Item) datapos, datalen,
-                                               ItemPointerGetOffsetNumber(&(xlrec->target.tid)),
-                                                               LP_USED) == InvalidOffsetNumber)
-                                       elog(PANIC, "btree_insert_redo: failed to add item");
-
-                               PageSetLSN(page, lsn);
-                               PageSetTLI(page, ThisTimeLineID);
-                               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-                               WriteBuffer(buffer);
-                       }
+                       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+                       ReleaseBuffer(buffer);
                }
                else
                {
-                       if (XLByteLT(PageGetLSN(page), lsn))
-                               elog(PANIC, "btree_insert_undo: bad page LSN");
+                       if (PageAddItem(page, (Item) datapos, datalen,
+                                                       ItemPointerGetOffsetNumber(&(xlrec->target.tid)),
+                                                       LP_USED) == InvalidOffsetNumber)
+                               elog(PANIC, "btree_insert_redo: failed to add item");
 
-                       if (!P_ISLEAF(pageop))
-                       {
-                               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-                               ReleaseBuffer(buffer);
-                       }
-                       else
-                               elog(PANIC, "btree_insert_undo: unimplemented");
+                       PageSetLSN(page, lsn);
+                       PageSetTLI(page, ThisTimeLineID);
+                       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+                       WriteBuffer(buffer);
                }
        }
 
-       if (redo)                                       /* metapage changes not undoable */
-       {
-               if (ismeta)
-                       _bt_restore_meta(reln, lsn,
-                                                        md.root, md.level,
-                                                        md.fastroot, md.fastlevel);
-       }
+       if (ismeta)
+               _bt_restore_meta(reln, lsn,
+                                                md.root, md.level,
+                                                md.fastroot, md.fastlevel);
 
        /* Forget any split this insertion completes */
-       if (redo && !isleaf && incomplete_splits != NIL)
+       if (!isleaf && incomplete_splits != NIL)
        {
                forget_matching_split(reln, xlrec->target.node,
                                                 ItemPointerGetBlockNumber(&(xlrec->target.tid)),
@@ -243,7 +224,7 @@ btree_xlog_insert(bool redo, bool isleaf, bool ismeta,
 }
 
 static void
-btree_xlog_split(bool redo, bool onleft, bool isroot,
+btree_xlog_split(bool onleft, bool isroot,
                                 XLogRecPtr lsn, XLogRecord *record)
 {
        xl_btree_split *xlrec = (xl_btree_split *) XLogRecGetData(record);
@@ -254,9 +235,8 @@ btree_xlog_split(bool redo, bool onleft, bool isroot,
        Buffer          buffer;
        Page            page;
        BTPageOpaque pageop;
-       char       *op = (redo) ? "redo" : "undo";
 
-       reln = XLogOpenRelation(redo, RM_BTREE_ID, xlrec->target.node);
+       reln = XLogOpenRelation(xlrec->target.node);
        if (!RelationIsValid(reln))
                return;
 
@@ -267,77 +247,51 @@ btree_xlog_split(bool redo, bool onleft, bool isroot,
        /* Left (original) sibling */
        buffer = XLogReadBuffer(false, reln, leftsib);
        if (!BufferIsValid(buffer))
-               elog(PANIC, "btree_split_%s: lost left sibling", op);
+               elog(PANIC, "btree_split_redo: lost left sibling");
 
        page = (Page) BufferGetPage(buffer);
-       if (redo)
-               _bt_pageinit(page, BufferGetPageSize(buffer));
-       else if (PageIsNew((PageHeader) page))
-               elog(PANIC, "btree_split_undo: uninitialized left sibling");
+       _bt_pageinit(page, BufferGetPageSize(buffer));
        pageop = (BTPageOpaque) PageGetSpecialPointer(page);
 
-       if (redo)
-       {
-               pageop->btpo_prev = xlrec->leftblk;
-               pageop->btpo_next = rightsib;
-               pageop->btpo.level = xlrec->level;
-               pageop->btpo_flags = (xlrec->level == 0) ? BTP_LEAF : 0;
+       pageop->btpo_prev = xlrec->leftblk;
+       pageop->btpo_next = rightsib;
+       pageop->btpo.level = xlrec->level;
+       pageop->btpo_flags = (xlrec->level == 0) ? BTP_LEAF : 0;
 
-               _bt_restore_page(page,
-                                                (char *) xlrec + SizeOfBtreeSplit,
-                                                xlrec->leftlen);
+       _bt_restore_page(page,
+                                        (char *) xlrec + SizeOfBtreeSplit,
+                                        xlrec->leftlen);
 
-               PageSetLSN(page, lsn);
-               PageSetTLI(page, ThisTimeLineID);
-               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-               WriteBuffer(buffer);
-       }
-       else
-       {
-               /* undo */
-               if (XLByteLT(PageGetLSN(page), lsn))
-                       elog(PANIC, "btree_split_undo: bad left sibling LSN");
-               elog(PANIC, "btree_split_undo: unimplemented");
-       }
+       PageSetLSN(page, lsn);
+       PageSetTLI(page, ThisTimeLineID);
+       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+       WriteBuffer(buffer);
 
        /* Right (new) sibling */
-       buffer = XLogReadBuffer((redo) ? true : false, reln, rightsib);
+       buffer = XLogReadBuffer(true, reln, rightsib);
        if (!BufferIsValid(buffer))
-               elog(PANIC, "btree_split_%s: lost right sibling", op);
+               elog(PANIC, "btree_split_redo: lost right sibling");
 
        page = (Page) BufferGetPage(buffer);
-       if (redo)
-               _bt_pageinit(page, BufferGetPageSize(buffer));
-       else if (PageIsNew((PageHeader) page))
-               elog(PANIC, "btree_split_undo: uninitialized right sibling");
+       _bt_pageinit(page, BufferGetPageSize(buffer));
        pageop = (BTPageOpaque) PageGetSpecialPointer(page);
 
-       if (redo)
-       {
-               pageop->btpo_prev = leftsib;
-               pageop->btpo_next = xlrec->rightblk;
-               pageop->btpo.level = xlrec->level;
-               pageop->btpo_flags = (xlrec->level == 0) ? BTP_LEAF : 0;
+       pageop->btpo_prev = leftsib;
+       pageop->btpo_next = xlrec->rightblk;
+       pageop->btpo.level = xlrec->level;
+       pageop->btpo_flags = (xlrec->level == 0) ? BTP_LEAF : 0;
 
-               _bt_restore_page(page,
-                                         (char *) xlrec + SizeOfBtreeSplit + xlrec->leftlen,
+       _bt_restore_page(page,
+                                        (char *) xlrec + SizeOfBtreeSplit + xlrec->leftlen,
                                         record->xl_len - SizeOfBtreeSplit - xlrec->leftlen);
 
-               PageSetLSN(page, lsn);
-               PageSetTLI(page, ThisTimeLineID);
-               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-               WriteBuffer(buffer);
-       }
-       else
-       {
-               /* undo */
-               if (XLByteLT(PageGetLSN(page), lsn))
-                       elog(PANIC, "btree_split_undo: bad right sibling LSN");
-               elog(PANIC, "btree_split_undo: unimplemented");
-       }
+       PageSetLSN(page, lsn);
+       PageSetTLI(page, ThisTimeLineID);
+       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+       WriteBuffer(buffer);
 
        /* Fix left-link of right (next) page */
-       if (redo && !(record->xl_info & XLR_BKP_BLOCK_1))
+       if (!(record->xl_info & XLR_BKP_BLOCK_1))
        {
                if (xlrec->rightblk != P_NONE)
                {
@@ -368,7 +322,7 @@ btree_xlog_split(bool redo, bool onleft, bool isroot,
        }
 
        /* Forget any split this insertion completes */
-       if (redo && xlrec->level > 0 && incomplete_splits != NIL)
+       if (xlrec->level > 0 && incomplete_splits != NIL)
        {
                forget_matching_split(reln, xlrec->target.node,
                                                 ItemPointerGetBlockNumber(&(xlrec->target.tid)),
@@ -382,18 +336,18 @@ btree_xlog_split(bool redo, bool onleft, bool isroot,
 }
 
 static void
-btree_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
+btree_xlog_delete(XLogRecPtr lsn, XLogRecord *record)
 {
        xl_btree_delete *xlrec;
        Relation        reln;
        Buffer          buffer;
        Page            page;
 
-       if (!redo || (record->xl_info & XLR_BKP_BLOCK_1))
+       if (record->xl_info & XLR_BKP_BLOCK_1)
                return;
 
        xlrec = (xl_btree_delete *) XLogRecGetData(record);
-       reln = XLogOpenRelation(redo, RM_BTREE_ID, xlrec->node);
+       reln = XLogOpenRelation(xlrec->node);
        if (!RelationIsValid(reln))
                return;
        buffer = XLogReadBuffer(false, reln, xlrec->block);
@@ -428,7 +382,7 @@ btree_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
 }
 
 static void
-btree_xlog_delete_page(bool redo, bool ismeta,
+btree_xlog_delete_page(bool ismeta,
                                           XLogRecPtr lsn, XLogRecord *record)
 {
        xl_btree_delete_page *xlrec = (xl_btree_delete_page *) XLogRecGetData(record);
@@ -440,9 +394,8 @@ btree_xlog_delete_page(bool redo, bool ismeta,
        Buffer          buffer;
        Page            page;
        BTPageOpaque pageop;
-       char       *op = (redo) ? "redo" : "undo";
 
-       reln = XLogOpenRelation(redo, RM_BTREE_ID, xlrec->target.node);
+       reln = XLogOpenRelation(xlrec->target.node);
        if (!RelationIsValid(reln))
                return;
 
@@ -452,7 +405,7 @@ btree_xlog_delete_page(bool redo, bool ismeta,
        rightsib = xlrec->rightblk;
 
        /* parent page */
-       if (redo && !(record->xl_info & XLR_BKP_BLOCK_1))
+       if (!(record->xl_info & XLR_BKP_BLOCK_1))
        {
                buffer = XLogReadBuffer(false, reln, parent);
                if (!BufferIsValid(buffer))
@@ -498,7 +451,7 @@ btree_xlog_delete_page(bool redo, bool ismeta,
        }
 
        /* Fix left-link of right sibling */
-       if (redo && !(record->xl_info & XLR_BKP_BLOCK_2))
+       if (!(record->xl_info & XLR_BKP_BLOCK_2))
        {
                buffer = XLogReadBuffer(false, reln, rightsib);
                if (!BufferIsValid(buffer))
@@ -524,7 +477,7 @@ btree_xlog_delete_page(bool redo, bool ismeta,
        }
 
        /* Fix right-link of left sibling, if any */
-       if (redo && !(record->xl_info & XLR_BKP_BLOCK_3))
+       if (!(record->xl_info & XLR_BKP_BLOCK_3))
        {
                if (leftsib != P_NONE)
                {
@@ -555,52 +508,36 @@ btree_xlog_delete_page(bool redo, bool ismeta,
        /* Rewrite target page as empty deleted page */
        buffer = XLogReadBuffer(false, reln, target);
        if (!BufferIsValid(buffer))
-               elog(PANIC, "btree_delete_page_%s: lost target page", op);
+               elog(PANIC, "btree_delete_page_redo: lost target page");
        page = (Page) BufferGetPage(buffer);
-       if (redo)
-               _bt_pageinit(page, BufferGetPageSize(buffer));
-       else if (PageIsNew((PageHeader) page))
-               elog(PANIC, "btree_delete_page_undo: uninitialized target page");
+       _bt_pageinit(page, BufferGetPageSize(buffer));
        pageop = (BTPageOpaque) PageGetSpecialPointer(page);
 
-       if (redo)
-       {
-               pageop->btpo_prev = leftsib;
-               pageop->btpo_next = rightsib;
-               pageop->btpo.xact = FrozenTransactionId;
-               pageop->btpo_flags = BTP_DELETED;
+       pageop->btpo_prev = leftsib;
+       pageop->btpo_next = rightsib;
+       pageop->btpo.xact = FrozenTransactionId;
+       pageop->btpo_flags = BTP_DELETED;
 
-               PageSetLSN(page, lsn);
-               PageSetTLI(page, ThisTimeLineID);
-               LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-               WriteBuffer(buffer);
-       }
-       else
-       {
-               /* undo */
-               if (XLByteLT(PageGetLSN(page), lsn))
-                       elog(PANIC, "btree_delete_page_undo: bad left sibling LSN");
-               elog(PANIC, "btree_delete_page_undo: unimplemented");
-       }
+       PageSetLSN(page, lsn);
+       PageSetTLI(page, ThisTimeLineID);
+       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+       WriteBuffer(buffer);
 
        /* Update metapage if needed */
-       if (redo)                                       /* metapage changes not undoable */
+       if (ismeta)
        {
-               if (ismeta)
-               {
-                       xl_btree_metadata md;
+               xl_btree_metadata md;
 
-                       memcpy(&md, (char *) xlrec + SizeOfBtreeDeletePage,
-                                  sizeof(xl_btree_metadata));
-                       _bt_restore_meta(reln, lsn,
-                                                        md.root, md.level,
-                                                        md.fastroot, md.fastlevel);
-               }
+               memcpy(&md, (char *) xlrec + SizeOfBtreeDeletePage,
+                          sizeof(xl_btree_metadata));
+               _bt_restore_meta(reln, lsn,
+                                                md.root, md.level,
+                                                md.fastroot, md.fastlevel);
        }
 }
 
 static void
-btree_xlog_newroot(bool redo, XLogRecPtr lsn, XLogRecord *record)
+btree_xlog_newroot(XLogRecPtr lsn, XLogRecord *record)
 {
        xl_btree_newroot *xlrec = (xl_btree_newroot *) XLogRecGetData(record);
        Relation        reln;
@@ -608,10 +545,7 @@ btree_xlog_newroot(bool redo, XLogRecPtr lsn, XLogRecord *record)
        Page            page;
        BTPageOpaque pageop;
 
-       if (!redo)
-               return;                                 /* not undoable */
-
-       reln = XLogOpenRelation(redo, RM_BTREE_ID, xlrec->node);
+       reln = XLogOpenRelation(xlrec->node);
        if (!RelationIsValid(reln))
                return;
        buffer = XLogReadBuffer(true, reln, xlrec->rootblk);
@@ -654,15 +588,12 @@ btree_xlog_newroot(bool redo, XLogRecPtr lsn, XLogRecord *record)
 }
 
 static void
-btree_xlog_newmeta(bool redo, XLogRecPtr lsn, XLogRecord *record)
+btree_xlog_newmeta(XLogRecPtr lsn, XLogRecord *record)
 {
        xl_btree_newmeta *xlrec = (xl_btree_newmeta *) XLogRecGetData(record);
        Relation        reln;
 
-       if (!redo)
-               return;                                 /* not undoable */
-
-       reln = XLogOpenRelation(redo, RM_BTREE_ID, xlrec->node);
+       reln = XLogOpenRelation(xlrec->node);
        if (!RelationIsValid(reln))
                return;
 
@@ -680,94 +611,46 @@ btree_redo(XLogRecPtr lsn, XLogRecord *record)
        switch (info)
        {
                case XLOG_BTREE_INSERT_LEAF:
-                       btree_xlog_insert(true, true, false, lsn, record);
+                       btree_xlog_insert(true, false, lsn, record);
                        break;
                case XLOG_BTREE_INSERT_UPPER:
-                       btree_xlog_insert(true, false, false, lsn, record);
+                       btree_xlog_insert(false, false, lsn, record);
                        break;
                case XLOG_BTREE_INSERT_META:
-                       btree_xlog_insert(true, false, true, lsn, record);
+                       btree_xlog_insert(false, true, lsn, record);
                        break;
                case XLOG_BTREE_SPLIT_L:
-                       btree_xlog_split(true, true, false, lsn, record);
+                       btree_xlog_split(true, false, lsn, record);
                        break;
                case XLOG_BTREE_SPLIT_R:
-                       btree_xlog_split(true, false, false, lsn, record);
+                       btree_xlog_split(false, false, lsn, record);
                        break;
                case XLOG_BTREE_SPLIT_L_ROOT:
-                       btree_xlog_split(true, true, true, lsn, record);
+                       btree_xlog_split(true, true, lsn, record);
                        break;
                case XLOG_BTREE_SPLIT_R_ROOT:
-                       btree_xlog_split(true, false, true, lsn, record);
+                       btree_xlog_split(false, true, lsn, record);
                        break;
                case XLOG_BTREE_DELETE:
-                       btree_xlog_delete(true, lsn, record);
+                       btree_xlog_delete(lsn, record);
                        break;
                case XLOG_BTREE_DELETE_PAGE:
-                       btree_xlog_delete_page(true, false, lsn, record);
+                       btree_xlog_delete_page(false, lsn, record);
                        break;
                case XLOG_BTREE_DELETE_PAGE_META:
-                       btree_xlog_delete_page(true, true, lsn, record);
+                       btree_xlog_delete_page(true, lsn, record);
                        break;
                case XLOG_BTREE_NEWROOT:
-                       btree_xlog_newroot(true, lsn, record);
+                       btree_xlog_newroot(lsn, record);
                        break;
                case XLOG_BTREE_NEWMETA:
-                       btree_xlog_newmeta(true, lsn, record);
+                       btree_xlog_newmeta(lsn, record);
                        break;
                default:
                        elog(PANIC, "btree_redo: unknown op code %u", info);
        }
 }
 
-void
-btree_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-       uint8           info = record->xl_info & ~XLR_INFO_MASK;
-
-       switch (info)
-       {
-               case XLOG_BTREE_INSERT_LEAF:
-                       btree_xlog_insert(false, true, false, lsn, record);
-                       break;
-               case XLOG_BTREE_INSERT_UPPER:
-                       btree_xlog_insert(false, false, false, lsn, record);
-                       break;
-               case XLOG_BTREE_INSERT_META:
-                       btree_xlog_insert(false, false, true, lsn, record);
-                       break;
-               case XLOG_BTREE_SPLIT_L:
-                       btree_xlog_split(false, true, false, lsn, record);
-                       break;
-               case XLOG_BTREE_SPLIT_R:
-                       btree_xlog_split(false, false, false, lsn, record);
-                       break;
-               case XLOG_BTREE_SPLIT_L_ROOT:
-                       btree_xlog_split(false, true, true, lsn, record);
-                       break;
-               case XLOG_BTREE_SPLIT_R_ROOT:
-                       btree_xlog_split(false, false, true, lsn, record);
-                       break;
-               case XLOG_BTREE_DELETE:
-                       btree_xlog_delete(false, lsn, record);
-                       break;
-               case XLOG_BTREE_DELETE_PAGE:
-                       btree_xlog_delete_page(false, false, lsn, record);
-                       break;
-               case XLOG_BTREE_DELETE_PAGE_META:
-                       btree_xlog_delete_page(false, true, lsn, record);
-                       break;
-               case XLOG_BTREE_NEWROOT:
-                       btree_xlog_newroot(false, lsn, record);
-                       break;
-               case XLOG_BTREE_NEWMETA:
-                       btree_xlog_newmeta(false, lsn, record);
-                       break;
-               default:
-                       elog(PANIC, "btree_undo: unknown op code %u", info);
-       }
-}
-
 static void
 out_target(char *buf, xl_btreetid *target)
 {
@@ -918,7 +801,7 @@ btree_xlog_cleanup(void)
                                        rpageop;
                bool            is_only;
 
-               reln = XLogOpenRelation(true, RM_BTREE_ID, split->node);
+               reln = XLogOpenRelation(split->node);
                if (!RelationIsValid(reln))
                        continue;
                lbuf = XLogReadBuffer(false, reln, split->leftblk);
index ce8fb655b6ccbf25d434fc07227d473ae780d7c8..e9eaa1941d6ed80b36c95c4e885f89b28a8aedcd 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/rtree/rtree.c,v 1.89 2005/05/11 06:24:54 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/rtree/rtree.c,v 1.90 2005/06/06 17:01:22 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1303,12 +1303,6 @@ rtree_redo(XLogRecPtr lsn, XLogRecord *record)
        elog(PANIC, "rtree_redo: unimplemented");
 }
 
-void
-rtree_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-       elog(PANIC, "rtree_undo: unimplemented");
-}
-
 void
 rtree_desc(char *buf, uint8 xl_info, char *rec)
 {
index 9e572b43619b281fbca8f290637fe47fce31878e..73362330c104447e79588c33cca6c62d53805860 100644 (file)
@@ -24,7 +24,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.28 2004/12/31 21:59:29 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.29 2005/06/06 17:01:22 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -411,11 +411,6 @@ clog_redo(XLogRecPtr lsn, XLogRecord *record)
        }
 }
 
-void
-clog_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-}
-
 void
 clog_desc(char *buf, uint8 xl_info, char *rec)
 {
index 93e5c3eba7ce9c77e997fc6766cd4fb5cb0b8a96..39d647f8a6f663f57a010f993a3545ccbb91a502 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Resource managers definition
  *
- * $PostgreSQL: pgsql/src/backend/access/transam/rmgr.c,v 1.17 2005/05/17 03:34:18 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/rmgr.c,v 1.18 2005/06/06 17:01:22 tgl Exp $
  */
 #include "postgres.h"
 
 
 
 const RmgrData RmgrTable[RM_MAX_ID + 1] = {
-       {"XLOG", xlog_redo, xlog_undo, xlog_desc, NULL, NULL},
-       {"Transaction", xact_redo, xact_undo, xact_desc, NULL, NULL},
-       {"Storage", smgr_redo, smgr_undo, smgr_desc, NULL, NULL},
-       {"CLOG", clog_redo, clog_undo, clog_desc, NULL, NULL},
-       {"Database", dbase_redo, dbase_undo, dbase_desc, NULL, NULL},
-       {"Tablespace", tblspc_redo, tblspc_undo, tblspc_desc, NULL, NULL},
-       {"Reserved 6", NULL, NULL, NULL, NULL, NULL},
-       {"Reserved 7", NULL, NULL, NULL, NULL, NULL},
-       {"Reserved 8", NULL, NULL, NULL, NULL, NULL},
-       {"Reserved 9", NULL, NULL, NULL, NULL, NULL},
-       {"Heap", heap_redo, heap_undo, heap_desc, NULL, NULL},
-       {"Btree", btree_redo, btree_undo, btree_desc,
-       btree_xlog_startup, btree_xlog_cleanup},
-       {"Hash", hash_redo, hash_undo, hash_desc, NULL, NULL},
-       {"Rtree", rtree_redo, rtree_undo, rtree_desc, NULL, NULL},
-       {"Gist", gist_redo, gist_undo, gist_desc, NULL, NULL},
-       {"Sequence", seq_redo, seq_undo, seq_desc, NULL, NULL}
+       {"XLOG", xlog_redo, xlog_desc, NULL, NULL},
+       {"Transaction", xact_redo, xact_desc, NULL, NULL},
+       {"Storage", smgr_redo, smgr_desc, NULL, NULL},
+       {"CLOG", clog_redo, clog_desc, NULL, NULL},
+       {"Database", dbase_redo, dbase_desc, NULL, NULL},
+       {"Tablespace", tblspc_redo, tblspc_desc, NULL, NULL},
+       {"Reserved 6", NULL, NULL, NULL, NULL},
+       {"Reserved 7", NULL, NULL, NULL, NULL},
+       {"Reserved 8", NULL, NULL, NULL, NULL},
+       {"Reserved 9", NULL, NULL, NULL, NULL},
+       {"Heap", heap_redo, heap_desc, NULL, NULL},
+       {"Btree", btree_redo, btree_desc, btree_xlog_startup, btree_xlog_cleanup},
+       {"Hash", hash_redo, hash_desc, NULL, NULL},
+       {"Rtree", rtree_redo, rtree_desc, NULL, NULL},
+       {"Gist", gist_redo, gist_desc, NULL, NULL},
+       {"Sequence", seq_redo, seq_desc, NULL, NULL}
 };
index 894404903f5c7842e8807e2e36d0f6104c5e6b1c..3eb58a96a8d5e73f86efdd360391e49190f5cbf5 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.202 2005/05/19 23:58:51 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.203 2005/06/06 17:01:22 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -3844,17 +3844,6 @@ xact_redo(XLogRecPtr lsn, XLogRecord *record)
                elog(PANIC, "xact_redo: unknown op code %u", info);
 }
 
-void
-xact_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-       uint8           info = record->xl_info & ~XLR_INFO_MASK;
-
-       if (info == XLOG_XACT_COMMIT)           /* shouldn't be called by XLOG */
-               elog(PANIC, "xact_undo: can't undo committed xaction");
-       else if (info != XLOG_XACT_ABORT)
-               elog(PANIC, "xact_redo: unknown op code %u", info);
-}
-
 void
 xact_desc(char *buf, uint8 xl_info, char *rec)
 {
index 27f6354987d71b1ac6bab8a957dd9d2262a1bbfa..c1609356d39c3c66b8765d396de16471e5de120a 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.195 2005/06/02 05:55:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.196 2005/06/06 17:01:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -2372,7 +2372,7 @@ RestoreBkpBlocks(XLogRecord *record, XLogRecPtr lsn)
                memcpy(&bkpb, blk, sizeof(BkpBlock));
                blk += sizeof(BkpBlock);
 
-               reln = XLogOpenRelation(true, record->xl_rmid, bkpb.node);
+               reln = XLogOpenRelation(bkpb.node);
 
                if (reln)
                {
@@ -5308,11 +5308,6 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
        }
 }
 
-void
-xlog_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-}
-
 void
 xlog_desc(char *buf, uint8 xl_info, char *rec)
 {
index 72833a755f78206ed5f3e59b4f946df620eec4ee..55caf84a04da7dbb6f2a9d72220276759cf8d9a7 100644 (file)
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.37 2005/05/29 04:23:03 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.38 2005/06/06 17:01:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -186,7 +186,7 @@ XLogCloseRelationCache(void)
  * Open a relation during XLOG replay
  */
 Relation
-XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode)
+XLogOpenRelation(RelFileNode rnode)
 {
        XLogRelDesc *res;
        XLogRelCacheEntry *hentry;
index 22a9afd07680a58968f5cdd8a69976f52c322dbb..370977c6586716cdd36719d97e4840547ec63a1d 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.157 2005/05/19 21:35:45 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.158 2005/06/06 17:01:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1334,12 +1334,6 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record)
                elog(PANIC, "dbase_redo: unknown op code %u", info);
 }
 
-void
-dbase_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-       elog(PANIC, "dbase_undo: unimplemented");
-}
-
 void
 dbase_desc(char *buf, uint8 xl_info, char *rec)
 {
index 69e8cd039edd9faee158fe3e8607c32e0ece5ebe..3278be1239f74cbabbb67ccf8147d9935a66bae2 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.120 2005/05/27 00:57:49 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.121 2005/06/06 17:01:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1077,7 +1077,7 @@ seq_redo(XLogRecPtr lsn, XLogRecord *record)
        if (info != XLOG_SEQ_LOG)
                elog(PANIC, "seq_redo: unknown op code %u", info);
 
-       reln = XLogOpenRelation(true, RM_SEQ_ID, xlrec->node);
+       reln = XLogOpenRelation(xlrec->node);
        if (!RelationIsValid(reln))
                return;
 
@@ -1107,11 +1107,6 @@ seq_redo(XLogRecPtr lsn, XLogRecord *record)
        WriteBuffer(buffer);
 }
 
-void
-seq_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-}
-
 void
 seq_desc(char *buf, uint8 xl_info, char *rec)
 {
index bf62aec5282703e8cdc7ccfc38bc42b8de89f6d7..f9041a0a6439d41fed872552e3fc6dbf93aedede 100644 (file)
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.19 2005/05/10 22:27:29 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.20 2005/06/06 17:01:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1064,12 +1064,6 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record)
                elog(PANIC, "tblspc_redo: unknown op code %u", info);
 }
 
-void
-tblspc_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-       elog(PANIC, "tblspc_undo: unimplemented");
-}
-
 void
 tblspc_desc(char *buf, uint8 xl_info, char *rec)
 {
index 0b5a7154d3f3f572ccc7384997692745729e1a8b..ca171a3b1a2702995a37e9603e210f87c44c9040 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.87 2005/05/29 04:23:05 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.88 2005/06/06 17:01:24 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -908,13 +908,6 @@ smgr_redo(XLogRecPtr lsn, XLogRecord *record)
                elog(PANIC, "smgr_redo: unknown op code %u", info);
 }
 
-void
-smgr_undo(XLogRecPtr lsn, XLogRecord *record)
-{
-       /* Since we have no transactional WAL entries, should never undo */
-       elog(PANIC, "smgr_undo: cannot undo");
-}
-
 void
 smgr_desc(char *buf, uint8 xl_info, char *rec)
 {
index e58c1102c253e4104908e0f238510a416a4e7444..49495abfdd6920d519a1f85607d1a3677bc8e613 100644 (file)
@@ -22,7 +22,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.6 2005/04/14 20:03:26 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.7 2005/06/06 17:01:24 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -645,7 +645,7 @@ BuildFlatFiles(bool database_only)
        rnode.relNode = DatabaseRelationId;
 
        /* No locking is needed because no one else is alive yet */
-       rel = XLogOpenRelation(true, 0, rnode);
+       rel = XLogOpenRelation(rnode);
        write_database_file(rel);
 
        if (!database_only)
@@ -655,7 +655,7 @@ BuildFlatFiles(bool database_only)
                rnode.dbNode = 0;
                rnode.relNode = GroupRelationId;
 
-               rel = XLogOpenRelation(true, 0, rnode);
+               rel = XLogOpenRelation(rnode);
                write_group_file(rel);
 
                /* hard-wired path to pg_shadow */
@@ -663,7 +663,7 @@ BuildFlatFiles(bool database_only)
                rnode.dbNode = 0;
                rnode.relNode = ShadowRelationId;
 
-               rel = XLogOpenRelation(true, 0, rnode);
+               rel = XLogOpenRelation(rnode);
                write_user_file(rel);
        }
 
index c8f2ccaa28aa48f05c1819ac64fe262e7d04fdc0..d03c5904f212e94c6fc8d7840e44bdd82e1ed1bd 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/access/clog.h,v 1.12 2004/12/31 22:03:21 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/access/clog.h,v 1.13 2005/06/06 17:01:24 tgl Exp $
  */
 #ifndef CLOG_H
 #define CLOG_H
@@ -44,7 +44,6 @@ extern void TruncateCLOG(TransactionId oldestXact);
 #define CLOG_ZEROPAGE          0x00
 
 extern void clog_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void clog_undo(XLogRecPtr lsn, XLogRecord *record);
 extern void clog_desc(char *buf, uint8 xl_info, char *rec);
 
 #endif   /* CLOG_H */
index a34e29d0e05f8c42510fcd1c38de5db69a5e9700..db255a7b6f548f60670996352e3869cf07d8c6eb 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.1 2005/05/17 03:34:18 neilc Exp $
+ * $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.2 2005/06/06 17:01:24 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -99,8 +99,8 @@ extern void freeGISTstate(GISTSTATE *giststate);
 extern void gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
                           Datum k, Relation r, Page pg, OffsetNumber o,
                           int b, bool l, bool isNull);
+
 extern void gist_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void gist_undo(XLogRecPtr lsn, XLogRecord *record);
 extern void gist_desc(char *buf, uint8 xl_info, char *rec);
 
 /* gistget.c */
index e6ad35300ba53182e81119b5f15dd7f8ec120efa..1e40232b519e441e75db459ec4623bcbf4b00003 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/access/hash.h,v 1.61 2005/03/27 23:53:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/hash.h,v 1.62 2005/06/06 17:01:24 tgl Exp $
  *
  * NOTES
  *             modeled after Margo Seltzer's hash implementation for unix.
@@ -314,7 +314,6 @@ extern void _hash_checkpage(Relation rel, Page page, int flags);
 
 /* hash.c */
 extern void hash_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void hash_undo(XLogRecPtr lsn, XLogRecord *record);
 extern void hash_desc(char *buf, uint8 xl_info, char *rec);
 
 #endif   /* HASH_H */
index 9138186ba63c71ec827d85f2eaa0730204f36dac..151a62f9b68b02f9c67878a3c9f68b8561ba257e 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.100 2005/04/28 21:47:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.101 2005/06/06 17:01:24 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -173,7 +173,6 @@ extern void heap_markpos(HeapScanDesc scan);
 extern void heap_restrpos(HeapScanDesc scan);
 
 extern void heap_redo(XLogRecPtr lsn, XLogRecord *rptr);
-extern void heap_undo(XLogRecPtr lsn, XLogRecord *rptr);
 extern void heap_desc(char *buf, uint8 xl_info, char *rec);
 extern XLogRecPtr log_heap_clean(Relation reln, Buffer buffer,
                           OffsetNumber *unused, int uncnt);
index d1c0df6b32f48ae8ee2b104e76e2ba41751393e8..f522cd2799eed5a7c34fe3139562e9bac57fa49e 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.85 2005/03/27 23:53:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.86 2005/06/06 17:01:24 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -485,7 +485,6 @@ extern void _bt_leafbuild(BTSpool *btspool, BTSpool *spool2);
  * prototypes for functions in nbtxlog.c
  */
 extern void btree_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void btree_undo(XLogRecPtr lsn, XLogRecord *record);
 extern void btree_desc(char *buf, uint8 xl_info, char *rec);
 extern void btree_xlog_startup(void);
 extern void btree_xlog_cleanup(void);
index b01f80588731ebfd618e03476df1e3bea1bdd645..17ef0d7866d4cc99e0a21b85b4e3c9d2a15ae173 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Resource managers definition
  *
- * $PostgreSQL: pgsql/src/include/access/rmgr.h,v 1.13 2004/08/29 21:08:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/rmgr.h,v 1.14 2005/06/06 17:01:24 tgl Exp $
  */
 #ifndef RMGR_H
 #define RMGR_H
@@ -19,6 +19,7 @@ typedef uint8 RmgrId;
 #define RM_CLOG_ID                             3
 #define RM_DBASE_ID                            4
 #define RM_TBLSPC_ID                   5
+#define RM_MULTIXACT_ID                        6
 #define RM_HEAP_ID                             10
 #define RM_BTREE_ID                            11
 #define RM_HASH_ID                             12
index c057160a79028823b6f86254b4eb8dc438daeaaf..14a13f4b3a4148f0463325881178777f7f76c9fa 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/access/rtree.h,v 1.38 2005/03/27 23:53:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/rtree.h,v 1.39 2005/06/06 17:01:24 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -127,7 +127,6 @@ extern Datum rtbuild(PG_FUNCTION_ARGS);
 extern void _rtdump(Relation r);
 
 extern void rtree_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void rtree_undo(XLogRecPtr lsn, XLogRecord *record);
 extern void rtree_desc(char *buf, uint8 xl_info, char *rec);
 
 /* rtscan.c */
index 0d3a6383426a0809a7b9dc1300ec65cfef13cebe..7c949899ac4cc7b456c87b5132b9c45fda004dae 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.75 2005/03/28 01:50:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.76 2005/06/06 17:01:24 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -146,7 +146,6 @@ extern void RecordTransactionCommit(void);
 extern int     xactGetCommittedChildren(TransactionId **ptr);
 
 extern void xact_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void xact_undo(XLogRecPtr lsn, XLogRecord *record);
 extern void xact_desc(char *buf, uint8 xl_info, char *rec);
 
 #endif   /* XACT_H */
index 1d1aa9c15268abd1dd0470922989515769ced4f3..554c3c3aec7434362b377a032db564e164f9bca8 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.62 2005/06/02 05:55:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.63 2005/06/06 17:01:24 tgl Exp $
  */
 #ifndef XLOG_H
 #define XLOG_H
@@ -135,7 +135,6 @@ extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info, XLogRecData *rdata);
 extern void XLogFlush(XLogRecPtr RecPtr);
 
 extern void xlog_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void xlog_undo(XLogRecPtr lsn, XLogRecord *record);
 extern void xlog_desc(char *buf, uint8 xl_info, char *rec);
 
 extern void UpdateControlFile(void);
index a0b0b761ccb2f2162138c45628c1f144b6c4dfd0..76e20b0355fe6986a128f292f09125854428e69d 100644 (file)
@@ -5,13 +5,13 @@
  *
  * NOTE: this file is intended to contain declarations useful for
  * manipulating the XLOG files directly, but it is not supposed to be
- * needed by rmgr routines (redo/undo support for individual record types).
+ * needed by rmgr routines (redo support for individual record types).
  * So the XLogRecord typedef and associated stuff appear in xlog.h.
  *
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.7 2005/06/02 05:55:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.8 2005/06/06 17:01:25 tgl Exp $
  */
 #ifndef XLOG_INTERNAL_H
 #define XLOG_INTERNAL_H
@@ -224,7 +224,6 @@ typedef struct RmgrData
 {
        const char *rm_name;
        void            (*rm_redo) (XLogRecPtr lsn, XLogRecord *rptr);
-       void            (*rm_undo) (XLogRecPtr lsn, XLogRecord *rptr);
        void            (*rm_desc) (char *buf, uint8 xl_info, char *rec);
        void            (*rm_startup) (void);
        void            (*rm_cleanup) (void);
index b0d6efa559337a731309d6742fec3d041cb0c096..a4ac26dc404c1c7805aebc3810287ea7e2760de7 100644 (file)
@@ -6,12 +6,11 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/access/xlogutils.h,v 1.17 2004/12/31 22:03:21 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/access/xlogutils.h,v 1.18 2005/06/06 17:01:25 tgl Exp $
  */
 #ifndef XLOG_UTILS_H
 #define XLOG_UTILS_H
 
-#include "access/rmgr.h"
 #include "storage/buf.h"
 #include "utils/rel.h"
 
@@ -19,7 +18,7 @@
 extern void XLogInitRelationCache(void);
 extern void XLogCloseRelationCache(void);
 
-extern Relation XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode);
+extern Relation XLogOpenRelation(RelFileNode rnode);
 extern void XLogCloseRelation(RelFileNode rnode);
 
 extern Buffer XLogReadBuffer(bool extend, Relation reln, BlockNumber blkno);
index 8bdbd860c4ed5f3a67816e00f7cbefe99dd51b91..7ffd7abeb0305fada248c51b711b90c18d48a533 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.37 2005/03/23 00:03:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.38 2005/06/06 17:01:25 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -71,7 +71,6 @@ extern Oid    get_database_oid(const char *dbname);
 extern char *get_database_name(Oid dbid);
 
 extern void dbase_redo(XLogRecPtr lsn, XLogRecord *rptr);
-extern void dbase_undo(XLogRecPtr lsn, XLogRecord *rptr);
 extern void dbase_desc(char *buf, uint8 xl_info, char *rec);
 
 #endif   /* DBCOMMANDS_H */
index df21ef44ec9c1316faed2c68029949fe734db404..48017538869b239dcc7af1e1f1d3a720979b91e7 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/commands/sequence.h,v 1.30 2004/12/31 22:03:28 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/commands/sequence.h,v 1.31 2005/06/06 17:01:25 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -89,7 +89,6 @@ extern void DefineSequence(CreateSeqStmt *stmt);
 extern void AlterSequence(AlterSeqStmt *stmt);
 
 extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr);
-extern void seq_undo(XLogRecPtr lsn, XLogRecord *rptr);
 extern void seq_desc(char *buf, uint8 xl_info, char *rec);
 
 /* Set the upper and lower bounds of a sequence */
index a6debc4f097221d256bf1a2fc2ba8edf136786db..fe99a191a3390c74fc873bbb137e4a7757115c34 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.8 2004/12/31 22:03:28 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.9 2005/06/06 17:01:25 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -48,7 +48,6 @@ extern char *get_tablespace_name(Oid spc_oid);
 extern bool directory_is_empty(const char *path);
 
 extern void tblspc_redo(XLogRecPtr lsn, XLogRecord *rptr);
-extern void tblspc_undo(XLogRecPtr lsn, XLogRecord *rptr);
 extern void tblspc_desc(char *buf, uint8 xl_info, char *rec);
 
 #endif   /* TABLESPACE_H */
index e10aa6a8d17849ed795097016390636fe57918d5..f00a8aeb83310640b4670c4a4b6636bf7c855303 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.50 2005/01/10 20:02:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.51 2005/06/06 17:01:25 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -84,7 +84,6 @@ extern void smgrabort(void);
 extern void smgrsync(void);
 
 extern void smgr_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void smgr_undo(XLogRecPtr lsn, XLogRecord *record);
 extern void smgr_desc(char *buf, uint8 xl_info, char *rec);