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

Function _bitmap_log_updatewords

src/backend/access/bitmap/bitmaputil.c:1165–1253  ·  view source on GitHub ↗

* _bitmap_log_updatewords() -- log updating bitmap words in one or * two bitmap pages. * * If nextBuffer is Invalid, we only update one page. * */

Source from the content-addressed store, hash-verified

1163 *
1164 */
1165void
1166_bitmap_log_updatewords(Relation rel,
1167 Buffer lovBuffer, OffsetNumber lovOffset,
1168 Buffer firstBuffer, Buffer secondBuffer,
1169 bool new_lastpage)
1170{
1171 Page firstPage = NULL;
1172 Page secondPage = NULL;
1173 BMBitmap firstBitmap;
1174 BMBitmap secondBitmap;
1175 BMBitmapOpaque firstOpaque;
1176 BMBitmapOpaque secondOpaque;
1177
1178 xl_bm_updatewords xlBitmapWords;
1179 XLogRecPtr recptr;
1180
1181 firstPage = BufferGetPage(firstBuffer);
1182 firstBitmap = (BMBitmap) PageGetContentsMaxAligned(firstPage);
1183 firstOpaque = (BMBitmapOpaque)PageGetSpecialPointer(firstPage);
1184 xlBitmapWords.bm_two_pages = false;
1185 xlBitmapWords.bm_first_blkno = BufferGetBlockNumber(firstBuffer);
1186 memcpy(&xlBitmapWords.bm_first_cwords,
1187 firstBitmap->cwords,
1188 BM_NUM_OF_HRL_WORDS_PER_PAGE * sizeof(BM_HRL_WORD));
1189 memcpy(&xlBitmapWords.bm_first_hwords,
1190 firstBitmap->hwords,
1191 BM_NUM_OF_HEADER_WORDS * sizeof(BM_HRL_WORD));
1192 xlBitmapWords.bm_first_last_tid = firstOpaque->bm_last_tid_location;
1193 xlBitmapWords.bm_first_num_cwords =
1194 firstOpaque->bm_hrl_words_used;
1195 xlBitmapWords.bm_next_blkno = firstOpaque->bm_bitmap_next;
1196
1197 if (BufferIsValid(secondBuffer))
1198 {
1199 secondPage = BufferGetPage(secondBuffer);
1200 secondBitmap = (BMBitmap) PageGetContentsMaxAligned(secondPage);
1201 secondOpaque = (BMBitmapOpaque)PageGetSpecialPointer(secondPage);
1202
1203 xlBitmapWords.bm_two_pages = true;
1204 xlBitmapWords.bm_second_blkno = BufferGetBlockNumber(secondBuffer);
1205
1206 memcpy(&xlBitmapWords.bm_second_cwords,
1207 secondBitmap->cwords,
1208 BM_NUM_OF_HRL_WORDS_PER_PAGE * sizeof(BM_HRL_WORD));
1209 memcpy(&xlBitmapWords.bm_second_hwords,
1210 secondBitmap->hwords,
1211 BM_NUM_OF_HEADER_WORDS * sizeof(BM_HRL_WORD));
1212 xlBitmapWords.bm_second_last_tid = secondOpaque->bm_last_tid_location;
1213 xlBitmapWords.bm_second_num_cwords =
1214 secondOpaque->bm_hrl_words_used;
1215 xlBitmapWords.bm_next_blkno = secondOpaque->bm_bitmap_next;
1216 }
1217
1218 xlBitmapWords.bm_node = rel->rd_node;
1219 xlBitmapWords.bm_lov_blkno = BufferGetBlockNumber(lovBuffer);
1220 xlBitmapWords.bm_lov_offset = lovOffset;
1221 xlBitmapWords.bm_new_lastpage = new_lastpage;
1222

Callers 1

updatesetbit_inpageFunction · 0.85

Calls 5

BufferGetBlockNumberFunction · 0.85
XLogBeginInsertFunction · 0.85
XLogRegisterDataFunction · 0.85
XLogRegisterBufferFunction · 0.85
XLogInsertFunction · 0.85

Tested by

no test coverage detected