mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Add rmgr callback to name xlog record types for display purposes.
This is primarily useful for the upcoming pg_xlogdump --stats feature, but also allows to remove some duplicated code in the rmgr_desc routines. Due to the separation and harmonization, the output of dipsplayed records changes somewhat. But since this isn't enduser oriented content that's ok. It's potentially desirable to further change pg_xlogdump's display of records. It previously wasn't possible to show the record type separately from the description forcing it to be in the last column. But that's better done in a separate commit. Author: Abhijit Menon-Sen, slightly editorialized by me Reviewed-By: Álvaro Herrera, Andres Freund, and Heikki Linnakangas Discussion: 20140604104716.GA3989@toroid.org
This commit is contained in:
@@ -49,5 +49,6 @@ extern void TruncateCLOG(TransactionId oldestXact);
|
||||
|
||||
extern void clog_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void clog_desc(StringInfo buf, XLogRecord *record);
|
||||
extern const char *clog_identify(uint8 info);
|
||||
|
||||
#endif /* CLOG_H */
|
||||
|
||||
@@ -74,6 +74,7 @@ extern void ginUpdateStats(Relation index, const GinStatsData *stats);
|
||||
/* ginxlog.c */
|
||||
extern void gin_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void gin_desc(StringInfo buf, XLogRecord *record);
|
||||
extern const char *gin_identify(uint8 info);
|
||||
extern void gin_xlog_startup(void);
|
||||
extern void gin_xlog_cleanup(void);
|
||||
|
||||
|
||||
@@ -452,6 +452,7 @@ extern SplitedPageLayout *gistSplit(Relation r, Page page, IndexTuple *itup,
|
||||
/* gistxlog.c */
|
||||
extern void gist_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void gist_desc(StringInfo buf, XLogRecord *record);
|
||||
extern const char *gist_identify(uint8 info);
|
||||
extern void gist_xlog_startup(void);
|
||||
extern void gist_xlog_cleanup(void);
|
||||
|
||||
|
||||
@@ -357,5 +357,6 @@ extern OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value);
|
||||
/* hash.c */
|
||||
extern void hash_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void hash_desc(StringInfo buf, XLogRecord *record);
|
||||
extern const char *hash_identify(uint8 info);
|
||||
|
||||
#endif /* HASH_H */
|
||||
|
||||
@@ -357,8 +357,10 @@ extern void HeapTupleHeaderAdvanceLatestRemovedXid(HeapTupleHeader tuple,
|
||||
|
||||
extern void heap_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void heap_desc(StringInfo buf, XLogRecord *record);
|
||||
extern const char *heap_identify(uint8 info);
|
||||
extern void heap2_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void heap2_desc(StringInfo buf, XLogRecord *record);
|
||||
extern const char *heap2_identify(uint8 info);
|
||||
extern void heap_xlog_logical_rewrite(XLogRecPtr lsn, XLogRecord *r);
|
||||
|
||||
extern XLogRecPtr log_heap_cleanup_info(RelFileNode rnode,
|
||||
|
||||
@@ -136,6 +136,7 @@ extern void multixact_twophase_postabort(TransactionId xid, uint16 info,
|
||||
|
||||
extern void multixact_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void multixact_desc(StringInfo buf, XLogRecord *record);
|
||||
extern const char *multixact_identify(uint8 info);
|
||||
extern char *mxid_to_string(MultiXactId multi, int nmembers,
|
||||
MultiXactMember *members);
|
||||
|
||||
|
||||
@@ -726,5 +726,6 @@ extern void _bt_leafbuild(BTSpool *btspool, BTSpool *spool2);
|
||||
*/
|
||||
extern void btree_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void btree_desc(StringInfo buf, XLogRecord *record);
|
||||
extern const char *btree_identify(uint8 info);
|
||||
|
||||
#endif /* NBTREE_H */
|
||||
|
||||
@@ -19,7 +19,7 @@ typedef uint8 RmgrId;
|
||||
* Note: RM_MAX_ID must fit in RmgrId; widening that type will affect the XLOG
|
||||
* file format.
|
||||
*/
|
||||
#define PG_RMGR(symname,name,redo,desc,startup,cleanup) \
|
||||
#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup) \
|
||||
symname,
|
||||
|
||||
typedef enum RmgrIds
|
||||
|
||||
@@ -25,20 +25,20 @@
|
||||
*/
|
||||
|
||||
/* symbol name, textual name, redo, desc, startup, cleanup */
|
||||
PG_RMGR(RM_XLOG_ID, "XLOG", xlog_redo, xlog_desc, NULL, NULL)
|
||||
PG_RMGR(RM_XACT_ID, "Transaction", xact_redo, xact_desc, NULL, NULL)
|
||||
PG_RMGR(RM_SMGR_ID, "Storage", smgr_redo, smgr_desc, NULL, NULL)
|
||||
PG_RMGR(RM_CLOG_ID, "CLOG", clog_redo, clog_desc, NULL, NULL)
|
||||
PG_RMGR(RM_DBASE_ID, "Database", dbase_redo, dbase_desc, NULL, NULL)
|
||||
PG_RMGR(RM_TBLSPC_ID, "Tablespace", tblspc_redo, tblspc_desc, NULL, NULL)
|
||||
PG_RMGR(RM_MULTIXACT_ID, "MultiXact", multixact_redo, multixact_desc, NULL, NULL)
|
||||
PG_RMGR(RM_RELMAP_ID, "RelMap", relmap_redo, relmap_desc, NULL, NULL)
|
||||
PG_RMGR(RM_STANDBY_ID, "Standby", standby_redo, standby_desc, NULL, NULL)
|
||||
PG_RMGR(RM_HEAP2_ID, "Heap2", heap2_redo, heap2_desc, NULL, NULL)
|
||||
PG_RMGR(RM_HEAP_ID, "Heap", heap_redo, heap_desc, NULL, NULL)
|
||||
PG_RMGR(RM_BTREE_ID, "Btree", btree_redo, btree_desc, NULL, NULL)
|
||||
PG_RMGR(RM_HASH_ID, "Hash", hash_redo, hash_desc, NULL, NULL)
|
||||
PG_RMGR(RM_GIN_ID, "Gin", gin_redo, gin_desc, gin_xlog_startup, gin_xlog_cleanup)
|
||||
PG_RMGR(RM_GIST_ID, "Gist", gist_redo, gist_desc, gist_xlog_startup, gist_xlog_cleanup)
|
||||
PG_RMGR(RM_SEQ_ID, "Sequence", seq_redo, seq_desc, NULL, NULL)
|
||||
PG_RMGR(RM_SPGIST_ID, "SPGist", spg_redo, spg_desc, spg_xlog_startup, spg_xlog_cleanup)
|
||||
PG_RMGR(RM_XLOG_ID, "XLOG", xlog_redo, xlog_desc, xlog_identify, NULL, NULL)
|
||||
PG_RMGR(RM_XACT_ID, "Transaction", xact_redo, xact_desc, xact_identify, NULL, NULL)
|
||||
PG_RMGR(RM_SMGR_ID, "Storage", smgr_redo, smgr_desc, smgr_identify, NULL, NULL)
|
||||
PG_RMGR(RM_CLOG_ID, "CLOG", clog_redo, clog_desc, clog_identify, NULL, NULL)
|
||||
PG_RMGR(RM_DBASE_ID, "Database", dbase_redo, dbase_desc, dbase_identify, NULL, NULL)
|
||||
PG_RMGR(RM_TBLSPC_ID, "Tablespace", tblspc_redo, tblspc_desc, tblspc_identify, NULL, NULL)
|
||||
PG_RMGR(RM_MULTIXACT_ID, "MultiXact", multixact_redo, multixact_desc, multixact_identify, NULL, NULL)
|
||||
PG_RMGR(RM_RELMAP_ID, "RelMap", relmap_redo, relmap_desc, relmap_identify, NULL, NULL)
|
||||
PG_RMGR(RM_STANDBY_ID, "Standby", standby_redo, standby_desc, standby_identify, NULL, NULL)
|
||||
PG_RMGR(RM_HEAP2_ID, "Heap2", heap2_redo, heap2_desc, heap2_identify, NULL, NULL)
|
||||
PG_RMGR(RM_HEAP_ID, "Heap", heap_redo, heap_desc, heap_identify, NULL, NULL)
|
||||
PG_RMGR(RM_BTREE_ID, "Btree", btree_redo, btree_desc, btree_identify, NULL, NULL)
|
||||
PG_RMGR(RM_HASH_ID, "Hash", hash_redo, hash_desc, hash_identify, NULL, NULL)
|
||||
PG_RMGR(RM_GIN_ID, "Gin", gin_redo, gin_desc, gin_identify, gin_xlog_startup, gin_xlog_cleanup)
|
||||
PG_RMGR(RM_GIST_ID, "Gist", gist_redo, gist_desc, gist_identify, gist_xlog_startup, gist_xlog_cleanup)
|
||||
PG_RMGR(RM_SEQ_ID, "Sequence", seq_redo, seq_desc, seq_identify, NULL, NULL)
|
||||
PG_RMGR(RM_SPGIST_ID, "SPGist", spg_redo, spg_desc, spg_identify, spg_xlog_startup, spg_xlog_cleanup)
|
||||
|
||||
@@ -198,6 +198,7 @@ extern Datum spgvacuumcleanup(PG_FUNCTION_ARGS);
|
||||
/* spgxlog.c */
|
||||
extern void spg_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void spg_desc(StringInfo buf, XLogRecord *record);
|
||||
extern const char *spg_identify(uint8 info);
|
||||
extern void spg_xlog_startup(void);
|
||||
extern void spg_xlog_cleanup(void);
|
||||
|
||||
|
||||
@@ -256,5 +256,6 @@ extern int xactGetCommittedChildren(TransactionId **ptr);
|
||||
|
||||
extern void xact_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void xact_desc(StringInfo buf, XLogRecord *record);
|
||||
extern const char *xact_identify(uint8 info);
|
||||
|
||||
#endif /* XACT_H */
|
||||
|
||||
@@ -304,6 +304,7 @@ extern Buffer RestoreBackupBlock(XLogRecPtr lsn, XLogRecord *record,
|
||||
|
||||
extern void xlog_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void xlog_desc(StringInfo buf, XLogRecord *record);
|
||||
extern const char *xlog_identify(uint8 info);
|
||||
|
||||
extern void issue_xlog_fsync(int fd, XLogSegNo segno);
|
||||
|
||||
|
||||
@@ -239,6 +239,14 @@ struct XLogRecord;
|
||||
* This struct must be kept in sync with the PG_RMGR definition in
|
||||
* rmgr.c.
|
||||
*
|
||||
* rm_identify must return a name for the record based on xl_info (without
|
||||
* reference to the rmid). For example, XLOG_BTREE_VACUUM would be named
|
||||
* "VACUUM". rm_desc can then be called to obtain additional detail for the
|
||||
* record, if available (e.g. the last block).
|
||||
*
|
||||
* The return value from rm_identify is a pointer to a statically allocated
|
||||
* buffer, and only valid until the next invocation of the callback.
|
||||
*
|
||||
* RmgrTable[] is indexed by RmgrId values (see rmgrlist.h).
|
||||
*/
|
||||
typedef struct RmgrData
|
||||
@@ -246,6 +254,7 @@ typedef struct RmgrData
|
||||
const char *rm_name;
|
||||
void (*rm_redo) (XLogRecPtr lsn, struct XLogRecord *rptr);
|
||||
void (*rm_desc) (StringInfo buf, struct XLogRecord *rptr);
|
||||
const char *(*rm_identify) (uint8 info);
|
||||
void (*rm_startup) (void);
|
||||
void (*rm_cleanup) (void);
|
||||
} RmgrData;
|
||||
|
||||
Reference in New Issue
Block a user