From d0273c07ac50ad78960f3a582cc17188c31a90d7 Mon Sep 17 00:00:00 2001 From: "Vadim B. Mikheev" Date: Tue, 4 Jul 2000 01:49:44 +0000 Subject: [PATCH] misc --- src/backend/access/transam/xlog.c | 4 ++-- src/include/access/htup.h | 10 +++++++++- src/include/access/rmgr.h | 15 ++++++++------- src/include/access/xlog.h | 6 +++++- src/include/storage/itemptr.h | 5 ++++- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 1eaa166995..f04b9cae2e 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.16 2000/06/02 15:57:16 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.17 2000/07/04 01:49:43 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -1402,7 +1402,7 @@ StartupXLOG() record = ReadRecord(&RecPtr, buffer); if (TransactionIdIsValid(record->xl_xid) && !TransactionIdDidCommit(record->xl_xid)) - RmgrTable[record->xl_rmid].rm_undo(record); + RmgrTable[record->xl_rmid].rm_undo(EndRecPtr, record); RecPtr = record->xl_prev; } while (XLByteLE(checkPoint.undo, RecPtr)); elog(LOG, "Undo done at (%u, %u)", diff --git a/src/include/access/htup.h b/src/include/access/htup.h index 4665fe60bb..cf8f9dddcb 100644 --- a/src/include/access/htup.h +++ b/src/include/access/htup.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: htup.h,v 1.32 2000/07/03 02:54:17 vadim Exp $ + * $Id: htup.h,v 1.33 2000/07/04 01:49:43 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -87,6 +87,8 @@ typedef struct xl_heap_delete xl_heaptid dtid; /* deleted tuple id */ } xl_heap_delete; +#define SizeOfHeapDelete (offsetof(xl_heaptid, tid) + SizeOfIptrData)) + /* This is what we need to know about insert - 26 + data */ typedef struct xl_heap_insert { @@ -99,6 +101,8 @@ typedef struct xl_heap_insert /* TUPLE DATA FOLLOWS AT END OF STRUCT */ } xl_heap_insert; +#define SizeOfHeapInsert (offsetof(xl_heap_insert, mask) + sizeof(uint8)) + /* This is what we need to know about update - 28 + data */ typedef struct xl_heap_update { @@ -111,6 +115,8 @@ typedef struct xl_heap_update /* NEW TUPLE DATA FOLLOWS AT END OF STRUCT */ } xl_heap_update; +#define SizeOfHeapUpdate (offsetof(xl_heap_update, mask) + sizeof(uint8)) + /* This is what we need to know about tuple move - 24 bytes */ typedef struct xl_heap_move { @@ -118,6 +124,8 @@ typedef struct xl_heap_move ItemPointerData ttid; /* moved to */ } xl_heap_move; +#define SizeOfHeapMove (offsetof(xl_heap_move, ttid) + SizeOfIptrData)) + /* end of XLOG stuff */ #endif /* XLOG */ diff --git a/src/include/access/rmgr.h b/src/include/access/rmgr.h index b279698594..1980b31a3f 100644 --- a/src/include/access/rmgr.h +++ b/src/include/access/rmgr.h @@ -13,8 +13,8 @@ typedef uint8 RmgrId; typedef struct RmgrData { char *rm_name; - char *(*rm_redo) (); /* REDO(XLogRecPtr rptr) */ - char *(*rm_undo) (); /* UNDO(XLogRecPtr rptr) */ + void (*rm_redo)(); /* REDO(XLogRecPtr lsn, XLogRecord rptr) */ + void (*rm_undo)(); /* UNDO(XLogRecPtr lsn, XLogRecord rptr) */ } RmgrData; extern RmgrData *RmgrTable; @@ -24,11 +24,12 @@ extern RmgrData *RmgrTable; */ #define RM_XLOG_ID 0 #define RM_XACT_ID 1 -#define RM_HEAP_ID 2 -#define RM_BTREE_ID 3 -#define RM_HASH_ID 4 -#define RM_RTREE_ID 5 -#define RM_GIST_ID 6 +#define RM_SMGR_ID 2 +#define RM_HEAP_ID 10 +#define RM_BTREE_ID 11 +#define RM_HASH_ID 12 +#define RM_RTREE_ID 13 +#define RM_GIST_ID 14 #define RM_MAX_ID RM_GIST_ID #endif /* RMGR_H */ diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index b86339f072..69bf148777 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -22,7 +22,7 @@ typedef struct XLogRecord XLogRecPtr xl_prev; /* ptr to previous record in log */ XLogRecPtr xl_xact_prev; /* ptr to previous record of this xact */ TransactionId xl_xid; /* xact id */ - uint16 xl_len; /* len of record on this page */ + uint16 xl_len; /* len of record *data* on this page */ uint8 xl_info; RmgrId xl_rmid; /* resource manager inserted this record */ @@ -32,6 +32,10 @@ typedef struct XLogRecord #define SizeOfXLogRecord DOUBLEALIGN(sizeof(XLogRecord)) #define MAXLOGRECSZ (2 * BLCKSZ) + +#define XLogRecGetData(record) \ + ((char*)record + SizeOfXLogRecord) + /* * When there is no space on current page we continue on the next * page with subrecord. diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h index 5d019b759c..0d21087533 100644 --- a/src/include/storage/itemptr.h +++ b/src/include/storage/itemptr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: itemptr.h,v 1.14 2000/01/26 05:58:33 momjian Exp $ + * $Id: itemptr.h,v 1.15 2000/07/04 01:49:44 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -30,6 +30,9 @@ typedef struct ItemPointerData OffsetNumber ip_posid; } ItemPointerData; +#define SizeOfIptrData \ + (offsetof(ItemPointerData, ip_posid) + sizeof(OffsetNumber)) + typedef ItemPointerData *ItemPointer; /* ----------------