Age Owner Branch data TLA Line data Source code
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 : :
19 : : void
3995 heikki.linnakangas@i 20 :CBC 54 : hash_desc(StringInfo buf, XLogReaderState *record)
21 : : {
3150 rhaas@postgresql.org 22 : 54 : char *rec = XLogRecGetData(record);
23 : 54 : uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
24 : :
25 [ + + + - : 54 : switch (info)
- - - - +
+ - - ]
26 : : {
27 : 12 : case XLOG_HASH_INIT_META_PAGE:
28 : : {
29 : 12 : xl_hash_init_meta_page *xlrec = (xl_hash_init_meta_page *) rec;
30 : :
46 michael@paquier.xyz 31 :GNC 12 : appendStringInfo(buf, "num_tuples %g, procid %u, fillfactor %d",
32 : : xlrec->num_tuples,
33 : : xlrec->procid,
34 : 12 : xlrec->ffactor);
3150 rhaas@postgresql.org 35 :CBC 12 : break;
36 : : }
37 : 12 : case XLOG_HASH_INIT_BITMAP_PAGE:
38 : : {
39 : 12 : xl_hash_init_bitmap_page *xlrec = (xl_hash_init_bitmap_page *) rec;
40 : :
41 : 12 : appendStringInfo(buf, "bmsize %d", xlrec->bmsize);
42 : 12 : break;
43 : : }
44 : 18 : case XLOG_HASH_INSERT:
45 : : {
46 : 18 : xl_hash_insert *xlrec = (xl_hash_insert *) rec;
47 : :
48 : 18 : appendStringInfo(buf, "off %u", xlrec->offnum);
49 : 18 : break;
50 : : }
3150 rhaas@postgresql.org 51 :UBC 0 : case XLOG_HASH_ADD_OVFL_PAGE:
52 : : {
53 : 0 : xl_hash_add_ovfl_page *xlrec = (xl_hash_add_ovfl_page *) rec;
54 : :
55 : 0 : appendStringInfo(buf, "bmsize %d, bmpage_found %c",
3051 tgl@sss.pgh.pa.us 56 [ # # ]: 0 : xlrec->bmsize, (xlrec->bmpage_found) ? 'T' : 'F');
3150 rhaas@postgresql.org 57 : 0 : break;
58 : : }
59 : 0 : case XLOG_HASH_SPLIT_ALLOCATE_PAGE:
60 : : {
61 : 0 : xl_hash_split_allocate_page *xlrec = (xl_hash_split_allocate_page *) rec;
62 : :
46 michael@paquier.xyz 63 :UNC 0 : 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 : 0 : xlrec->old_bucket_flag,
66 : 0 : xlrec->new_bucket_flag,
3051 tgl@sss.pgh.pa.us 67 [ # # ]:UBC 0 : (xlrec->flags & XLH_SPLIT_META_UPDATE_MASKS) ? 'T' : 'F',
3150 rhaas@postgresql.org 68 [ # # ]: 0 : (xlrec->flags & XLH_SPLIT_META_UPDATE_SPLITPOINT) ? 'T' : 'F');
69 : 0 : break;
70 : : }
71 : 0 : case XLOG_HASH_SPLIT_COMPLETE:
72 : : {
73 : 0 : xl_hash_split_complete *xlrec = (xl_hash_split_complete *) rec;
74 : :
75 : 0 : appendStringInfo(buf, "old_bucket_flag %u, new_bucket_flag %u",
3051 tgl@sss.pgh.pa.us 76 : 0 : xlrec->old_bucket_flag, xlrec->new_bucket_flag);
3150 rhaas@postgresql.org 77 : 0 : break;
78 : : }
79 : 0 : case XLOG_HASH_MOVE_PAGE_CONTENTS:
80 : : {
81 : 0 : xl_hash_move_page_contents *xlrec = (xl_hash_move_page_contents *) rec;
82 : :
83 : 0 : appendStringInfo(buf, "ntups %d, is_primary %c",
84 : 0 : xlrec->ntups,
85 [ # # ]: 0 : xlrec->is_prim_bucket_same_wrt ? 'T' : 'F');
86 : 0 : break;
87 : : }
88 : 0 : case XLOG_HASH_SQUEEZE_PAGE:
89 : : {
90 : 0 : xl_hash_squeeze_page *xlrec = (xl_hash_squeeze_page *) rec;
91 : :
46 michael@paquier.xyz 92 :UNC 0 : appendStringInfo(buf, "prevblkno %u, nextblkno %u, ntups %d, is_primary %c, is_previous %c",
93 : : xlrec->prevblkno,
94 : : xlrec->nextblkno,
3150 rhaas@postgresql.org 95 :UBC 0 : xlrec->ntups,
46 michael@paquier.xyz 96 [ # # ]:UNC 0 : xlrec->is_prim_bucket_same_wrt ? 'T' : 'F',
97 [ # # ]: 0 : xlrec->is_prev_bucket_same_wrt ? 'T' : 'F');
3150 rhaas@postgresql.org 98 :UBC 0 : break;
99 : : }
3150 rhaas@postgresql.org 100 :CBC 6 : case XLOG_HASH_DELETE:
101 : : {
102 : 6 : xl_hash_delete *xlrec = (xl_hash_delete *) rec;
103 : :
3144 104 : 12 : appendStringInfo(buf, "clear_dead_marking %c, is_primary %c",
105 [ - + ]: 6 : xlrec->clear_dead_marking ? 'T' : 'F',
3150 106 [ + - ]: 6 : xlrec->is_primary_bucket_page ? 'T' : 'F');
107 : 6 : break;
108 : : }
109 : 6 : case XLOG_HASH_UPDATE_META_PAGE:
110 : : {
111 : 6 : xl_hash_update_meta_page *xlrec = (xl_hash_update_meta_page *) rec;
112 : :
3144 113 : 6 : appendStringInfo(buf, "ntuples %g",
114 : : xlrec->ntuples);
115 : 6 : break;
116 : : }
3144 rhaas@postgresql.org 117 :UBC 0 : case XLOG_HASH_VACUUM_ONE_PAGE:
118 : : {
119 : 0 : xl_hash_vacuum_one_page *xlrec = (xl_hash_vacuum_one_page *) rec;
120 : :
677 msawada@postgresql.o 121 : 0 : appendStringInfo(buf, "ntuples %d, snapshotConflictHorizon %u, isCatalogRel %c",
2408 andres@anarazel.de 122 : 0 : xlrec->ntuples,
123 : : xlrec->snapshotConflictHorizon,
677 msawada@postgresql.o 124 [ # # ]: 0 : xlrec->isCatalogRel ? 'T' : 'F');
3150 rhaas@postgresql.org 125 : 0 : break;
126 : : }
127 : : }
4717 alvherre@alvh.no-ip. 128 :CBC 54 : }
129 : :
130 : : const char *
4057 andres@anarazel.de 131 : 59 : hash_identify(uint8 info)
132 : : {
3150 rhaas@postgresql.org 133 : 59 : const char *id = NULL;
134 : :
135 [ + + + - : 59 : switch (info & ~XLR_INFO_MASK)
- - - - -
+ - + -
- ]
136 : : {
137 : 13 : case XLOG_HASH_INIT_META_PAGE:
138 : 13 : id = "INIT_META_PAGE";
139 : 13 : break;
140 : 13 : case XLOG_HASH_INIT_BITMAP_PAGE:
141 : 13 : id = "INIT_BITMAP_PAGE";
142 : 13 : break;
143 : 19 : case XLOG_HASH_INSERT:
144 : 19 : id = "INSERT";
145 : 19 : break;
3150 rhaas@postgresql.org 146 :UBC 0 : case XLOG_HASH_ADD_OVFL_PAGE:
147 : 0 : id = "ADD_OVFL_PAGE";
148 : 0 : break;
149 : 0 : case XLOG_HASH_SPLIT_ALLOCATE_PAGE:
150 : 0 : id = "SPLIT_ALLOCATE_PAGE";
151 : 0 : break;
152 : 0 : case XLOG_HASH_SPLIT_PAGE:
153 : 0 : id = "SPLIT_PAGE";
154 : 0 : break;
155 : 0 : case XLOG_HASH_SPLIT_COMPLETE:
156 : 0 : id = "SPLIT_COMPLETE";
157 : 0 : break;
158 : 0 : case XLOG_HASH_MOVE_PAGE_CONTENTS:
159 : 0 : id = "MOVE_PAGE_CONTENTS";
160 : 0 : break;
161 : 0 : case XLOG_HASH_SQUEEZE_PAGE:
162 : 0 : id = "SQUEEZE_PAGE";
163 : 0 : break;
3150 rhaas@postgresql.org 164 :CBC 7 : case XLOG_HASH_DELETE:
165 : 7 : id = "DELETE";
166 : 7 : break;
3150 rhaas@postgresql.org 167 :UBC 0 : case XLOG_HASH_SPLIT_CLEANUP:
168 : 0 : id = "SPLIT_CLEANUP";
169 : 0 : break;
3150 rhaas@postgresql.org 170 :CBC 7 : case XLOG_HASH_UPDATE_META_PAGE:
171 : 7 : id = "UPDATE_META_PAGE";
172 : 7 : break;
3149 rhaas@postgresql.org 173 :UBC 0 : case XLOG_HASH_VACUUM_ONE_PAGE:
174 : 0 : id = "VACUUM_ONE_PAGE";
175 : : }
176 : :
3150 rhaas@postgresql.org 177 :CBC 59 : return id;
178 : : }
|