diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-03-24 04:32:13 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-03-24 04:32:13 +0000 |
commit | 0a202070603bf38ce2e2fc11a7f897fc06603b80 (patch) | |
tree | a856ccc9da2bf3ec6ec57da03788e27e89c22428 /src/include | |
parent | 4fb92718be654b38652dfe893d075f3862e84eae (diff) | |
download | postgresql-0a202070603bf38ce2e2fc11a7f897fc06603b80.tar.gz postgresql-0a202070603bf38ce2e2fc11a7f897fc06603b80.zip |
Arrange to emit a description of the current XLOG record as error context
when an error occurs during xlog replay. Also, replace the former risky
'write into a fixed-size buffer with no overflow detection' API for XLOG
record description routines; use an expansible StringInfo instead. (The
latter accounts for most of the patch bulk.)
Qingqing Zhou
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/access/clog.h | 4 | ||||
-rw-r--r-- | src/include/access/gist_private.h | 4 | ||||
-rw-r--r-- | src/include/access/hash.h | 4 | ||||
-rw-r--r-- | src/include/access/heapam.h | 4 | ||||
-rw-r--r-- | src/include/access/multixact.h | 4 | ||||
-rw-r--r-- | src/include/access/nbtree.h | 4 | ||||
-rw-r--r-- | src/include/access/xact.h | 4 | ||||
-rw-r--r-- | src/include/access/xlog.h | 5 | ||||
-rw-r--r-- | src/include/access/xlog_internal.h | 4 | ||||
-rw-r--r-- | src/include/commands/dbcommands.h | 4 | ||||
-rw-r--r-- | src/include/commands/sequence.h | 4 | ||||
-rw-r--r-- | src/include/commands/tablespace.h | 4 | ||||
-rw-r--r-- | src/include/storage/smgr.h | 4 |
13 files changed, 27 insertions, 26 deletions
diff --git a/src/include/access/clog.h b/src/include/access/clog.h index e621be58a4c..999f15bdf7f 100644 --- a/src/include/access/clog.h +++ b/src/include/access/clog.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/clog.h,v 1.16 2006/03/05 15:58:53 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/clog.h,v 1.17 2006/03/24 04:32:13 tgl Exp $ */ #ifndef CLOG_H #define CLOG_H @@ -48,6 +48,6 @@ extern void TruncateCLOG(TransactionId oldestXact); #define CLOG_ZEROPAGE 0x00 extern void clog_redo(XLogRecPtr lsn, XLogRecord *record); -extern void clog_desc(char *buf, uint8 xl_info, char *rec); +extern void clog_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* CLOG_H */ diff --git a/src/include/access/gist_private.h b/src/include/access/gist_private.h index fd044b16b10..3b072da6376 100644 --- a/src/include/access/gist_private.h +++ b/src/include/access/gist_private.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.10 2006/03/05 15:58:53 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.11 2006/03/24 04:32:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -244,7 +244,7 @@ extern GISTInsertStack *gistFindPath(Relation r, BlockNumber child, /* gistxlog.c */ extern void gist_redo(XLogRecPtr lsn, XLogRecord *record); -extern void gist_desc(char *buf, uint8 xl_info, char *rec); +extern void gist_desc(StringInfo buf, uint8 xl_info, char *rec); extern void gist_xlog_startup(void); extern void gist_xlog_cleanup(void); extern IndexTuple gist_form_invalid_tuple(BlockNumber blkno); diff --git a/src/include/access/hash.h b/src/include/access/hash.h index c6798dc0781..0d34b29cfaf 100644 --- a/src/include/access/hash.h +++ b/src/include/access/hash.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/hash.h,v 1.66 2006/03/05 15:58:53 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/hash.h,v 1.67 2006/03/24 04:32:13 tgl Exp $ * * NOTES * modeled after Margo Seltzer's hash implementation for unix. @@ -306,6 +306,6 @@ extern void _hash_checkpage(Relation rel, Buffer buf, int flags); /* hash.c */ extern void hash_redo(XLogRecPtr lsn, XLogRecord *record); -extern void hash_desc(char *buf, uint8 xl_info, char *rec); +extern void hash_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* HASH_H */ diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index e834928245d..cfa23c0f27a 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.106 2006/03/05 15:58:53 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.107 2006/03/24 04:32:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -178,7 +178,7 @@ extern void heap_markpos(HeapScanDesc scan); extern void heap_restrpos(HeapScanDesc scan); extern void heap_redo(XLogRecPtr lsn, XLogRecord *rptr); -extern void heap_desc(char *buf, uint8 xl_info, char *rec); +extern void heap_desc(StringInfo buf, uint8 xl_info, char *rec); extern XLogRecPtr log_heap_clean(Relation reln, Buffer buffer, OffsetNumber *unused, int uncnt); extern XLogRecPtr log_heap_move(Relation reln, Buffer oldbuf, diff --git a/src/include/access/multixact.h b/src/include/access/multixact.h index 82a08a979e3..b98c5fd80bf 100644 --- a/src/include/access/multixact.h +++ b/src/include/access/multixact.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/multixact.h,v 1.9 2006/03/05 15:58:53 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/multixact.h,v 1.10 2006/03/24 04:32:13 tgl Exp $ */ #ifndef MULTIXACT_H #define MULTIXACT_H @@ -67,6 +67,6 @@ extern void MultiXactAdvanceNextMXact(MultiXactId minMulti, MultiXactOffset minMultiOffset); extern void multixact_redo(XLogRecPtr lsn, XLogRecord *record); -extern void multixact_desc(char *buf, uint8 xl_info, char *rec); +extern void multixact_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* MULTIXACT_H */ diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index 5a5e5d047eb..113134d5774 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.92 2006/03/05 15:58:53 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.93 2006/03/24 04:32:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -470,7 +470,7 @@ 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_desc(char *buf, uint8 xl_info, char *rec); +extern void btree_desc(StringInfo buf, uint8 xl_info, char *rec); extern void btree_xlog_startup(void); extern void btree_xlog_cleanup(void); diff --git a/src/include/access/xact.h b/src/include/access/xact.h index 3b618f320d4..da2455f68fd 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.80 2006/03/05 15:58:54 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.81 2006/03/24 04:32:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -175,6 +175,6 @@ extern void RecordTransactionCommit(void); extern int xactGetCommittedChildren(TransactionId **ptr); extern void xact_redo(XLogRecPtr lsn, XLogRecord *record); -extern void xact_desc(char *buf, uint8 xl_info, char *rec); +extern void xact_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* XACT_H */ diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index d0d9c503c96..bd1699f5abe 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.70 2006/03/05 15:58:54 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.71 2006/03/24 04:32:13 tgl Exp $ */ #ifndef XLOG_H #define XLOG_H @@ -14,6 +14,7 @@ #include "access/rmgr.h" #include "access/transam.h" #include "access/xlogdefs.h" +#include "lib/stringinfo.h" #include "storage/buf.h" #include "utils/pg_crc.h" @@ -152,7 +153,7 @@ 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_desc(char *buf, uint8 xl_info, char *rec); +extern void xlog_desc(StringInfo buf, uint8 xl_info, char *rec); extern void UpdateControlFile(void); extern Size XLOGShmemSize(void); diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h index f148f0e563e..9bf46c28319 100644 --- a/src/include/access/xlog_internal.h +++ b/src/include/access/xlog_internal.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.10 2006/03/05 15:58:54 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.11 2006/03/24 04:32:13 tgl Exp $ */ #ifndef XLOG_INTERNAL_H #define XLOG_INTERNAL_H @@ -228,7 +228,7 @@ typedef struct RmgrData { const char *rm_name; void (*rm_redo) (XLogRecPtr lsn, XLogRecord *rptr); - void (*rm_desc) (char *buf, uint8 xl_info, char *rec); + void (*rm_desc) (StringInfo buf, uint8 xl_info, char *rec); void (*rm_startup) (void); void (*rm_cleanup) (void); } RmgrData; diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h index 470ef024bd7..2c9852bd0cb 100644 --- a/src/include/commands/dbcommands.h +++ b/src/include/commands/dbcommands.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.44 2006/03/05 15:58:55 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.45 2006/03/24 04:32:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -63,6 +63,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_desc(char *buf, uint8 xl_info, char *rec); +extern void dbase_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* DBCOMMANDS_H */ diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h index b4987884d29..f334d6ba831 100644 --- a/src/include/commands/sequence.h +++ b/src/include/commands/sequence.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/sequence.h,v 1.35 2006/03/05 15:58:55 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/sequence.h,v 1.36 2006/03/24 04:32:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -91,7 +91,7 @@ extern void DefineSequence(CreateSeqStmt *stmt); extern void AlterSequence(AlterSeqStmt *stmt); extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr); -extern void seq_desc(char *buf, uint8 xl_info, char *rec); +extern void seq_desc(StringInfo buf, uint8 xl_info, char *rec); /* Set the upper and lower bounds of a sequence */ #ifndef INT64_IS_BUSTED diff --git a/src/include/commands/tablespace.h b/src/include/commands/tablespace.h index 5439905860a..650b21023d4 100644 --- a/src/include/commands/tablespace.h +++ b/src/include/commands/tablespace.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.12 2006/03/05 15:58:55 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.13 2006/03/24 04:32:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -48,6 +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_desc(char *buf, uint8 xl_info, char *rec); +extern void tblspc_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* TABLESPACE_H */ diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h index 8edce2a85e3..b768a5b5304 100644 --- a/src/include/storage/smgr.h +++ b/src/include/storage/smgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.54 2006/03/05 15:59:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.55 2006/03/24 04:32:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -85,7 +85,7 @@ extern void smgrabort(void); extern void smgrsync(void); extern void smgr_redo(XLogRecPtr lsn, XLogRecord *record); -extern void smgr_desc(char *buf, uint8 xl_info, char *rec); +extern void smgr_desc(StringInfo buf, uint8 xl_info, char *rec); /* internals: move me elsewhere -- ay 7/94 */ |