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

Function ginRedoInsert

src/backend/access/gin/ginxlog.c:346–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346static void
347ginRedoInsert(XLogReaderState *record)
348{
349 XLogRecPtr lsn = record->EndRecPtr;
350 ginxlogInsert *data = (ginxlogInsert *) XLogRecGetData(record);
351 Buffer buffer;
352#ifdef NOT_USED
353 BlockNumber leftChildBlkno = InvalidBlockNumber;
354#endif
355 BlockNumber rightChildBlkno = InvalidBlockNumber;
356 bool isLeaf = (data->flags & GIN_INSERT_ISLEAF) != 0;
357
358 /*
359 * First clear incomplete-split flag on child page if this finishes a
360 * split.
361 */
362 if (!isLeaf)
363 {
364 char *payload = XLogRecGetData(record) + sizeof(ginxlogInsert);
365
366#ifdef NOT_USED
367 leftChildBlkno = BlockIdGetBlockNumber((BlockId) payload);
368#endif
369 payload += sizeof(BlockIdData);
370 rightChildBlkno = BlockIdGetBlockNumber((BlockId) payload);
371 payload += sizeof(BlockIdData);
372
373 ginRedoClearIncompleteSplit(record, 1);
374 }
375
376 if (XLogReadBufferForRedo(record, 0, &buffer) == BLK_NEEDS_REDO)
377 {
378 Page page = BufferGetPage(buffer);
379 Size len;
380 char *payload = XLogRecGetBlockData(record, 0, &len);
381
382 /* How to insert the payload is tree-type specific */
383 if (data->flags & GIN_INSERT_ISDATA)
384 {
385 Assert(GinPageIsData(page));
386 ginRedoInsertData(buffer, isLeaf, rightChildBlkno, payload);
387 }
388 else
389 {
390 Assert(!GinPageIsData(page));
391 ginRedoInsertEntry(buffer, isLeaf, rightChildBlkno, payload);
392 }
393
394 PageSetLSN(page, lsn);
395 MarkBufferDirty(buffer);
396 }
397 if (BufferIsValid(buffer))
398 UnlockReleaseBuffer(buffer);
399}
400
401static void
402ginRedoSplit(XLogReaderState *record)

Callers 1

gin_redoFunction · 0.85

Calls 7

XLogReadBufferForRedoFunction · 0.85
XLogRecGetBlockDataFunction · 0.85
ginRedoInsertDataFunction · 0.85
ginRedoInsertEntryFunction · 0.85
MarkBufferDirtyFunction · 0.85
UnlockReleaseBufferFunction · 0.85

Tested by

no test coverage detected