mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
pgindent run for 9.4
This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* user defined attribute numbers start at 1. -ay 2/95
|
||||
* user defined attribute numbers start at 1. -ay 2/95
|
||||
*/
|
||||
typedef int16 AttrNumber;
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ typedef struct SysScanDescData *SysScanDesc;
|
||||
* blocking to see if a conflicting transaction commits.
|
||||
*
|
||||
* For deferrable unique constraints, UNIQUE_CHECK_PARTIAL is specified at
|
||||
* insertion time. The index AM should test if the tuple is unique, but
|
||||
* insertion time. The index AM should test if the tuple is unique, but
|
||||
* should not throw error, block, or prevent the insertion if the tuple
|
||||
* appears not to be unique. We'll recheck later when it is time for the
|
||||
* constraint to be enforced. The AM must return true if the tuple is
|
||||
@@ -100,7 +100,7 @@ typedef struct SysScanDescData *SysScanDesc;
|
||||
*
|
||||
* When it is time to recheck the deferred constraint, a pseudo-insertion
|
||||
* call is made with UNIQUE_CHECK_EXISTING. The tuple is already in the
|
||||
* index in this case, so it should not be inserted again. Rather, just
|
||||
* index in this case, so it should not be inserted again. Rather, just
|
||||
* check for conflicting live tuples (possibly blocking).
|
||||
*/
|
||||
typedef enum IndexUniqueCheck
|
||||
|
||||
@@ -55,10 +55,10 @@ typedef struct GinStatsData
|
||||
*/
|
||||
typedef char GinTernaryValue;
|
||||
|
||||
#define GIN_FALSE 0 /* item is not present / does not match */
|
||||
#define GIN_TRUE 1 /* item is present / matches */
|
||||
#define GIN_MAYBE 2 /* don't know if item is present / don't know if
|
||||
* matches */
|
||||
#define GIN_FALSE 0 /* item is not present / does not match */
|
||||
#define GIN_TRUE 1 /* item is present / matches */
|
||||
#define GIN_MAYBE 2 /* don't know if item is present / don't know
|
||||
* if matches */
|
||||
|
||||
#define DatumGetGinTernaryValue(X) ((GinTernaryValue)(X))
|
||||
#define GinTernaryValueGetDatum(X) ((Datum)(X))
|
||||
|
||||
@@ -32,8 +32,9 @@
|
||||
typedef struct GinPageOpaqueData
|
||||
{
|
||||
BlockNumber rightlink; /* next page if any */
|
||||
OffsetNumber maxoff; /* number of PostingItems on GIN_DATA & ~GIN_LEAF page.
|
||||
* On GIN_LIST page, number of heap tuples. */
|
||||
OffsetNumber maxoff; /* number of PostingItems on GIN_DATA &
|
||||
* ~GIN_LEAF page. On GIN_LIST page, number of
|
||||
* heap tuples. */
|
||||
uint16 flags; /* see bit definitions below */
|
||||
} GinPageOpaqueData;
|
||||
|
||||
@@ -45,7 +46,8 @@ typedef GinPageOpaqueData *GinPageOpaque;
|
||||
#define GIN_META (1 << 3)
|
||||
#define GIN_LIST (1 << 4)
|
||||
#define GIN_LIST_FULLROW (1 << 5) /* makes sense only on GIN_LIST page */
|
||||
#define GIN_INCOMPLETE_SPLIT (1 << 6) /* page was split, but parent not updated */
|
||||
#define GIN_INCOMPLETE_SPLIT (1 << 6) /* page was split, but parent not
|
||||
* updated */
|
||||
#define GIN_COMPRESSED (1 << 7)
|
||||
|
||||
/* Page numbers of fixed-location pages */
|
||||
@@ -119,8 +121,8 @@ typedef struct GinMetaPageData
|
||||
#define GinPageSetList(page) ( GinPageGetOpaque(page)->flags |= GIN_LIST )
|
||||
#define GinPageHasFullRow(page) ( GinPageGetOpaque(page)->flags & GIN_LIST_FULLROW )
|
||||
#define GinPageSetFullRow(page) ( GinPageGetOpaque(page)->flags |= GIN_LIST_FULLROW )
|
||||
#define GinPageIsCompressed(page) ( GinPageGetOpaque(page)->flags & GIN_COMPRESSED )
|
||||
#define GinPageSetCompressed(page) ( GinPageGetOpaque(page)->flags |= GIN_COMPRESSED )
|
||||
#define GinPageIsCompressed(page) ( GinPageGetOpaque(page)->flags & GIN_COMPRESSED )
|
||||
#define GinPageSetCompressed(page) ( GinPageGetOpaque(page)->flags |= GIN_COMPRESSED )
|
||||
|
||||
#define GinPageIsDeleted(page) ( GinPageGetOpaque(page)->flags & GIN_DELETED)
|
||||
#define GinPageSetDeleted(page) ( GinPageGetOpaque(page)->flags |= GIN_DELETED)
|
||||
@@ -371,9 +373,9 @@ typedef struct GinState
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
ItemPointerData first; /* first item in this posting list (unpacked) */
|
||||
uint16 nbytes; /* number of bytes that follow */
|
||||
unsigned char bytes[1]; /* varbyte encoded items (variable length) */
|
||||
ItemPointerData first; /* first item in this posting list (unpacked) */
|
||||
uint16 nbytes; /* number of bytes that follow */
|
||||
unsigned char bytes[1]; /* varbyte encoded items (variable length) */
|
||||
} GinPostingList;
|
||||
|
||||
#define SizeOfGinPostingList(plist) (offsetof(GinPostingList, bytes) + SHORTALIGN((plist)->nbytes) )
|
||||
@@ -404,14 +406,14 @@ typedef struct
|
||||
{
|
||||
RelFileNode node;
|
||||
BlockNumber blkno;
|
||||
uint16 flags; /* GIN_SPLIT_ISLEAF and/or GIN_SPLIT_ISDATA */
|
||||
uint16 flags; /* GIN_SPLIT_ISLEAF and/or GIN_SPLIT_ISDATA */
|
||||
|
||||
/*
|
||||
* FOLLOWS:
|
||||
*
|
||||
* 1. if not leaf page, block numbers of the left and right child pages
|
||||
* whose split this insertion finishes. As BlockIdData[2] (beware of adding
|
||||
* fields before this that would make them not 16-bit aligned)
|
||||
* whose split this insertion finishes. As BlockIdData[2] (beware of
|
||||
* adding fields before this that would make them not 16-bit aligned)
|
||||
*
|
||||
* 2. an ginxlogInsertEntry or ginxlogRecompressDataLeaf struct, depending
|
||||
* on tree type.
|
||||
@@ -426,7 +428,7 @@ typedef struct
|
||||
{
|
||||
OffsetNumber offset;
|
||||
bool isDelete;
|
||||
IndexTupleData tuple; /* variable length */
|
||||
IndexTupleData tuple; /* variable length */
|
||||
} ginxlogInsertEntry;
|
||||
|
||||
|
||||
@@ -444,8 +446,8 @@ typedef struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8 segno; /* segment this action applies to */
|
||||
char type; /* action type (see below) */
|
||||
uint8 segno; /* segment this action applies to */
|
||||
char type; /* action type (see below) */
|
||||
|
||||
/*
|
||||
* Action-specific data follows. For INSERT and REPLACE actions that is a
|
||||
@@ -453,14 +455,14 @@ typedef struct
|
||||
* added, followed by the items themselves as ItemPointers. DELETE actions
|
||||
* have no further data.
|
||||
*/
|
||||
} ginxlogSegmentAction;
|
||||
} ginxlogSegmentAction;
|
||||
|
||||
/* Action types */
|
||||
#define GIN_SEGMENT_UNMODIFIED 0 /* no action (not used in WAL records) */
|
||||
#define GIN_SEGMENT_DELETE 1 /* a whole segment is removed */
|
||||
#define GIN_SEGMENT_INSERT 2 /* a whole segment is added */
|
||||
#define GIN_SEGMENT_REPLACE 3 /* a segment is replaced */
|
||||
#define GIN_SEGMENT_ADDITEMS 4 /* items are added to existing segment */
|
||||
#define GIN_SEGMENT_UNMODIFIED 0 /* no action (not used in WAL records) */
|
||||
#define GIN_SEGMENT_DELETE 1 /* a whole segment is removed */
|
||||
#define GIN_SEGMENT_INSERT 2 /* a whole segment is added */
|
||||
#define GIN_SEGMENT_REPLACE 3 /* a segment is replaced */
|
||||
#define GIN_SEGMENT_ADDITEMS 4 /* items are added to existing segment */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -476,9 +478,10 @@ typedef struct ginxlogSplit
|
||||
RelFileNode node;
|
||||
BlockNumber lblkno;
|
||||
BlockNumber rblkno;
|
||||
BlockNumber rrlink; /* right link, or root's blocknumber if root split */
|
||||
BlockNumber leftChildBlkno; /* valid on a non-leaf split */
|
||||
BlockNumber rightChildBlkno;
|
||||
BlockNumber rrlink; /* right link, or root's blocknumber if root
|
||||
* split */
|
||||
BlockNumber leftChildBlkno; /* valid on a non-leaf split */
|
||||
BlockNumber rightChildBlkno;
|
||||
uint16 flags;
|
||||
|
||||
/* follows: one of the following structs */
|
||||
@@ -726,7 +729,7 @@ extern ItemPointer ginReadTuple(GinState *ginstate, OffsetNumber attnum,
|
||||
|
||||
/* gindatapage.c */
|
||||
extern ItemPointer GinDataLeafPageGetItems(Page page, int *nitems, ItemPointerData advancePast);
|
||||
extern int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm);
|
||||
extern int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm);
|
||||
extern BlockNumber createPostingTree(Relation index,
|
||||
ItemPointerData *items, uint32 nitems,
|
||||
GinStatsData *buildStats);
|
||||
@@ -763,7 +766,7 @@ extern void ginVacuumPostingTreeLeaf(Relation rel, Buffer buf, GinVacuumState *g
|
||||
*
|
||||
* In each GinScanKeyData, nentries is the true number of entries, while
|
||||
* nuserentries is the number that extractQueryFn returned (which is what
|
||||
* we report to consistentFn). The "user" entries must come first.
|
||||
* we report to consistentFn). The "user" entries must come first.
|
||||
*/
|
||||
typedef struct GinScanKeyData *GinScanKey;
|
||||
|
||||
@@ -780,8 +783,8 @@ typedef struct GinScanKeyData
|
||||
GinScanEntry *scanEntry;
|
||||
|
||||
/*
|
||||
* At least one of the entries in requiredEntries must be present for
|
||||
* a tuple to match the overall qual.
|
||||
* At least one of the entries in requiredEntries must be present for a
|
||||
* tuple to match the overall qual.
|
||||
*
|
||||
* additionalEntries contains entries that are needed by the consistent
|
||||
* function to decide if an item matches, but are not sufficient to
|
||||
@@ -946,8 +949,8 @@ extern void ginInsertCleanup(GinState *ginstate,
|
||||
/* ginpostinglist.c */
|
||||
|
||||
extern GinPostingList *ginCompressPostingList(const ItemPointer ptrs, int nptrs,
|
||||
int maxsize, int *nwritten);
|
||||
extern int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int totalsize, TIDBitmap *tbm);
|
||||
int maxsize, int *nwritten);
|
||||
extern int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int totalsize, TIDBitmap *tbm);
|
||||
|
||||
extern ItemPointer ginPostingListDecodeAllSegments(GinPostingList *ptr, int len, int *ndecoded);
|
||||
extern ItemPointer ginPostingListDecode(GinPostingList *ptr, int *ndecoded);
|
||||
@@ -965,8 +968,8 @@ extern ItemPointer ginMergeItemPointers(ItemPointerData *a, uint32 na,
|
||||
static inline int
|
||||
ginCompareItemPointers(ItemPointer a, ItemPointer b)
|
||||
{
|
||||
uint64 ia = (uint64) a->ip_blkid.bi_hi << 32 | (uint64) a->ip_blkid.bi_lo << 16 | a->ip_posid;
|
||||
uint64 ib = (uint64) b->ip_blkid.bi_hi << 32 | (uint64) b->ip_blkid.bi_lo << 16 | b->ip_posid;
|
||||
uint64 ia = (uint64) a->ip_blkid.bi_hi << 32 | (uint64) a->ip_blkid.bi_lo << 16 | a->ip_posid;
|
||||
uint64 ib = (uint64) b->ip_blkid.bi_hi << 32 | (uint64) b->ip_blkid.bi_lo << 16 | b->ip_posid;
|
||||
|
||||
if (ia == ib)
|
||||
return 0;
|
||||
|
||||
@@ -98,11 +98,11 @@ typedef GISTPageOpaqueData *GISTPageOpaque;
|
||||
* the union keys for each side.
|
||||
*
|
||||
* If spl_ldatum_exists and spl_rdatum_exists are true, then we are performing
|
||||
* a "secondary split" using a non-first index column. In this case some
|
||||
* a "secondary split" using a non-first index column. In this case some
|
||||
* decisions have already been made about a page split, and the set of tuples
|
||||
* being passed to PickSplit is just the tuples about which we are undecided.
|
||||
* spl_ldatum/spl_rdatum then contain the union keys for the tuples already
|
||||
* chosen to go left or right. Ideally the PickSplit method should take those
|
||||
* chosen to go left or right. Ideally the PickSplit method should take those
|
||||
* keys into account while deciding what to do with the remaining tuples, ie
|
||||
* it should try to "build out" from those unions so as to minimally expand
|
||||
* them. If it does so, it should union the given tuples' keys into the
|
||||
|
||||
@@ -185,7 +185,7 @@ typedef HashMetaPageData *HashMetaPage;
|
||||
#define ALL_SET ((uint32) ~0)
|
||||
|
||||
/*
|
||||
* Bitmap pages do not contain tuples. They do contain the standard
|
||||
* Bitmap pages do not contain tuples. They do contain the standard
|
||||
* page headers and trailers; however, everything in between is a
|
||||
* giant bit array. The number of bits that fit on a page obviously
|
||||
* depends on the page size and the header/trailer overhead. We require
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef enum LockTupleMode
|
||||
* replacement is really a match.
|
||||
* cmax is the outdating command's CID, but only when the failure code is
|
||||
* HeapTupleSelfUpdated (i.e., something in the current transaction outdated
|
||||
* the tuple); otherwise cmax is zero. (We make this restriction because
|
||||
* the tuple); otherwise cmax is zero. (We make this restriction because
|
||||
* HeapTupleHeaderGetCmax doesn't work for tuples outdated in other
|
||||
* transactions.)
|
||||
*/
|
||||
@@ -106,7 +106,7 @@ typedef struct HeapScanDescData *HeapScanDesc;
|
||||
extern HeapScanDesc heap_beginscan(Relation relation, Snapshot snapshot,
|
||||
int nkeys, ScanKey key);
|
||||
extern HeapScanDesc heap_beginscan_catalog(Relation relation, int nkeys,
|
||||
ScanKey key);
|
||||
ScanKey key);
|
||||
extern HeapScanDesc heap_beginscan_strat(Relation relation, Snapshot snapshot,
|
||||
int nkeys, ScanKey key,
|
||||
bool allow_strat, bool allow_sync);
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
*/
|
||||
#define XLOG_HEAP_INIT_PAGE 0x80
|
||||
/*
|
||||
* We ran out of opcodes, so heapam.c now has a second RmgrId. These opcodes
|
||||
* We ran out of opcodes, so heapam.c now has a second RmgrId. These opcodes
|
||||
* are associated with RM_HEAP2_ID, but are not logically different from
|
||||
* the ones above associated with RM_HEAP_ID. XLOG_HEAP_OPMASK applies to
|
||||
* these, too.
|
||||
@@ -71,7 +71,7 @@
|
||||
#define XLOG_HEAP_SUFFIX_FROM_OLD (1<<6)
|
||||
|
||||
/* convenience macro for checking whether any form of old tuple was logged */
|
||||
#define XLOG_HEAP_CONTAINS_OLD \
|
||||
#define XLOG_HEAP_CONTAINS_OLD \
|
||||
(XLOG_HEAP_CONTAINS_OLD_TUPLE | XLOG_HEAP_CONTAINS_OLD_KEY)
|
||||
|
||||
/*
|
||||
@@ -126,11 +126,11 @@ typedef struct xl_heap_header
|
||||
*/
|
||||
typedef struct xl_heap_header_len
|
||||
{
|
||||
uint16 t_len;
|
||||
uint16 t_len;
|
||||
xl_heap_header header;
|
||||
} xl_heap_header_len;
|
||||
|
||||
#define SizeOfHeapHeaderLen (offsetof(xl_heap_header_len, header) + SizeOfHeapHeader)
|
||||
#define SizeOfHeapHeaderLen (offsetof(xl_heap_header_len, header) + SizeOfHeapHeader)
|
||||
|
||||
/* This is what we need to know about insert */
|
||||
typedef struct xl_heap_insert
|
||||
@@ -179,7 +179,7 @@ typedef struct xl_heap_update
|
||||
TransactionId old_xmax; /* xmax of the old tuple */
|
||||
TransactionId new_xmax; /* xmax of the new tuple */
|
||||
ItemPointerData newtid; /* new inserted tuple id */
|
||||
uint8 old_infobits_set; /* infomask bits to set on old tuple */
|
||||
uint8 old_infobits_set; /* infomask bits to set on old tuple */
|
||||
uint8 flags;
|
||||
|
||||
/*
|
||||
@@ -335,18 +335,20 @@ typedef struct xl_heap_new_cid
|
||||
* transactions
|
||||
*/
|
||||
TransactionId top_xid;
|
||||
CommandId cmin;
|
||||
CommandId cmax;
|
||||
CommandId cmin;
|
||||
CommandId cmax;
|
||||
|
||||
/*
|
||||
* don't really need the combocid since we have the actual values
|
||||
* right in this struct, but the padding makes it free and its
|
||||
* useful for debugging.
|
||||
* don't really need the combocid since we have the actual values right in
|
||||
* this struct, but the padding makes it free and its useful for
|
||||
* debugging.
|
||||
*/
|
||||
CommandId combocid;
|
||||
CommandId combocid;
|
||||
|
||||
/*
|
||||
* Store the relfilenode/ctid pair to facilitate lookups.
|
||||
*/
|
||||
xl_heaptid target;
|
||||
xl_heaptid target;
|
||||
} xl_heap_new_cid;
|
||||
|
||||
#define SizeOfHeapNewCid (offsetof(xl_heap_new_cid, target) + SizeOfHeapTid)
|
||||
@@ -354,12 +356,12 @@ typedef struct xl_heap_new_cid
|
||||
/* logical rewrite xlog record header */
|
||||
typedef struct xl_heap_rewrite_mapping
|
||||
{
|
||||
TransactionId mapped_xid; /* xid that might need to see the row */
|
||||
Oid mapped_db; /* DbOid or InvalidOid for shared rels */
|
||||
Oid mapped_rel; /* Oid of the mapped relation */
|
||||
off_t offset; /* How far have we written so far */
|
||||
uint32 num_mappings; /* Number of in-memory mappings */
|
||||
XLogRecPtr start_lsn; /* Insert LSN at begin of rewrite */
|
||||
TransactionId mapped_xid; /* xid that might need to see the row */
|
||||
Oid mapped_db; /* DbOid or InvalidOid for shared rels */
|
||||
Oid mapped_rel; /* Oid of the mapped relation */
|
||||
off_t offset; /* How far have we written so far */
|
||||
uint32 num_mappings; /* Number of in-memory mappings */
|
||||
XLogRecPtr start_lsn; /* Insert LSN at begin of rewrite */
|
||||
} xl_heap_rewrite_mapping;
|
||||
|
||||
extern void HeapTupleHeaderAdvanceLatestRemovedXid(HeapTupleHeader tuple,
|
||||
|
||||
@@ -45,12 +45,12 @@ typedef MinimalTupleData *MinimalTuple;
|
||||
* This is the output format of heap_form_tuple and related routines.
|
||||
*
|
||||
* * Separately allocated tuple: t_data points to a palloc'd chunk that
|
||||
* is not adjacent to the HeapTupleData. (This case is deprecated since
|
||||
* is not adjacent to the HeapTupleData. (This case is deprecated since
|
||||
* it's difficult to tell apart from case #1. It should be used only in
|
||||
* limited contexts where the code knows that case #1 will never apply.)
|
||||
*
|
||||
* * Separately allocated minimal tuple: t_data points MINIMAL_TUPLE_OFFSET
|
||||
* bytes before the start of a MinimalTuple. As with the previous case,
|
||||
* bytes before the start of a MinimalTuple. As with the previous case,
|
||||
* this can't be told apart from case #1 by inspection; code setting up
|
||||
* or destroying this representation has to know what it's doing.
|
||||
*
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
*
|
||||
* We store five "virtual" fields Xmin, Cmin, Xmax, Cmax, and Xvac in three
|
||||
* physical fields. Xmin and Xmax are always really stored, but Cmin, Cmax
|
||||
* and Xvac share a field. This works because we know that Cmin and Cmax
|
||||
* and Xvac share a field. This works because we know that Cmin and Cmax
|
||||
* are only interesting for the lifetime of the inserting and deleting
|
||||
* transaction respectively. If a tuple is inserted and deleted in the same
|
||||
* transaction, we store a "combo" command id that can be mapped to the real
|
||||
@@ -82,7 +82,7 @@
|
||||
* ie, an insert-in-progress or delete-in-progress tuple.)
|
||||
*
|
||||
* A word about t_ctid: whenever a new tuple is stored on disk, its t_ctid
|
||||
* is initialized with its own TID (location). If the tuple is ever updated,
|
||||
* is initialized with its own TID (location). If the tuple is ever updated,
|
||||
* its t_ctid is changed to point to the replacement version of the tuple.
|
||||
* Thus, a tuple is the latest version of its row iff XMAX is invalid or
|
||||
* t_ctid points to itself (in which case, if XMAX is valid, the tuple is
|
||||
@@ -97,10 +97,10 @@
|
||||
* check fails, one may assume that there is no live descendant version.
|
||||
*
|
||||
* Following the fixed header fields, the nulls bitmap is stored (beginning
|
||||
* at t_bits). The bitmap is *not* stored if t_infomask shows that there
|
||||
* at t_bits). The bitmap is *not* stored if t_infomask shows that there
|
||||
* are no nulls in the tuple. If an OID field is present (as indicated by
|
||||
* t_infomask), then it is stored just before the user data, which begins at
|
||||
* the offset shown by t_hoff. Note that t_hoff must be a multiple of
|
||||
* the offset shown by t_hoff. Note that t_hoff must be a multiple of
|
||||
* MAXALIGN.
|
||||
*/
|
||||
|
||||
@@ -242,7 +242,7 @@ struct HeapTupleHeaderData
|
||||
/*
|
||||
* HeapTupleHeader accessor macros
|
||||
*
|
||||
* Note: beware of multiple evaluations of "tup" argument. But the Set
|
||||
* Note: beware of multiple evaluations of "tup" argument. But the Set
|
||||
* macros evaluate their other argument only once.
|
||||
*/
|
||||
|
||||
@@ -528,7 +528,7 @@ do { \
|
||||
* MinimalTuple is an alternative representation that is used for transient
|
||||
* tuples inside the executor, in places where transaction status information
|
||||
* is not required, the tuple rowtype is known, and shaving off a few bytes
|
||||
* is worthwhile because we need to store many tuples. The representation
|
||||
* is worthwhile because we need to store many tuples. The representation
|
||||
* is chosen so that tuple access routines can work with either full or
|
||||
* minimal tuples via a HeapTupleData pointer structure. The access routines
|
||||
* see no difference, except that they must not access the transaction status
|
||||
@@ -552,7 +552,7 @@ do { \
|
||||
* the MINIMAL_TUPLE_OFFSET distance. t_len does not include that, however.
|
||||
*
|
||||
* MINIMAL_TUPLE_DATA_OFFSET is the offset to the first useful (non-pad) data
|
||||
* other than the length word. tuplesort.c and tuplestore.c use this to avoid
|
||||
* other than the length word. tuplesort.c and tuplestore.c use this to avoid
|
||||
* writing the padding to disk.
|
||||
*/
|
||||
#define MINIMAL_TUPLE_OFFSET \
|
||||
@@ -698,7 +698,7 @@ extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
|
||||
* and set *isnull == true. Otherwise, we set *isnull == false.
|
||||
*
|
||||
* <tup> is the pointer to the heap tuple. <attnum> is the attribute
|
||||
* number of the column (field) caller wants. <tupleDesc> is a
|
||||
* number of the column (field) caller wants. <tupleDesc> is a
|
||||
* pointer to the structure describing the row and all its fields.
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/*
|
||||
* Index tuple header structure
|
||||
*
|
||||
* All index tuples start with IndexTupleData. If the HasNulls bit is set,
|
||||
* All index tuples start with IndexTupleData. If the HasNulls bit is set,
|
||||
* this is followed by an IndexAttributeBitMapData. The index attribute
|
||||
* values follow, beginning at a MAXALIGN boundary.
|
||||
*
|
||||
|
||||
@@ -36,9 +36,9 @@ typedef uint16 BTCycleId;
|
||||
* and status. If the page is deleted, we replace the level with the
|
||||
* next-transaction-ID value indicating when it is safe to reclaim the page.
|
||||
*
|
||||
* We also store a "vacuum cycle ID". When a page is split while VACUUM is
|
||||
* We also store a "vacuum cycle ID". When a page is split while VACUUM is
|
||||
* processing the index, a nonzero value associated with the VACUUM run is
|
||||
* stored into both halves of the split page. (If VACUUM is not running,
|
||||
* stored into both halves of the split page. (If VACUUM is not running,
|
||||
* both pages receive zero cycleids.) This allows VACUUM to detect whether
|
||||
* a page was split since it started, with a small probability of false match
|
||||
* if the page was last split some exact multiple of MAX_BT_CYCLE_ID VACUUMs
|
||||
@@ -73,10 +73,10 @@ typedef BTPageOpaqueData *BTPageOpaque;
|
||||
#define BTP_HALF_DEAD (1 << 4) /* empty, but still in tree */
|
||||
#define BTP_SPLIT_END (1 << 5) /* rightmost page of split group */
|
||||
#define BTP_HAS_GARBAGE (1 << 6) /* page has LP_DEAD tuples */
|
||||
#define BTP_INCOMPLETE_SPLIT (1 << 7) /* right sibling's downlink is missing */
|
||||
#define BTP_INCOMPLETE_SPLIT (1 << 7) /* right sibling's downlink is missing */
|
||||
|
||||
/*
|
||||
* The max allowed value of a cycle ID is a bit less than 64K. This is
|
||||
* The max allowed value of a cycle ID is a bit less than 64K. This is
|
||||
* for convenience of pg_filedump and similar utilities: we want to use
|
||||
* the last 2 bytes of special space as an index type indicator, and
|
||||
* restricting cycle ID lets btree use that space for vacuum cycle IDs
|
||||
@@ -218,9 +218,9 @@ typedef struct BTMetaPageData
|
||||
#define XLOG_BTREE_SPLIT_R_ROOT 0x60 /* as above, new item on right */
|
||||
#define XLOG_BTREE_DELETE 0x70 /* delete leaf index tuples for a page */
|
||||
#define XLOG_BTREE_UNLINK_PAGE 0x80 /* delete a half-dead page */
|
||||
#define XLOG_BTREE_UNLINK_PAGE_META 0x90 /* same, and update metapage */
|
||||
#define XLOG_BTREE_UNLINK_PAGE_META 0x90 /* same, and update metapage */
|
||||
#define XLOG_BTREE_NEWROOT 0xA0 /* new root page */
|
||||
#define XLOG_BTREE_MARK_PAGE_HALFDEAD 0xB0 /* mark a leaf as half-dead */
|
||||
#define XLOG_BTREE_MARK_PAGE_HALFDEAD 0xB0 /* mark a leaf as half-dead */
|
||||
#define XLOG_BTREE_VACUUM 0xC0 /* delete entries on a page during
|
||||
* vacuum */
|
||||
#define XLOG_BTREE_REUSE_PAGE 0xD0 /* old page is about to be reused from
|
||||
@@ -273,9 +273,9 @@ typedef struct xl_btree_insert
|
||||
* Note: the four XLOG_BTREE_SPLIT xl_info codes all use this data record.
|
||||
* The _L and _R variants indicate whether the inserted tuple went into the
|
||||
* left or right split page (and thus, whether newitemoff and the new item
|
||||
* are stored or not). The _ROOT variants indicate that we are splitting
|
||||
* are stored or not). The _ROOT variants indicate that we are splitting
|
||||
* the root page, and thus that a newroot record rather than an insert or
|
||||
* split record should follow. Note that a split record never carries a
|
||||
* split record should follow. Note that a split record never carries a
|
||||
* metapage update --- we'll do that in the parent-level update.
|
||||
*/
|
||||
typedef struct xl_btree_split
|
||||
@@ -295,11 +295,11 @@ typedef struct xl_btree_split
|
||||
*
|
||||
* If level > 0, an IndexTuple representing the HIKEY of the left page
|
||||
* follows. We don't need this on leaf pages, because it's the same as
|
||||
* the leftmost key in the new right page. Also, it's suppressed if
|
||||
* the leftmost key in the new right page. Also, it's suppressed if
|
||||
* XLogInsert chooses to store the left page's whole page image.
|
||||
*
|
||||
* If level > 0, BlockNumber of the page whose incomplete-split flag
|
||||
* this insertion clears. (not aligned)
|
||||
* If level > 0, BlockNumber of the page whose incomplete-split flag this
|
||||
* insertion clears. (not aligned)
|
||||
*
|
||||
* Last are the right page's tuples in the form used by _bt_restore_page.
|
||||
*/
|
||||
@@ -387,7 +387,7 @@ typedef struct xl_btree_mark_page_halfdead
|
||||
BlockNumber topparent; /* topmost internal page in the branch */
|
||||
} xl_btree_mark_page_halfdead;
|
||||
|
||||
#define SizeOfBtreeMarkPageHalfDead (offsetof(xl_btree_mark_page_halfdead, topparent) + sizeof(BlockNumber))
|
||||
#define SizeOfBtreeMarkPageHalfDead (offsetof(xl_btree_mark_page_halfdead, topparent) + sizeof(BlockNumber))
|
||||
|
||||
/*
|
||||
* This is what we need to know about deletion of a btree page. Note we do
|
||||
@@ -396,19 +396,19 @@ typedef struct xl_btree_mark_page_halfdead
|
||||
*/
|
||||
typedef struct xl_btree_unlink_page
|
||||
{
|
||||
RelFileNode node;
|
||||
RelFileNode node;
|
||||
BlockNumber deadblk; /* target block being deleted */
|
||||
BlockNumber leftsib; /* target block's left sibling, if any */
|
||||
BlockNumber rightsib; /* target block's right sibling */
|
||||
|
||||
/*
|
||||
* Information needed to recreate the leaf page, when target is an internal
|
||||
* page.
|
||||
* Information needed to recreate the leaf page, when target is an
|
||||
* internal page.
|
||||
*/
|
||||
BlockNumber leafblk;
|
||||
BlockNumber leafleftsib;
|
||||
BlockNumber leafrightsib;
|
||||
BlockNumber topparent; /* next child down in the branch */
|
||||
BlockNumber leafblk;
|
||||
BlockNumber leafleftsib;
|
||||
BlockNumber leafrightsib;
|
||||
BlockNumber topparent; /* next child down in the branch */
|
||||
|
||||
TransactionId btpo_xact; /* value of btpo.xact for use in recovery */
|
||||
/* xl_btree_metadata FOLLOWS IF XLOG_BTREE_UNLINK_PAGE_META */
|
||||
@@ -446,12 +446,12 @@ typedef struct xl_btree_newroot
|
||||
/*
|
||||
* When a new operator class is declared, we require that the user
|
||||
* supply us with an amproc procedure (BTORDER_PROC) for determining
|
||||
* whether, for two keys a and b, a < b, a = b, or a > b. This routine
|
||||
* whether, for two keys a and b, a < b, a = b, or a > b. This routine
|
||||
* must return < 0, 0, > 0, respectively, in these three cases. (It must
|
||||
* not return INT_MIN, since we may negate the result before using it.)
|
||||
*
|
||||
* To facilitate accelerated sorting, an operator class may choose to
|
||||
* offer a second procedure (BTSORTSUPPORT_PROC). For full details, see
|
||||
* offer a second procedure (BTSORTSUPPORT_PROC). For full details, see
|
||||
* src/include/utils/sortsupport.h.
|
||||
*/
|
||||
|
||||
@@ -490,7 +490,7 @@ typedef BTStackData *BTStack;
|
||||
* BTScanOpaqueData is the btree-private state needed for an indexscan.
|
||||
* This consists of preprocessed scan keys (see _bt_preprocess_keys() for
|
||||
* details of the preprocessing), information about the current location
|
||||
* of the scan, and information about the marked location, if any. (We use
|
||||
* of the scan, and information about the marked location, if any. (We use
|
||||
* BTScanPosData to represent the data needed for each of current and marked
|
||||
* locations.) In addition we can remember some known-killed index entries
|
||||
* that must be marked before we can move off the current page.
|
||||
@@ -498,9 +498,9 @@ typedef BTStackData *BTStack;
|
||||
* Index scans work a page at a time: we pin and read-lock the page, identify
|
||||
* all the matching items on the page and save them in BTScanPosData, then
|
||||
* release the read-lock while returning the items to the caller for
|
||||
* processing. This approach minimizes lock/unlock traffic. Note that we
|
||||
* processing. This approach minimizes lock/unlock traffic. Note that we
|
||||
* keep the pin on the index page until the caller is done with all the items
|
||||
* (this is needed for VACUUM synchronization, see nbtree/README). When we
|
||||
* (this is needed for VACUUM synchronization, see nbtree/README). When we
|
||||
* are ready to step to the next page, if the caller has told us any of the
|
||||
* items were killed, we re-lock the page to mark them killed, then unlock.
|
||||
* Finally we drop the pin and step to the next page in the appropriate
|
||||
@@ -612,7 +612,7 @@ typedef BTScanOpaqueData *BTScanOpaque;
|
||||
|
||||
/*
|
||||
* We use some private sk_flags bits in preprocessed scan keys. We're allowed
|
||||
* to use bits 16-31 (see skey.h). The uppermost bits are copied from the
|
||||
* to use bits 16-31 (see skey.h). The uppermost bits are copied from the
|
||||
* index's indoption[] array entry for the index attribute.
|
||||
*/
|
||||
#define SK_BT_REQFWD 0x00010000 /* required to continue forward scan */
|
||||
|
||||
@@ -197,7 +197,7 @@ typedef struct
|
||||
* "base" is a pointer to the reloptions structure, and "offset" is an integer
|
||||
* variable that must be initialized to sizeof(reloptions structure). This
|
||||
* struct must have been allocated with enough space to hold any string option
|
||||
* present, including terminating \0 for every option. SET_VARSIZE() must be
|
||||
* present, including terminating \0 for every option. SET_VARSIZE() must be
|
||||
* called on the struct with this offset as the second argument, after all the
|
||||
* string options have been processed.
|
||||
*/
|
||||
|
||||
@@ -34,10 +34,10 @@ extern bool rewrite_heap_dead_tuple(RewriteState state, HeapTuple oldTuple);
|
||||
*/
|
||||
typedef struct LogicalRewriteMappingData
|
||||
{
|
||||
RelFileNode old_node;
|
||||
RelFileNode new_node;
|
||||
ItemPointerData old_tid;
|
||||
ItemPointerData new_tid;
|
||||
RelFileNode old_node;
|
||||
RelFileNode new_node;
|
||||
ItemPointerData old_tid;
|
||||
ItemPointerData new_tid;
|
||||
} LogicalRewriteMappingData;
|
||||
|
||||
/* ---
|
||||
@@ -52,6 +52,6 @@ typedef struct LogicalRewriteMappingData
|
||||
* ---
|
||||
*/
|
||||
#define LOGICAL_REWRITE_FORMAT "map-%x-%x-%X_%X-%x-%x"
|
||||
void CheckPointLogicalRewriteHeap(void);
|
||||
void CheckPointLogicalRewriteHeap(void);
|
||||
|
||||
#endif /* REWRITE_HEAP_H */
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef enum RmgrIds
|
||||
{
|
||||
#include "access/rmgrlist.h"
|
||||
RM_NEXT_ID
|
||||
} RmgrIds;
|
||||
} RmgrIds;
|
||||
|
||||
#undef PG_RMGR
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* rmgrlist.h
|
||||
*
|
||||
* The resource manager list is kept in its own source file for possible
|
||||
* use by automatic tools. The exact representation of a rmgr is determined
|
||||
* use by automatic tools. The exact representation of a rmgr is determined
|
||||
* by the PG_RMGR macro, which is not defined in this file; it can be
|
||||
* defined by the caller for special purposes.
|
||||
*
|
||||
|
||||
@@ -42,7 +42,7 @@ typedef uint16 StrategyNumber;
|
||||
|
||||
/*
|
||||
* A ScanKey represents the application of a comparison operator between
|
||||
* a table or index column and a constant. When it's part of an array of
|
||||
* a table or index column and a constant. When it's part of an array of
|
||||
* ScanKeys, the comparison conditions are implicitly ANDed. The index
|
||||
* column is the left argument of the operator, if it's a binary operator.
|
||||
* (The data structure can support unary indexable operators too; in that
|
||||
@@ -115,7 +115,7 @@ typedef ScanKeyData *ScanKey;
|
||||
* must be sorted according to the leading column number.
|
||||
*
|
||||
* The subsidiary ScanKey array appears in logical column order of the row
|
||||
* comparison, which may be different from index column order. The array
|
||||
* comparison, which may be different from index column order. The array
|
||||
* elements are like a normal ScanKey array except that:
|
||||
* sk_flags must include SK_ROW_MEMBER, plus SK_ROW_END in the last
|
||||
* element (needed since row header does not include a count)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* segment and page numbers in SimpleLruTruncate (see PagePrecedes()).
|
||||
*
|
||||
* Note: slru.c currently assumes that segment file names will be four hex
|
||||
* digits. This sets a lower bound on the segment size (64K transactions
|
||||
* digits. This sets a lower bound on the segment size (64K transactions
|
||||
* for 32-bit TransactionIds).
|
||||
*/
|
||||
#define SLRU_PAGES_PER_SEGMENT 32
|
||||
@@ -55,7 +55,7 @@ typedef enum
|
||||
*/
|
||||
typedef struct SlruSharedData
|
||||
{
|
||||
LWLock *ControlLock;
|
||||
LWLock *ControlLock;
|
||||
|
||||
/* Number of buffers managed by this SLRU structure */
|
||||
int num_slots;
|
||||
@@ -69,7 +69,7 @@ typedef struct SlruSharedData
|
||||
bool *page_dirty;
|
||||
int *page_number;
|
||||
int *page_lru_count;
|
||||
LWLock **buffer_locks;
|
||||
LWLock **buffer_locks;
|
||||
|
||||
/*
|
||||
* Optional array of WAL flush LSNs associated with entries in the SLRU
|
||||
|
||||
@@ -185,7 +185,7 @@ typedef struct SpGistCache
|
||||
|
||||
|
||||
/*
|
||||
* SPGiST tuple types. Note: inner, leaf, and dead tuple structs
|
||||
* SPGiST tuple types. Note: inner, leaf, and dead tuple structs
|
||||
* must have the same tupstate field in the same position! Real inner and
|
||||
* leaf tuples always have tupstate = LIVE; if the state is something else,
|
||||
* use the SpGistDeadTuple struct to inspect the tuple.
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
* using the OID generator. (We start the generator at 10000.)
|
||||
*
|
||||
* OIDs beginning at 16384 are assigned from the OID generator
|
||||
* during normal multiuser operation. (We force the generator up to
|
||||
* during normal multiuser operation. (We force the generator up to
|
||||
* 16384 as soon as we are in normal operation.)
|
||||
*
|
||||
* The choices of 10000 and 16384 are completely arbitrary, and can be moved
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef struct tupleConstr
|
||||
* TupleDesc; with the exception that tdhasoid indicates if OID is present.
|
||||
*
|
||||
* If the tupdesc is known to correspond to a named rowtype (such as a table's
|
||||
* rowtype) then tdtypeid identifies that type and tdtypmod is -1. Otherwise
|
||||
* rowtype) then tdtypeid identifies that type and tdtypmod is -1. Otherwise
|
||||
* tdtypeid is RECORDOID, and tdtypmod can be either -1 for a fully anonymous
|
||||
* row type, or a value >= 0 to allow the rowtype to be looked up in the
|
||||
* typcache.c type cache.
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
/*
|
||||
* att_align_datum aligns the given offset as needed for a datum of alignment
|
||||
* requirement attalign and typlen attlen. attdatum is the Datum variable
|
||||
* requirement attalign and typlen attlen. attdatum is the Datum variable
|
||||
* we intend to pack into a tuple (it's only accessed if we are dealing with
|
||||
* a varlena type). Note that this assumes the Datum will be stored as-is;
|
||||
* callers that are intending to convert non-short varlena datums to short
|
||||
@@ -111,7 +111,7 @@
|
||||
* pointer; when accessing a varlena field we have to "peek" to see if we
|
||||
* are looking at a pad byte or the first byte of a 1-byte-header datum.
|
||||
* (A zero byte must be either a pad byte, or the first byte of a correctly
|
||||
* aligned 4-byte length word; in either case we can align safely. A non-zero
|
||||
* aligned 4-byte length word; in either case we can align safely. A non-zero
|
||||
* byte must be either a 1-byte length word, or the first byte of a correctly
|
||||
* aligned 4-byte length word; in either case we need not align.)
|
||||
*
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
* The code will also consider moving MAIN data out-of-line, but only as a
|
||||
* last resort if the previous steps haven't reached the target tuple size.
|
||||
* In this phase we use a different target size, currently equal to the
|
||||
* largest tuple that will fit on a heap page. This is reasonable since
|
||||
* largest tuple that will fit on a heap page. This is reasonable since
|
||||
* the user has told us to keep the data in-line if at all possible.
|
||||
*/
|
||||
#define TOAST_TUPLES_PER_PAGE_MAIN 1
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
/*
|
||||
* When we store an oversize datum externally, we divide it into chunks
|
||||
* containing at most TOAST_MAX_CHUNK_SIZE data bytes. This number *must*
|
||||
* containing at most TOAST_MAX_CHUNK_SIZE data bytes. This number *must*
|
||||
* be small enough that the completed toast-table tuple (including the
|
||||
* ID and sequence fields and all overhead) will fit on a page.
|
||||
* The coding here sets the size on the theory that we want to fit
|
||||
@@ -223,6 +223,6 @@ extern Size toast_datum_size(Datum value);
|
||||
* Return OID of valid index associated to a toast relation
|
||||
* ----------
|
||||
*/
|
||||
extern Oid toast_get_valid_index(Oid toastoid, LOCKMODE lock);
|
||||
extern Oid toast_get_valid_index(Oid toastoid, LOCKMODE lock);
|
||||
|
||||
#endif /* TUPTOASTER_H */
|
||||
|
||||
@@ -31,11 +31,11 @@
|
||||
* where there can be zero to four backup blocks (as signaled by xl_info flag
|
||||
* bits). XLogRecord structs always start on MAXALIGN boundaries in the WAL
|
||||
* files, and we round up SizeOfXLogRecord so that the rmgr data is also
|
||||
* guaranteed to begin on a MAXALIGN boundary. However, no padding is added
|
||||
* guaranteed to begin on a MAXALIGN boundary. However, no padding is added
|
||||
* to align BkpBlock structs or backup block data.
|
||||
*
|
||||
* NOTE: xl_len counts only the rmgr data, not the XLogRecord header,
|
||||
* and also not any backup blocks. xl_tot_len counts everything. Neither
|
||||
* and also not any backup blocks. xl_tot_len counts everything. Neither
|
||||
* length field is rounded up to an alignment boundary.
|
||||
*/
|
||||
typedef struct XLogRecord
|
||||
@@ -100,7 +100,7 @@ extern int sync_method;
|
||||
* value (ignoring InvalidBuffer) appearing in the rdata chain.
|
||||
*
|
||||
* When buffer is valid, caller must set buffer_std to indicate whether the
|
||||
* page uses standard pd_lower/pd_upper header fields. If this is true, then
|
||||
* page uses standard pd_lower/pd_upper header fields. If this is true, then
|
||||
* XLOG is allowed to omit the free space between pd_lower and pd_upper from
|
||||
* the backed-up page image. Note that even when buffer_std is false, the
|
||||
* page MUST have an LSN field as its first eight bytes!
|
||||
|
||||
@@ -123,7 +123,7 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader;
|
||||
* Compute ID and segment from an XLogRecPtr.
|
||||
*
|
||||
* For XLByteToSeg, do the computation at face value. For XLByteToPrevSeg,
|
||||
* a boundary byte is taken to be in the previous segment. This is suitable
|
||||
* a boundary byte is taken to be in the previous segment. This is suitable
|
||||
* for deciding which segment to write given a pointer to a record end,
|
||||
* for example.
|
||||
*/
|
||||
@@ -261,7 +261,7 @@ extern XLogRecPtr RequestXLogSwitch(void);
|
||||
extern void GetOldestRestartPoint(XLogRecPtr *oldrecptr, TimeLineID *oldtli);
|
||||
|
||||
/*
|
||||
* Exported for the functions in timeline.c and xlogarchive.c. Only valid
|
||||
* Exported for the functions in timeline.c and xlogarchive.c. Only valid
|
||||
* in the startup process.
|
||||
*/
|
||||
extern bool ArchiveRecoveryRequested;
|
||||
|
||||
@@ -49,7 +49,7 @@ typedef uint32 TimeLineID;
|
||||
* read those buffers except during crash recovery or if wal_level != minimal,
|
||||
* it is a win to use it in all cases where we sync on each write(). We could
|
||||
* allow O_DIRECT with fsync(), but it is unclear if fsync() could process
|
||||
* writes not buffered in the kernel. Also, O_DIRECT is never enough to force
|
||||
* writes not buffered in the kernel. Also, O_DIRECT is never enough to force
|
||||
* data to the drives, it merely tries to bypass the kernel cache, so we still
|
||||
* need O_SYNC/O_DSYNC.
|
||||
*/
|
||||
@@ -62,7 +62,7 @@ typedef uint32 TimeLineID;
|
||||
/*
|
||||
* This chunk of hackery attempts to determine which file sync methods
|
||||
* are available on the current platform, and to choose an appropriate
|
||||
* default method. We assume that fsync() is always available, and that
|
||||
* default method. We assume that fsync() is always available, and that
|
||||
* configure determined whether fdatasync() is.
|
||||
*/
|
||||
#if defined(O_SYNC)
|
||||
|
||||
Reference in New Issue
Block a user