PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
hashdesc.c
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * hashdesc.c
4 * rmgr descriptor routines for access/hash/hash.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/hashdesc.c
12 *
13 *-------------------------------------------------------------------------
14 */
15#include "postgres.h"
16
17#include "access/hash_xlog.h"
18
19void
21{
22 char *rec = XLogRecGetData(record);
23 uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
24
25 switch (info)
26 {
28 {
30
31 appendStringInfo(buf, "num_tuples %g, procid %u, fillfactor %d",
32 xlrec->num_tuples,
33 xlrec->procid,
34 xlrec->ffactor);
35 break;
36 }
38 {
40
41 appendStringInfo(buf, "bmsize %d", xlrec->bmsize);
42 break;
43 }
45 {
46 xl_hash_insert *xlrec = (xl_hash_insert *) rec;
47
48 appendStringInfo(buf, "off %u", xlrec->offnum);
49 break;
50 }
52 {
54
55 appendStringInfo(buf, "bmsize %d, bmpage_found %c",
56 xlrec->bmsize, (xlrec->bmpage_found) ? 'T' : 'F');
57 break;
58 }
60 {
62
63 appendStringInfo(buf, "new_bucket %u, old_bucket_flag %u, new_bucket_flag %u, meta_page_masks_updated %c, issplitpoint_changed %c",
64 xlrec->new_bucket,
65 xlrec->old_bucket_flag,
66 xlrec->new_bucket_flag,
67 (xlrec->flags & XLH_SPLIT_META_UPDATE_MASKS) ? 'T' : 'F',
68 (xlrec->flags & XLH_SPLIT_META_UPDATE_SPLITPOINT) ? 'T' : 'F');
69 break;
70 }
72 {
74
75 appendStringInfo(buf, "old_bucket_flag %u, new_bucket_flag %u",
76 xlrec->old_bucket_flag, xlrec->new_bucket_flag);
77 break;
78 }
80 {
82
83 appendStringInfo(buf, "ntups %d, is_primary %c",
84 xlrec->ntups,
85 xlrec->is_prim_bucket_same_wrt ? 'T' : 'F');
86 break;
87 }
89 {
91
92 appendStringInfo(buf, "prevblkno %u, nextblkno %u, ntups %d, is_primary %c, is_previous %c",
93 xlrec->prevblkno,
94 xlrec->nextblkno,
95 xlrec->ntups,
96 xlrec->is_prim_bucket_same_wrt ? 'T' : 'F',
97 xlrec->is_prev_bucket_same_wrt ? 'T' : 'F');
98 break;
99 }
100 case XLOG_HASH_DELETE:
101 {
102 xl_hash_delete *xlrec = (xl_hash_delete *) rec;
103
104 appendStringInfo(buf, "clear_dead_marking %c, is_primary %c",
105 xlrec->clear_dead_marking ? 'T' : 'F',
106 xlrec->is_primary_bucket_page ? 'T' : 'F');
107 break;
108 }
110 {
112
113 appendStringInfo(buf, "ntuples %g",
114 xlrec->ntuples);
115 break;
116 }
118 {
120
121 appendStringInfo(buf, "ntuples %d, snapshotConflictHorizon %u, isCatalogRel %c",
122 xlrec->ntuples,
124 xlrec->isCatalogRel ? 'T' : 'F');
125 break;
126 }
127 }
128}
129
130const char *
132{
133 const char *id = NULL;
134
135 switch (info & ~XLR_INFO_MASK)
136 {
138 id = "INIT_META_PAGE";
139 break;
141 id = "INIT_BITMAP_PAGE";
142 break;
143 case XLOG_HASH_INSERT:
144 id = "INSERT";
145 break;
147 id = "ADD_OVFL_PAGE";
148 break;
150 id = "SPLIT_ALLOCATE_PAGE";
151 break;
153 id = "SPLIT_PAGE";
154 break;
156 id = "SPLIT_COMPLETE";
157 break;
159 id = "MOVE_PAGE_CONTENTS";
160 break;
162 id = "SQUEEZE_PAGE";
163 break;
164 case XLOG_HASH_DELETE:
165 id = "DELETE";
166 break;
168 id = "SPLIT_CLEANUP";
169 break;
171 id = "UPDATE_META_PAGE";
172 break;
174 id = "VACUUM_ONE_PAGE";
175 }
176
177 return id;
178}
uint8_t uint8
Definition: c.h:536
#define XLOG_HASH_INIT_BITMAP_PAGE
Definition: hash_xlog.h:28
#define XLOG_HASH_SQUEEZE_PAGE
Definition: hash_xlog.h:35
#define XLOG_HASH_SPLIT_CLEANUP
Definition: hash_xlog.h:37
#define XLOG_HASH_ADD_OVFL_PAGE
Definition: hash_xlog.h:30
#define XLOG_HASH_UPDATE_META_PAGE
Definition: hash_xlog.h:38
#define XLOG_HASH_INSERT
Definition: hash_xlog.h:29
#define XLOG_HASH_SPLIT_ALLOCATE_PAGE
Definition: hash_xlog.h:31
#define XLOG_HASH_SPLIT_PAGE
Definition: hash_xlog.h:32
#define XLOG_HASH_INIT_META_PAGE
Definition: hash_xlog.h:27
#define XLOG_HASH_DELETE
Definition: hash_xlog.h:36
#define XLOG_HASH_SPLIT_COMPLETE
Definition: hash_xlog.h:33
#define XLH_SPLIT_META_UPDATE_SPLITPOINT
Definition: hash_xlog.h:46
#define XLOG_HASH_MOVE_PAGE_CONTENTS
Definition: hash_xlog.h:34
#define XLOG_HASH_VACUUM_ONE_PAGE
Definition: hash_xlog.h:40
#define XLH_SPLIT_META_UPDATE_MASKS
Definition: hash_xlog.h:45
const char * hash_identify(uint8 info)
Definition: hashdesc.c:131
void hash_desc(StringInfo buf, XLogReaderState *record)
Definition: hashdesc.c:20
static char * buf
Definition: pg_test_fsync.c:72
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:145
bool clear_dead_marking
Definition: hash_xlog.h:181
bool is_primary_bucket_page
Definition: hash_xlog.h:183
RegProcedure procid
Definition: hash_xlog.h:214
OffsetNumber offnum
Definition: hash_xlog.h:58
BlockNumber prevblkno
Definition: hash_xlog.h:156
bool is_prim_bucket_same_wrt
Definition: hash_xlog.h:159
bool is_prev_bucket_same_wrt
Definition: hash_xlog.h:162
BlockNumber nextblkno
Definition: hash_xlog.h:157
TransactionId snapshotConflictHorizon
Definition: hash_xlog.h:248
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:410
#define XLogRecGetData(decoder)
Definition: xlogreader.h:415
#define XLR_INFO_MASK
Definition: xlogrecord.h:62