40 char *end = from +
len;
66 itemsizes[
i] = itemsz;
77 elog(
PANIC,
"_bt_restore_page: cannot add item to page");
211 postingoff = *((
uint16 *) datapos);
212 datapos +=
sizeof(
uint16);
213 datalen -=
sizeof(
uint16);
219 Assert(isleaf && postingoff > 0);
230 elog(
PANIC,
"failed to add posting split new item");
255 bool isleaf = (xlrec->
level == 0);
335 datapos += newitemsz;
336 datalen -= newitemsz;
362 datapos += left_hikeysz;
363 datalen -= left_hikeysz;
373 elog(
ERROR,
"failed to add high key to left page after split");
383 if (off == replacepostingoff)
390 elog(
ERROR,
"failed to add new posting list item to left page after split");
396 else if (newitemonleft && off == xlrec->
newitemoff)
400 elog(
ERROR,
"failed to add new item to left page after split");
409 elog(
ERROR,
"failed to add old item to left page after split");
414 if (newitemonleft && off == xlrec->
newitemoff)
418 elog(
ERROR,
"failed to add new item to left page after split");
436 if (spagenumber !=
P_NONE)
483 state->deduplicate =
true;
484 state->nmaxitems = 0;
489 state->basetupsize = 0;
493 state->phystupsize = 0;
494 state->nintervals = 0;
508 elog(
ERROR,
"deduplication failed to add highkey");
512 for (offnum = minoff;
519 if (offnum == minoff)
526 elog(
ERROR,
"deduplication failed to add heap tid to pending posting list");
565 for (
int i = 0;
i < nupdated;
i++)
573 vacposting->
itup = origtuple;
585 elog(
PANIC,
"failed to update partially dead item");
789 elog(
ERROR,
"could not add dummy high key to half-dead page");
815 level = xlrec->
level;
816 isleaf = (level == 0);
924 elog(
ERROR,
"could not add dummy high key to half-dead page");
956 if (xlrec->
level == 0)
960 if (xlrec->
level > 0)
1066 elog(
PANIC,
"btree_redo: unknown op code %u", info);
1076 "Btree recovery temporary context",
static bool BlockNumberIsValid(BlockNumber blockNumber)
void mask_lp_flags(Page page)
void mask_page_lsn_and_checksum(Page page)
void mask_unused_space(Page page)
void mask_page_hint_bits(Page page)
BlockNumber BufferGetBlockNumber(Buffer buffer)
void UnlockReleaseBuffer(Buffer buffer)
void MarkBufferDirty(Buffer buffer)
static Page BufferGetPage(Buffer buffer)
static Size BufferGetPageSize(Buffer buffer)
static bool BufferIsValid(Buffer bufnum)
void PageRestoreTempPage(Page tempPage, Page oldPage)
void PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems)
Page PageGetTempPageCopySpecial(Page page)
bool PageIndexTupleOverwrite(Page page, OffsetNumber offnum, Item newtup, Size newsize)
void PageIndexTupleDelete(Page page, OffsetNumber offnum)
PageHeaderData * PageHeader
static Item PageGetItem(Page page, ItemId itemId)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static void PageSetLSN(Page page, XLogRecPtr lsn)
static OffsetNumber PageGetMaxOffsetNumber(Page page)
#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap)
#define Assert(condition)
#define MemSet(start, val, len)
IndexTuple CopyIndexTuple(IndexTuple source)
#define ItemIdGetLength(itemId)
IndexTupleData * IndexTuple
#define IndexTupleSize(itup)
struct IndexTupleData IndexTupleData
#define MaxIndexTuplesPerPage
void MemoryContextReset(MemoryContext context)
void pfree(void *pointer)
MemoryContext CurrentMemoryContext
void MemoryContextDelete(MemoryContext context)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
IndexTuple _bt_swap_posting(IndexTuple newitem, IndexTuple oposting, int postingoff)
void _bt_update_posting(BTVacuumPosting vacposting)
bool _bt_dedup_save_htid(BTDedupState state, IndexTuple itup)
void _bt_dedup_start_pending(BTDedupState state, IndexTuple base, OffsetNumber baseoff)
Size _bt_dedup_finish_pending(Page newpage, BTDedupState state)
void _bt_pageinit(Page page, Size size)
#define P_HAS_GARBAGE(opaque)
static void BTreeTupleSetTopParent(IndexTuple leafhikey, BlockNumber blkno)
#define BTPageGetOpaque(page)
static void BTreeTupleSetDownLink(IndexTuple pivot, BlockNumber blkno)
#define P_FIRSTDATAKEY(opaque)
#define P_RIGHTMOST(opaque)
#define BTMaxItemSize(page)
#define P_INCOMPLETE_SPLIT(opaque)
#define BTP_INCOMPLETE_SPLIT
static BlockNumber BTreeTupleGetDownLink(IndexTuple pivot)
static void BTPageSetDeleted(Page page, FullTransactionId safexid)
#define BTREE_NOVAC_VERSION
BTDedupStateData * BTDedupState
static void btree_xlog_delete(XLogReaderState *record)
void btree_redo(XLogReaderState *record)
static void _bt_restore_meta(XLogReaderState *record, uint8 block_id)
void btree_xlog_cleanup(void)
static void btree_xlog_newroot(XLogReaderState *record)
static void btree_xlog_updates(Page page, OffsetNumber *updatedoffsets, xl_btree_update *updates, int nupdated)
static void btree_xlog_dedup(XLogReaderState *record)
static void btree_xlog_insert(bool isleaf, bool ismeta, bool posting, XLogReaderState *record)
static void btree_xlog_split(bool newitemonleft, XLogReaderState *record)
static void btree_xlog_reuse_page(XLogReaderState *record)
static void _bt_clear_incomplete_split(XLogReaderState *record, uint8 block_id)
static void btree_xlog_mark_page_halfdead(uint8 info, XLogReaderState *record)
static void _bt_restore_page(Page page, char *from, int len)
void btree_mask(char *pagedata, BlockNumber blkno)
static MemoryContext opCtx
void btree_xlog_startup(void)
static void btree_xlog_vacuum(XLogReaderState *record)
static void btree_xlog_unlink_page(uint8 info, XLogReaderState *record)
#define XLOG_BTREE_META_CLEANUP
#define XLOG_BTREE_INSERT_POST
#define SizeOfBtreeUpdate
#define XLOG_BTREE_VACUUM
#define XLOG_BTREE_SPLIT_R
#define XLOG_BTREE_INSERT_LEAF
#define XLOG_BTREE_INSERT_UPPER
#define XLOG_BTREE_UNLINK_PAGE
#define XLOG_BTREE_UNLINK_PAGE_META
#define XLOG_BTREE_INSERT_META
#define XLOG_BTREE_MARK_PAGE_HALFDEAD
#define XLOG_BTREE_REUSE_PAGE
#define XLOG_BTREE_SPLIT_L
#define XLOG_BTREE_NEWROOT
#define XLOG_BTREE_DELETE
#define InvalidOffsetNumber
#define OffsetNumberNext(offsetNumber)
#define OffsetNumberPrev(offsetNumber)
MemoryContextSwitchTo(old_ctx)
void ResolveRecoveryConflictWithSnapshotFullXid(FullTransactionId snapshotConflictHorizon, bool isCatalogRel, RelFileLocator locator)
void ResolveRecoveryConflictWithSnapshot(TransactionId snapshotConflictHorizon, bool isCatalogRel, RelFileLocator locator)
uint32 btm_last_cleanup_num_delpages
float8 btm_last_cleanup_num_heap_tuples
uint16 deletetids[FLEXIBLE_ARRAY_MEMBER]
OffsetNumber updatedoffset
TransactionId snapshotConflictHorizon
FullTransactionId snapshotConflictHorizon
OffsetNumber firstrightoff
FullTransactionId safexid
BlockNumber leaftopparent
bool XLogRecGetBlockTagExtended(XLogReaderState *record, uint8 block_id, RelFileLocator *rlocator, ForkNumber *forknum, BlockNumber *blknum, Buffer *prefetch_buffer)
void XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id, RelFileLocator *rlocator, ForkNumber *forknum, BlockNumber *blknum)
char * XLogRecGetBlockData(XLogReaderState *record, uint8 block_id, Size *len)
#define XLogRecGetInfo(decoder)
#define XLogRecGetData(decoder)
#define XLogRecHasBlockRef(decoder, block_id)
XLogRedoAction XLogReadBufferForRedo(XLogReaderState *record, uint8 block_id, Buffer *buf)
Buffer XLogInitBufferForRedo(XLogReaderState *record, uint8 block_id)
XLogRedoAction XLogReadBufferForRedoExtended(XLogReaderState *record, uint8 block_id, ReadBufferMode mode, bool get_cleanup_lock, Buffer *buf)