Age Owner Branch data 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-2025, 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
3943 heikki.linnakangas@i 21 :CBC 2 : clog_desc(StringInfo buf, XLogReaderState *record)
22 : : {
4102 23 : 2 : char *rec = XLogRecGetData(record);
3943 24 : 2 : uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
25 : :
3089 rhaas@postgresql.org 26 [ + - ]: 2 : if (info == CLOG_ZEROPAGE)
27 : : {
28 : : int64 pageno;
29 : :
647 akorotkov@postgresql 30 : 2 : memcpy(&pageno, rec, sizeof(pageno));
161 peter@eisentraut.org 31 : 2 : appendStringInfo(buf, "page %" PRId64, pageno);
32 : : }
3089 rhaas@postgresql.org 33 [ # # ]:UBC 0 : else if (info == CLOG_TRUNCATE)
34 : : {
35 : : xl_clog_truncate xlrec;
36 : :
37 : 0 : memcpy(&xlrec, rec, sizeof(xl_clog_truncate));
161 peter@eisentraut.org 38 : 0 : appendStringInfo(buf, "page %" PRId64 "; oldestXact %u",
39 : : xlrec.pageno, xlrec.oldestXact);
40 : : }
4005 andres@anarazel.de 41 :CBC 2 : }
42 : :
43 : : const char *
44 : 2 : clog_identify(uint8 info)
45 : : {
46 : 2 : const char *id = NULL;
47 : :
4002 48 [ + - - ]: 2 : switch (info & ~XLR_INFO_MASK)
49 : : {
4005 50 : 2 : case CLOG_ZEROPAGE:
51 : 2 : id = "ZEROPAGE";
52 : 2 : break;
4005 andres@anarazel.de 53 :UBC 0 : case CLOG_TRUNCATE:
54 : 0 : id = "TRUNCATE";
55 : 0 : break;
56 : : }
57 : :
4005 andres@anarazel.de 58 :CBC 2 : return id;
59 : : }
|