| 1 |
/*------------------------------------------------------------------------- |
| 2 |
* |
| 3 |
* committsdesc.c |
| 4 |
* rmgr descriptor routines for access/transam/commit_ts.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/committsdesc.c |
| 12 |
* |
| 13 |
*------------------------------------------------------------------------- |
| 14 |
*/ |
| 15 |
#include "postgres.h" |
| 16 |
|
| 17 |
#include "access/commit_ts.h" |
| 18 |
|
| 19 |
|
| 20 |
void |
| 21 |
commit_ts_desc(StringInfo buf, XLogReaderState *record) |
| 22 |
{ |
| 23 |
char *rec = XLogRecGetData(record); |
| 24 |
uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; |
| 25 |
|
| 26 |
if (info == COMMIT_TS_ZEROPAGE) |
| 27 |
{ |
| 28 |
int64 pageno; |
| 29 |
|
| 30 |
memcpy(&pageno, rec, sizeof(pageno)); |
| 31 |
appendStringInfo(buf, "%" PRId64, pageno); |
| 32 |
} |
| 33 |
else if (info == COMMIT_TS_TRUNCATE) |
| 34 |
{ |
| 35 |
xl_commit_ts_truncate *trunc = (xl_commit_ts_truncate *) rec; |
| 36 |
|
| 37 |
appendStringInfo(buf, "pageno %" PRId64 ", oldestXid %u", |
| 38 |
trunc->pageno, trunc->oldestXid); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
const char * |
| 43 |
commit_ts_identify(uint8 info) |
| 44 |
{ |
| 45 |
switch (info) |
| 46 |
{ |
| 47 |
case COMMIT_TS_ZEROPAGE: |
| 48 |
return "ZEROPAGE"; |
| 49 |
case COMMIT_TS_TRUNCATE: |
| 50 |
return "TRUNCATE"; |
| 51 |
default: |
| 52 |
return NULL; |
| 53 |
} |
| 54 |
} |