87 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
88 errmsg(
"invalid block number")));
91 MemSet(nulls, 0,
sizeof(nulls));
129 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
130 errmsg(
"invalid block number")));
133 MemSet(nulls, 0,
sizeof(nulls));
194 MemSet(nulls, 0,
sizeof(nulls));
239 MemSet(nulls, 0,
sizeof(nulls));
265 int64 all_visible = 0;
266 int64 all_frozen = 0;
278 for (blkno = 0; blkno < nblocks; ++blkno)
303 MemSet(nulls, 0,
sizeof(nulls));
496 info->
count = nblocks;
498 for (blkno = 0; blkno < nblocks; ++blkno)
508 info->
bits[blkno] |= (1 << 0);
510 info->
bits[blkno] |= (1 << 1);
528 info->
bits[blkno] |= (1 << 2);
591 for (blkno = 0; blkno < nblocks; ++blkno)
593 bool check_frozen =
false;
594 bool check_visible =
false;
607 check_visible =
true;
608 if (!check_visible && !check_frozen)
624 check_frozen =
false;
626 check_visible =
false;
627 if (!check_visible && !check_frozen)
691 OldestXmin = RecomputedOldestXmin;
780 if (!RELKIND_HAS_TABLE_AM(rel->
rd_rel->relkind))
782 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
783 errmsg(
"relation \"%s\" is of wrong relation kind",
#define InvalidBlockNumber
#define BlockNumberIsValid(blockNumber)
static Datum values[MAXATTR]
void ReleaseBuffer(Buffer buffer)
void UnlockReleaseBuffer(Buffer buffer)
void LockBuffer(Buffer buffer, int mode)
Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode, BufferAccessStrategy strategy)
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
#define BUFFER_LOCK_SHARE
#define RelationGetNumberOfBlocks(reln)
#define BufferGetPage(buffer)
#define PageIsAllVisible(page)
#define PageGetMaxOffsetNumber(page)
#define PageGetItemId(page, offsetNumber)
#define PageGetItem(page, itemId)
#define offsetof(type, field)
#define FLEXIBLE_ARRAY_MEMBER
#define MemSet(start, val, len)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
Datum Int64GetDatum(int64 X)
#define PG_GETARG_INT64(n)
#define PG_RETURN_DATUM(x)
BufferAccessStrategy GetAccessStrategy(BufferAccessStrategyType btype)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define HeapTupleGetDatum(tuple)
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
#define SRF_RETURN_DONE(_funcctx)
bool heap_tuple_needs_eventual_freeze(HeapTupleHeader tuple)
HTSV_Result HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin, Buffer buffer)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
HeapTupleHeaderData * HeapTupleHeader
#define HeapTupleHeaderGetXmin(tup)
#define ItemIdGetLength(itemId)
#define ItemIdIsDead(itemId)
#define ItemIdIsUsed(itemId)
#define ItemIdIsRedirected(itemId)
#define ItemPointerSet(pointer, blockNumber, offNum)
Assert(fmt[strlen(fmt) - 1] !='\n')
#define AccessExclusiveLock
void * palloc0(Size size)
void * repalloc(void *pointer, Size size)
#define CHECK_FOR_INTERRUPTS()
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
int errdetail_relkind_not_supported(char relkind)
static corrupt_items * collect_corrupt_items(Oid relid, bool all_visible, bool all_frozen)
Datum pg_visibility_map_summary(PG_FUNCTION_ARGS)
Datum pg_visibility_rel(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(pg_visibility_map)
struct corrupt_items corrupt_items
static TupleDesc pg_visibility_tupdesc(bool include_blkno, bool include_pd)
static void check_relation_relkind(Relation rel)
static void record_corrupt_item(corrupt_items *items, ItemPointer tid)
Datum pg_visibility_map(PG_FUNCTION_ARGS)
static vbits * collect_visibility_data(Oid relid, bool include_pd)
Datum pg_visibility_map_rel(PG_FUNCTION_ARGS)
Datum pg_check_visible(PG_FUNCTION_ARGS)
Datum pg_check_frozen(PG_FUNCTION_ARGS)
Datum pg_visibility(PG_FUNCTION_ARGS)
static bool tuple_all_visible(HeapTuple tup, TransactionId OldestXmin, Buffer buffer)
Datum pg_truncate_visibility_map(PG_FUNCTION_ARGS)
#define PointerGetDatum(X)
TransactionId GetOldestNonRemovableTransactionId(Relation rel)
static SMgrRelation RelationGetSmgr(Relation rel)
#define RelationGetRelationName(relation)
#define RelationNeedsWAL(relation)
void smgrtruncate(SMgrRelation reln, ForkNumber *forknum, int nforks, BlockNumber *nblocks)
void relation_close(Relation relation, LOCKMODE lockmode)
Relation relation_open(Oid relationId, LOCKMODE lockmode)
#define XLOG_SMGR_TRUNCATE
MemoryContext multi_call_memory_ctx
BlockNumber smgr_cached_nblocks[MAX_FORKNUM+1]
uint8 bits[FLEXIBLE_ARRAY_MEMBER]
bool TransactionIdPrecedes(TransactionId id1, TransactionId id2)
#define InvalidTransactionId
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
uint8 visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *buf)
BlockNumber visibilitymap_prepare_truncate(Relation rel, BlockNumber nheapblocks)
#define VM_ALL_VISIBLE(r, b, v)
#define VM_ALL_FROZEN(r, b, v)
#define VISIBILITYMAP_ALL_FROZEN
#define VISIBILITYMAP_ALL_VISIBLE
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
void XLogBeginInsert(void)
void XLogRegisterData(char *data, int len)
#define XLR_SPECIAL_REL_UPDATE