Line data Source code
1 : /*------------------------------------------------------------------------- 2 : * 3 : * committsdesc.c 4 : * rmgr descriptor routines for access/transam/commit_ts.c 5 : * 6 : * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group 7 : * Portions Copyright (c) 1994, Regents of the University of California 8 : * 9 : * 10 : * IDENTIFICATION 11 : * src/backend/access/rmgrdesc/committsdesc.c 12 : * 13 : *------------------------------------------------------------------------- 14 : */ 15 : #include "postgres.h" 16 : 17 : #include "access/commit_ts.h" 18 : #include "utils/timestamp.h" 19 : 20 : 21 : void 22 0 : commit_ts_desc(StringInfo buf, XLogReaderState *record) 23 : { 24 0 : char *rec = XLogRecGetData(record); 25 0 : uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; 26 : 27 0 : if (info == COMMIT_TS_ZEROPAGE) 28 : { 29 : int pageno; 30 : 31 0 : memcpy(&pageno, rec, sizeof(int)); 32 0 : appendStringInfo(buf, "%d", pageno); 33 : } 34 0 : else if (info == COMMIT_TS_TRUNCATE) 35 : { 36 0 : xl_commit_ts_truncate *trunc = (xl_commit_ts_truncate *) rec; 37 : 38 0 : appendStringInfo(buf, "pageno %d, oldestXid %u", 39 : trunc->pageno, trunc->oldestXid); 40 : } 41 0 : } 42 : 43 : const char * 44 0 : commit_ts_identify(uint8 info) 45 : { 46 0 : switch (info) 47 : { 48 0 : case COMMIT_TS_ZEROPAGE: 49 0 : return "ZEROPAGE"; 50 0 : case COMMIT_TS_TRUNCATE: 51 0 : return "TRUNCATE"; 52 0 : default: 53 0 : return NULL; 54 : } 55 : }