Age Owner TLA Line data Source code
1 : /*-------------------------------------------------------------------------
2 : *
3 : * clogdesc.c
4 : * rmgr descriptor routines for access/transam/clog.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/clogdesc.c
12 : *
13 : *-------------------------------------------------------------------------
14 : */
15 : #include "postgres.h"
16 :
17 : #include "access/clog.h"
18 :
19 :
20 : void
3062 heikki.linnakangas 21 UBC 0 : clog_desc(StringInfo buf, XLogReaderState *record)
22 : {
3221 23 0 : char *rec = XLogRecGetData(record);
3062 24 0 : uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
25 :
2208 rhaas 26 0 : if (info == CLOG_ZEROPAGE)
27 : {
28 : int pageno;
29 :
3784 alvherre 30 0 : memcpy(&pageno, rec, sizeof(int));
2208 rhaas 31 0 : appendStringInfo(buf, "page %d", pageno);
32 : }
33 0 : else if (info == CLOG_TRUNCATE)
34 : {
35 : xl_clog_truncate xlrec;
36 :
37 0 : memcpy(&xlrec, rec, sizeof(xl_clog_truncate));
38 0 : appendStringInfo(buf, "page %d; oldestXact %u",
39 : xlrec.pageno, xlrec.oldestXact);
40 : }
3124 andres 41 0 : }
42 :
43 : const char *
44 0 : clog_identify(uint8 info)
45 : {
46 0 : const char *id = NULL;
47 :
3121 48 0 : switch (info & ~XLR_INFO_MASK)
49 : {
3124 50 0 : case CLOG_ZEROPAGE:
51 0 : id = "ZEROPAGE";
52 0 : break;
53 0 : case CLOG_TRUNCATE:
54 0 : id = "TRUNCATE";
55 0 : break;
56 : }
57 :
58 0 : return id;
59 : }
|