Just feels more natural, and is more consistent with rm_redo.
!!(XLR_BKP_BLOCK(3) & record->xl_info));
/* the desc routine will printf the description directly to stdout */
- desc->rm_desc(NULL, record->xl_info, XLogRecGetData(record));
+ desc->rm_desc(NULL, record);
putchar('\n');
typedef struct RmgrDescData
{
const char *rm_name;
- void (*rm_desc) (StringInfo buf, uint8 xl_info, char *rec);
+ void (*rm_desc) (StringInfo buf, XLogRecord *record);
} RmgrDescData;
extern const RmgrDescData RmgrDescTable[];
void
-clog_desc(StringInfo buf, uint8 xl_info, char *rec)
+clog_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
if (info == CLOG_ZEROPAGE)
{
void
-dbase_desc(StringInfo buf, uint8 xl_info, char *rec)
+dbase_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
if (info == XLOG_DBASE_CREATE)
{
}
void
-gin_desc(StringInfo buf, uint8 xl_info, char *rec)
+gin_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
switch (info)
{
ginxlogRecompressDataLeaf *insertData =
(ginxlogRecompressDataLeaf *) payload;
- if (xl_info & XLR_BKP_BLOCK(0))
+ if (record->xl_info & XLR_BKP_BLOCK(0))
appendStringInfo(buf, " (full page image)");
else
desc_recompress_leaf(buf, insertData);
appendStringInfoString(buf, "Vacuum data leaf page, ");
desc_node(buf, xlrec->node, xlrec->blkno);
- if (xl_info & XLR_BKP_BLOCK(0))
+ if (record->xl_info & XLR_BKP_BLOCK(0))
appendStringInfo(buf, " (full page image)");
else
desc_recompress_leaf(buf, &xlrec->data);
}
void
-gist_desc(StringInfo buf, uint8 xl_info, char *rec)
+gist_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
switch (info)
{
#include "access/hash.h"
void
-hash_desc(StringInfo buf, uint8 xl_info, char *rec)
+hash_desc(StringInfo buf, XLogRecord *record)
{
}
}
void
-heap_desc(StringInfo buf, uint8 xl_info, char *rec)
+heap_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
info &= XLOG_HEAP_OPMASK;
if (info == XLOG_HEAP_INSERT)
{
xl_heap_insert *xlrec = (xl_heap_insert *) rec;
- if (xl_info & XLOG_HEAP_INIT_PAGE)
+ if (record->xl_info & XLOG_HEAP_INIT_PAGE)
appendStringInfoString(buf, "insert(init): ");
else
appendStringInfoString(buf, "insert: ");
{
xl_heap_update *xlrec = (xl_heap_update *) rec;
- if (xl_info & XLOG_HEAP_INIT_PAGE)
+ if (record->xl_info & XLOG_HEAP_INIT_PAGE)
appendStringInfoString(buf, "update(init): ");
else
appendStringInfoString(buf, "update: ");
{
xl_heap_update *xlrec = (xl_heap_update *) rec;
- if (xl_info & XLOG_HEAP_INIT_PAGE) /* can this case happen? */
+ if (record->xl_info & XLOG_HEAP_INIT_PAGE) /* can this case happen? */
appendStringInfoString(buf, "hot_update(init): ");
else
appendStringInfoString(buf, "hot_update: ");
appendStringInfoString(buf, "UNKNOWN");
}
void
-heap2_desc(StringInfo buf, uint8 xl_info, char *rec)
+heap2_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
info &= XLOG_HEAP_OPMASK;
if (info == XLOG_HEAP2_CLEAN)
{
xl_heap_multi_insert *xlrec = (xl_heap_multi_insert *) rec;
- if (xl_info & XLOG_HEAP_INIT_PAGE)
+ if (record->xl_info & XLOG_HEAP_INIT_PAGE)
appendStringInfoString(buf, "multi-insert (init): ");
else
appendStringInfoString(buf, "multi-insert: ");
}
void
-multixact_desc(StringInfo buf, uint8 xl_info, char *rec)
+multixact_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
if (info == XLOG_MULTIXACT_ZERO_OFF_PAGE)
{
}
void
-btree_desc(StringInfo buf, uint8 xl_info, char *rec)
+btree_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
switch (info)
{
#include "utils/relmapper.h"
void
-relmap_desc(StringInfo buf, uint8 xl_info, char *rec)
+relmap_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
if (info == XLOG_RELMAP_UPDATE)
{
void
-seq_desc(StringInfo buf, uint8 xl_info, char *rec)
+seq_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
xl_seq_rec *xlrec = (xl_seq_rec *) rec;
if (info == XLOG_SEQ_LOG)
void
-smgr_desc(StringInfo buf, uint8 xl_info, char *rec)
+smgr_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
if (info == XLOG_SMGR_CREATE)
{
}
void
-spg_desc(StringInfo buf, uint8 xl_info, char *rec)
+spg_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
switch (info)
{
}
void
-standby_desc(StringInfo buf, uint8 xl_info, char *rec)
+standby_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
if (info == XLOG_STANDBY_LOCK)
{
void
-tblspc_desc(StringInfo buf, uint8 xl_info, char *rec)
+tblspc_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
if (info == XLOG_TBLSPC_CREATE)
{
}
void
-xact_desc(StringInfo buf, uint8 xl_info, char *rec)
+xact_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
if (info == XLOG_XACT_COMMIT_COMPACT)
{
};
void
-xlog_desc(StringInfo buf, uint8 xl_info, char *rec)
+xlog_desc(StringInfo buf, XLogRecord *record)
{
- uint8 info = xl_info & ~XLR_INFO_MASK;
+ char *rec = XLogRecGetData(record);
+ uint8 info = record->xl_info & ~XLR_INFO_MASK;
if (info == XLOG_CHECKPOINT_SHUTDOWN ||
info == XLOG_CHECKPOINT_ONLINE)
rdt_lastnormal->next = NULL;
initStringInfo(&recordbuf);
+ appendBinaryStringInfo(&recordbuf, (char *) &rechdr, sizeof(XLogRecord));
for (; rdata != NULL; rdata = rdata->next)
appendBinaryStringInfo(&recordbuf, rdata->data, rdata->len);
appendStringInfoString(&buf, " - ");
- RmgrTable[rechdr->xl_rmid].rm_desc(&buf, rechdr->xl_info, recordbuf.data);
+ RmgrTable[rechdr->xl_rmid].rm_desc(&buf, (XLogRecord *) recordbuf.data);
pfree(recordbuf.data);
}
elog(LOG, "%s", buf.data);
(uint32) (EndRecPtr >> 32), (uint32) EndRecPtr);
xlog_outrec(&buf, record);
appendStringInfoString(&buf, " - ");
- RmgrTable[record->xl_rmid].rm_desc(&buf,
- record->xl_info,
- XLogRecGetData(record));
+ RmgrTable[record->xl_rmid].rm_desc(&buf, record);
elog(LOG, "%s", buf.data);
pfree(buf.data);
}
StringInfoData buf;
initStringInfo(&buf);
- RmgrTable[record->xl_rmid].rm_desc(&buf,
- record->xl_info,
- XLogRecGetData(record));
+ RmgrTable[record->xl_rmid].rm_desc(&buf, record);
/* don't bother emitting empty description */
if (buf.len > 0)
#define CLOG_TRUNCATE 0x10
extern void clog_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void clog_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void clog_desc(StringInfo buf, XLogRecord *record);
#endif /* CLOG_H */
/* ginxlog.c */
extern void gin_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void gin_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void gin_desc(StringInfo buf, XLogRecord *record);
extern void gin_xlog_startup(void);
extern void gin_xlog_cleanup(void);
/* gistxlog.c */
extern void gist_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void gist_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void gist_desc(StringInfo buf, XLogRecord *record);
extern void gist_xlog_startup(void);
extern void gist_xlog_cleanup(void);
/* hash.c */
extern void hash_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void hash_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void hash_desc(StringInfo buf, XLogRecord *record);
#endif /* HASH_H */
extern void HeapTupleHeaderAdvanceLatestRemovedXid(HeapTupleHeader tuple,
TransactionId *latestRemovedXid);
-extern void heap_redo(XLogRecPtr lsn, XLogRecord *rptr);
-extern void heap_desc(StringInfo buf, uint8 xl_info, char *rec);
-extern void heap2_redo(XLogRecPtr lsn, XLogRecord *rptr);
-extern void heap2_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void heap_redo(XLogRecPtr lsn, XLogRecord *record);
+extern void heap_desc(StringInfo buf, XLogRecord *record);
+extern void heap2_redo(XLogRecPtr lsn, XLogRecord *record);
+extern void heap2_desc(StringInfo buf, XLogRecord *record);
extern void heap_xlog_logical_rewrite(XLogRecPtr lsn, XLogRecord *r);
extern XLogRecPtr log_heap_cleanup_info(RelFileNode rnode,
void *recdata, uint32 len);
extern void multixact_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void multixact_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void multixact_desc(StringInfo buf, XLogRecord *record);
extern char *mxid_to_string(MultiXactId multi, int nmembers,
MultiXactMember *members);
* prototypes for functions in nbtxlog.c
*/
extern void btree_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void btree_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void btree_desc(StringInfo buf, XLogRecord *record);
#endif /* NBTREE_H */
/* spgxlog.c */
extern void spg_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void spg_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void spg_desc(StringInfo buf, XLogRecord *record);
extern void spg_xlog_startup(void);
extern void spg_xlog_cleanup(void);
extern int xactGetCommittedChildren(TransactionId **ptr);
extern void xact_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void xact_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void xact_desc(StringInfo buf, XLogRecord *record);
#endif /* XACT_H */
bool get_cleanup_lock, bool keep_buffer);
extern void xlog_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void xlog_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void xlog_desc(StringInfo buf, XLogRecord *record);
extern void issue_xlog_fsync(int fd, XLogSegNo segno);
{
const char *rm_name;
void (*rm_redo) (XLogRecPtr lsn, struct XLogRecord *rptr);
- void (*rm_desc) (StringInfo buf, uint8 xl_info, char *rec);
+ void (*rm_desc) (StringInfo buf, struct XLogRecord *rptr);
void (*rm_startup) (void);
void (*rm_cleanup) (void);
} RmgrData;
extern void log_smgrcreate(RelFileNode *rnode, ForkNumber forkNum);
extern void smgr_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void smgr_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void smgr_desc(StringInfo buf, XLogRecord *record);
#endif /* STORAGE_XLOG_H */
extern char *get_database_name(Oid dbid);
extern void dbase_redo(XLogRecPtr lsn, XLogRecord *rptr);
-extern void dbase_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void dbase_desc(StringInfo buf, XLogRecord *rptr);
extern void check_encoding_locale_matches(int encoding, const char *collate, const char *ctype);
extern void ResetSequenceCaches(void);
extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr);
-extern void seq_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void seq_desc(StringInfo buf, XLogRecord *rptr);
#endif /* SEQUENCE_H */
extern bool directory_is_empty(const char *path);
extern void tblspc_redo(XLogRecPtr lsn, XLogRecord *rptr);
-extern void tblspc_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void tblspc_desc(StringInfo buf, XLogRecord *rptr);
#endif /* TABLESPACE_H */
* Enable debugging print statements for WAL-related operations; see
* also the wal_debug GUC var.
*/
-/* #define WAL_DEBUG */
+#define WAL_DEBUG
/*
* Enable tracing of resource consumption during sort operations;
/* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */
extern void standby_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void standby_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void standby_desc(StringInfo buf, XLogRecord *record);
/*
* Declarations for GetRunningTransactionData(). Similar to Snapshots, but
extern void RelationMapInitializePhase3(void);
extern void relmap_redo(XLogRecPtr lsn, XLogRecord *record);
-extern void relmap_desc(StringInfo buf, uint8 xl_info, char *rec);
+extern void relmap_desc(StringInfo buf, XLogRecord *record);
#endif /* RELMAPPER_H */