PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/detoast.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/heaptoast.h"
#include "access/multixact.h"
#include "access/toast_internals.h"
#include "access/visibilitymap.h"
#include "catalog/pg_am.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "storage/bufmgr.h"
#include "storage/procarray.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
Go to the source code of this file.
Data Structures | |
struct | HeapCheckContext |
Macros | |
#define | HEAPCHECK_RELATION_COLS 4 |
Typedefs | |
typedef enum XidBoundsViolation | XidBoundsViolation |
typedef enum XidCommitStatus | XidCommitStatus |
typedef enum SkipPages | SkipPages |
typedef struct HeapCheckContext | HeapCheckContext |
Enumerations | |
enum | XidBoundsViolation { XID_INVALID, XID_IN_FUTURE, XID_PRECEDES_CLUSTERMIN, XID_PRECEDES_RELMIN, XID_BOUNDS_OK } |
enum | XidCommitStatus { XID_COMMITTED, XID_IN_PROGRESS, XID_ABORTED } |
enum | SkipPages { SKIP_PAGES_ALL_FROZEN, SKIP_PAGES_ALL_VISIBLE, SKIP_PAGES_NONE } |
#define HEAPCHECK_RELATION_COLS 4 |
Definition at line 31 of file verify_heapam.c.
Referenced by report_corruption(), and verify_heapam_tupdesc().
typedef struct HeapCheckContext HeapCheckContext |
typedef enum XidBoundsViolation XidBoundsViolation |
typedef enum XidCommitStatus XidCommitStatus |
enum SkipPages |
Enumerator | |
---|---|
SKIP_PAGES_ALL_FROZEN | |
SKIP_PAGES_ALL_VISIBLE | |
SKIP_PAGES_NONE |
Definition at line 53 of file verify_heapam.c.
enum XidBoundsViolation |
Enumerator | |
---|---|
XID_INVALID | |
XID_IN_FUTURE | |
XID_PRECEDES_CLUSTERMIN | |
XID_PRECEDES_RELMIN | |
XID_BOUNDS_OK |
Definition at line 37 of file verify_heapam.c.
enum XidCommitStatus |
Enumerator | |
---|---|
XID_COMMITTED | |
XID_IN_PROGRESS | |
XID_ABORTED |
Definition at line 46 of file verify_heapam.c.
|
static |
Definition at line 1342 of file verify_heapam.c.
References MultiXactIdPrecedes(), MultiXactIdPrecedesOrEquals(), HeapCheckContext::next_mxact, HeapCheckContext::oldest_mxact, HeapCheckContext::relminmxid, TransactionIdIsValid, XID_BOUNDS_OK, XID_IN_FUTURE, XID_INVALID, XID_PRECEDES_CLUSTERMIN, and XID_PRECEDES_RELMIN.
Referenced by check_mxid_valid_in_rel().
|
static |
Definition at line 1364 of file verify_heapam.c.
References check_mxid_in_range(), update_cached_mxid_range(), and XID_BOUNDS_OK.
Referenced by check_tuple().
|
static |
Definition at line 829 of file verify_heapam.c.
References HeapCheckContext::attrsize, HeapCheckContext::chunkno, DatumGetInt32, DatumGetPointer, HeapCheckContext::endchunk, fastgetattr, header(), psprintf(), pstrdup(), RelationData::rd_att, report_corruption(), TOAST_MAX_CHUNK_SIZE, HeapCheckContext::toast_rel, HeapCheckContext::totalchunks, VARATT_IS_EXTENDED, VARATT_IS_SHORT, VARHDRSZ, VARHDRSZ_SHORT, VARSIZE, and VARSIZE_SHORT.
Referenced by check_tuple_attribute().
|
static |
Definition at line 1121 of file verify_heapam.c.
References HeapCheckContext::attnum, check_mxid_valid_in_rel(), check_tuple_attribute(), check_tuple_header_and_visibilty(), EpochFromFullTransactionId, fatal, get_xid_status(), HEAP_XMAX_IS_MULTI, HeapTupleHeaderGetRawXmax, HeapTupleHeaderGetXmin, HeapCheckContext::natts, HeapCheckContext::next_fxid, HeapCheckContext::next_mxact, HeapCheckContext::offset, HeapCheckContext::oldest_fxid, HeapCheckContext::oldest_mxact, psprintf(), pstrdup(), HeapCheckContext::rel, RelationGetDescr, HeapCheckContext::relfrozenfxid, HeapCheckContext::relminmxid, report_corruption(), HeapTupleHeaderData::t_infomask, HeapCheckContext::tuphdr, XID_BOUNDS_OK, XID_IN_FUTURE, XID_INVALID, XID_PRECEDES_CLUSTERMIN, XID_PRECEDES_RELMIN, and XidFromFullTransactionId.
Referenced by verify_heapam().
|
static |
Definition at line 926 of file verify_heapam.c.
References att_addlength_pointer, att_align_nominal, att_align_pointer, att_isnull, HeapCheckContext::attnum, HeapCheckContext::attrsize, BTEqualStrategyNumber, check_toast_tuple(), HeapCheckContext::chunkno, DatumGetPointer, HeapCheckContext::endchunk, fetchatt, ForwardScanDirection, HEAP_HASEXTERNAL, HEAP_HASNULL, init_toast_snapshot(), HeapCheckContext::lp_len, ObjectIdGetDatum, HeapCheckContext::offset, psprintf(), RelationData::rd_rel, HeapCheckContext::rel, RelationGetDescr, report_corruption(), ScanKeyInit(), systable_beginscan_ordered(), systable_endscan_ordered(), systable_getnext_ordered(), HeapTupleHeaderData::t_bits, HeapTupleHeaderData::t_hoff, HeapTupleHeaderData::t_infomask, TOAST_MAX_CHUNK_SIZE, HeapCheckContext::toast_rel, HeapCheckContext::totalchunks, HeapCheckContext::tuphdr, TupleDescAttr, varatt_external::va_extsize, varatt_external::va_valueid, HeapCheckContext::valid_toast_index, VARATT_EXTERNAL_GET_POINTER, VARATT_IS_EXTERNAL, VARTAG_EXTERNAL, and VARTAG_ONDISK.
Referenced by check_tuple().
|
static |
Definition at line 598 of file verify_heapam.c.
References BITMAPLEN, EpochFromFullTransactionId, get_xid_status(), HEAP_HASNULL, HEAP_MOVED_IN, HEAP_MOVED_OFF, HEAP_XMAX_COMMITTED, HEAP_XMAX_INVALID, HEAP_XMAX_IS_LOCKED_ONLY, HEAP_XMAX_IS_MULTI, HeapTupleGetUpdateXid(), HeapTupleHeaderGetRawXmin, HeapTupleHeaderGetXvac, HeapTupleHeaderXminCommitted, HeapTupleHeaderXminInvalid, HeapCheckContext::lp_len, MAXALIGN, HeapCheckContext::natts, HeapCheckContext::next_fxid, HeapCheckContext::oldest_fxid, psprintf(), pstrdup(), HeapCheckContext::relfrozenfxid, report_corruption(), SizeofHeapTupleHeader, status(), HeapTupleHeaderData::t_hoff, HeapTupleHeaderData::t_infomask, HeapCheckContext::tuphdr, XID_ABORTED, XID_BOUNDS_OK, XID_COMMITTED, XID_IN_FUTURE, XID_IN_PROGRESS, XID_INVALID, XID_PRECEDES_CLUSTERMIN, XID_PRECEDES_RELMIN, and XidFromFullTransactionId.
Referenced by check_tuple().
|
static |
Definition at line 1288 of file verify_heapam.c.
References epoch, EpochFromFullTransactionId, FullTransactionIdFromEpochAndXid(), HeapCheckContext::next_fxid, HeapCheckContext::next_xid, and TransactionIdIsNormal.
Referenced by get_xid_status(), update_cached_xid_range(), and verify_heapam().
|
inlinestatic |
Definition at line 1331 of file verify_heapam.c.
References FullTransactionIdPrecedes, FullTransactionIdPrecedesOrEquals, HeapCheckContext::next_fxid, and HeapCheckContext::oldest_fxid.
Referenced by get_xid_status().
|
static |
Definition at line 1396 of file verify_heapam.c.
References BootstrapTransactionId, HeapCheckContext::cached_status, HeapCheckContext::cached_xid, FrozenTransactionId, FullTransactionIdFromXidAndCtx(), FullTransactionIdPrecedes, FullTransactionIdPrecedesOrEquals, fxid_in_cached_range(), LW_SHARED, LWLockAcquire(), LWLockRelease(), HeapCheckContext::next_fxid, HeapCheckContext::oldest_fxid, VariableCacheData::oldestClogXid, HeapCheckContext::relfrozenfxid, ShmemVariableCache, status(), TransactionIdDidAbort(), TransactionIdDidCommit(), TransactionIdIsCurrentTransactionId(), TransactionIdIsValid, update_cached_xid_range(), XID_ABORTED, XID_BOUNDS_OK, XID_COMMITTED, XID_IN_FUTURE, XID_IN_PROGRESS, XID_INVALID, XID_PRECEDES_CLUSTERMIN, and XID_PRECEDES_RELMIN.
Referenced by check_tuple(), and check_tuple_header_and_visibilty().
PG_FUNCTION_INFO_V1 | ( | verify_heapam | ) |
|
static |
Definition at line 508 of file verify_heapam.c.
References HeapCheckContext::attnum, HeapCheckContext::blkno, CStringGetTextDatum, heap_form_tuple(), HEAPCHECK_RELATION_COLS, Int32GetDatum, Int64GetDatum(), HeapCheckContext::is_corrupt, MemSet, HeapCheckContext::offnum, pfree(), HeapCheckContext::tupdesc, tuplestore_puttuple(), HeapCheckContext::tupstore, and values.
Referenced by check_toast_tuple(), check_tuple(), check_tuple_attribute(), check_tuple_header_and_visibilty(), and verify_heapam().
|
static |
Definition at line 485 of file verify_heapam.c.
References ereport, errcode(), errmsg(), ERROR, RelationData::rd_rel, and RelationGetRelationName.
Referenced by verify_heapam().
|
static |
Definition at line 1321 of file verify_heapam.c.
References HeapCheckContext::next_mxact, HeapCheckContext::oldest_mxact, and ReadMultiXactIdRange().
Referenced by check_mxid_valid_in_rel(), and verify_heapam().
|
static |
Definition at line 1304 of file verify_heapam.c.
References FullTransactionIdFromXidAndCtx(), LW_SHARED, LWLockAcquire(), LWLockRelease(), HeapCheckContext::next_fxid, HeapCheckContext::next_xid, VariableCacheData::nextXid, HeapCheckContext::oldest_fxid, HeapCheckContext::oldest_xid, VariableCacheData::oldestXid, ShmemVariableCache, and XidFromFullTransactionId.
Referenced by get_xid_status(), and verify_heapam().
Datum verify_heapam | ( | PG_FUNCTION_ARGS | ) |
Definition at line 186 of file verify_heapam.c.
References AccessShareLock, ReturnSetInfo::allowedModes, BAS_BULKREAD, BUFFER_LOCK_SHARE, BufferGetPage, check_tuple(), ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, ereport, errcode(), errhint(), errmsg(), ERROR, fb(), FirstOffsetNumber, FullTransactionIdFromXidAndCtx(), GetAccessStrategy(), HeapTupleHeaderGetNatts, InvalidBuffer, InvalidTransactionId, IsA, ItemIdGetLength, ItemIdGetOffset, ItemIdGetRedirect, ItemIdIsDead, ItemIdIsRedirected, ItemIdIsUsed, LockBuffer(), MAIN_FORKNUM, MAXALIGN, MemoryContextSwitchTo(), HeapCheckContext::offset, OffsetNumberNext, PageGetItem, PageGetItemId, PageGetMaxOffsetNumber, PG_ARGISNULL, PG_GETARG_BOOL, PG_GETARG_INT64, PG_GETARG_OID, PG_GETARG_TEXT_PP, PG_RETURN_NULL, pg_strcasecmp(), psprintf(), RBM_NORMAL, ReadBufferExtended(), relation_close(), relation_open(), RelationGetNumberOfBlocks, ReleaseBuffer(), report_corruption(), ReturnSetInfo::returnMode, sanity_check_relation(), ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, SFRM_Materialize_Random, SizeofHeapTupleHeader, skip, SKIP_PAGES_ALL_FROZEN, SKIP_PAGES_ALL_VISIBLE, SKIP_PAGES_NONE, table_close(), table_open(), text_to_cstring(), toast_close_indexes(), toast_open_indexes(), TransactionIdIsNormal, tuplestore_begin_heap(), UnlockReleaseBuffer(), update_cached_mxid_range(), update_cached_xid_range(), verify_heapam_tupdesc(), VISIBILITYMAP_ALL_FROZEN, VISIBILITYMAP_ALL_VISIBLE, visibilitymap_get_status(), and work_mem.
|
static |
Definition at line 542 of file verify_heapam.c.
References Assert, BlessTupleDesc(), CreateTemplateTupleDesc(), HEAPCHECK_RELATION_COLS, HeapCheckContext::tupdesc, and TupleDescInitEntry().
Referenced by verify_heapam().