Standardize rmgrdesc recovery conflict XID output.
[pgsql.git] / src / backend / access / rmgrdesc / committsdesc.c
blob3a65538bb0ae79e9db99178b1b8310903382c4c5
1 /*-------------------------------------------------------------------------
3 * committsdesc.c
4 * rmgr descriptor routines for access/transam/commit_ts.c
6 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
10 * IDENTIFICATION
11 * src/backend/access/rmgrdesc/committsdesc.c
13 *-------------------------------------------------------------------------
15 #include "postgres.h"
17 #include "access/commit_ts.h"
18 #include "utils/timestamp.h"
21 void
22 commit_ts_desc(StringInfo buf, XLogReaderState *record)
24 char *rec = XLogRecGetData(record);
25 uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
27 if (info == COMMIT_TS_ZEROPAGE)
29 int pageno;
31 memcpy(&pageno, rec, sizeof(int));
32 appendStringInfo(buf, "%d", pageno);
34 else if (info == COMMIT_TS_TRUNCATE)
36 xl_commit_ts_truncate *trunc = (xl_commit_ts_truncate *) rec;
38 appendStringInfo(buf, "pageno %d, oldestXid %u",
39 trunc->pageno, trunc->oldestXid);
43 const char *
44 commit_ts_identify(uint8 info)
46 switch (info)
48 case COMMIT_TS_ZEROPAGE:
49 return "ZEROPAGE";
50 case COMMIT_TS_TRUNCATE:
51 return "TRUNCATE";
52 default:
53 return NULL;