MCPcopy Create free account
hub / github.com/apache/cloudberry / verify_bitmappages

Function verify_bitmappages

src/backend/access/bitmap/bitmapinsert.c:1072–1115  ·  view source on GitHub ↗

* verify_bitmappages() -- verify if the bm_last_tid_location values * are valid in all bitmap pages. Only used during debugging. */

Source from the content-addressed store, hash-verified

1070 * are valid in all bitmap pages. Only used during debugging.
1071 */
1072static void
1073verify_bitmappages(Relation rel, BMLOVItem lovitem)
1074{
1075 BlockNumber nextBlockNo = lovitem->bm_lov_head;
1076 uint64 tidnum = 0;
1077
1078 while (BlockNumberIsValid(nextBlockNo))
1079 {
1080 Page bitmapPage;
1081 BMBitmapOpaque bitmapOpaque;
1082 Buffer bitmapBuffer;
1083 uint32 wordNo;
1084 BMBitmap bitmap;
1085
1086 bitmapBuffer = _bitmap_getbuf(rel, nextBlockNo, BM_READ);
1087 bitmapPage = BufferGetPage(bitmapBuffer);
1088 bitmapOpaque = (BMBitmapOpaque)
1089 PageGetSpecialPointer(bitmapPage);
1090 bitmap = (BMBitmap) PageGetContentsMaxAligned(bitmapPage);
1091
1092 for (wordNo = 0; wordNo < bitmapOpaque->bm_hrl_words_used; wordNo++)
1093 {
1094 BM_HRL_WORD word = bitmap->cwords[wordNo];
1095 if (IS_FILL_WORD(bitmap->hwords, wordNo))
1096 tidnum += FILL_LENGTH(word) * BM_HRL_WORD_SIZE;
1097 else
1098 tidnum += BM_HRL_WORD_SIZE;
1099
1100 }
1101
1102 if (bitmapOpaque->bm_last_tid_location != tidnum)
1103 {
1104 elog(ERROR, "unexpected bm_last_tid_location " INT64_FORMAT
1105 " found for bitmap block %d in bitmap index %u (relfilenode %u/%u/%u);"
1106 " expected tid " INT64_FORMAT,
1107 bitmapOpaque->bm_last_tid_location, nextBlockNo, RelationGetRelid(rel),
1108 rel->rd_node.spcNode, rel->rd_node.dbNode, rel->rd_node.relNode, tidnum);
1109 }
1110
1111 nextBlockNo = bitmapOpaque->bm_bitmap_next;
1112
1113 _bitmap_relbuf(bitmapBuffer);
1114 }
1115}
1116
1117/*
1118 * mergewords() -- merge last two bitmap words based on the HRL compression

Callers 1

updatesetbitFunction · 0.85

Calls 3

_bitmap_getbufFunction · 0.85
IS_FILL_WORDFunction · 0.85
_bitmap_relbufFunction · 0.85

Tested by

no test coverage detected