YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/postgres/src/include/storage/bufpage.h
Line
Count
Source (jump to first uncovered line)
1
/*-------------------------------------------------------------------------
2
 *
3
 * bufpage.h
4
 *    Standard POSTGRES buffer page definitions.
5
 *
6
 *
7
 * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
8
 * Portions Copyright (c) 1994, Regents of the University of California
9
 *
10
 * src/include/storage/bufpage.h
11
 *
12
 *-------------------------------------------------------------------------
13
 */
14
#ifndef BUFPAGE_H
15
#define BUFPAGE_H
16
17
#include "access/xlogdefs.h"
18
#include "storage/block.h"
19
#include "storage/item.h"
20
#include "storage/off.h"
21
22
/*
23
 * A postgres disk page is an abstraction layered on top of a postgres
24
 * disk block (which is simply a unit of i/o, see block.h).
25
 *
26
 * specifically, while a disk block can be unformatted, a postgres
27
 * disk page is always a slotted page of the form:
28
 *
29
 * +----------------+---------------------------------+
30
 * | PageHeaderData | linp1 linp2 linp3 ...           |
31
 * +-----------+----+---------------------------------+
32
 * | ... linpN |                    |
33
 * +-----------+--------------------------------------+
34
 * |       ^ pd_lower               |
35
 * |                          |
36
 * |       v pd_upper               |
37
 * +-------------+------------------------------------+
38
 * |       | tupleN ...                         |
39
 * +-------------+------------------+-----------------+
40
 * |     ... tuple3 tuple2 tuple1 | "special space" |
41
 * +--------------------------------+-----------------+
42
 *                  ^ pd_special
43
 *
44
 * a page is full when nothing can be added between pd_lower and
45
 * pd_upper.
46
 *
47
 * all blocks written out by an access method must be disk pages.
48
 *
49
 * EXCEPTIONS:
50
 *
51
 * obviously, a page is not formatted before it is initialized by
52
 * a call to PageInit.
53
 *
54
 * NOTES:
55
 *
56
 * linp1..N form an ItemId array.  ItemPointers point into this array
57
 * rather than pointing directly to a tuple.  Note that OffsetNumbers
58
 * conventionally start at 1, not 0.
59
 *
60
 * tuple1..N are added "backwards" on the page.  because a tuple's
61
 * ItemPointer points to its ItemId entry rather than its actual
62
 * byte-offset position, tuples can be physically shuffled on a page
63
 * whenever the need arises.
64
 *
65
 * AM-generic per-page information is kept in PageHeaderData.
66
 *
67
 * AM-specific per-page data (if any) is kept in the area marked "special
68
 * space"; each AM has an "opaque" structure defined somewhere that is
69
 * stored as the page trailer.  an access method should always
70
 * initialize its pages with PageInit and then set its own opaque
71
 * fields.
72
 */
73
74
typedef Pointer Page;
75
76
77
/*
78
 * location (byte offset) within a page.
79
 *
80
 * note that this is actually limited to 2^15 because we have limited
81
 * ItemIdData.lp_off and ItemIdData.lp_len to 15 bits (see itemid.h).
82
 */
83
typedef uint16 LocationIndex;
84
85
86
/*
87
 * For historical reasons, the 64-bit LSN value is stored as two 32-bit
88
 * values.
89
 */
90
typedef struct
91
{
92
  uint32    xlogid;     /* high bits */
93
  uint32    xrecoff;    /* low bits */
94
} PageXLogRecPtr;
95
96
#define PageXLogRecPtrGet(val) \
97
123k
  ((uint64) (val).xlogid << 32 | (val).xrecoff)
98
#define PageXLogRecPtrSet(ptr, lsn) \
99
21.9k
  ((ptr).xlogid = (uint32) ((lsn) >> 32), (ptr).xrecoff = (uint32) (lsn))
100
101
/*
102
 * disk page organization
103
 *
104
 * space management information generic to any page
105
 *
106
 *    pd_lsn    - identifies xlog record for last change to this page.
107
 *    pd_checksum - page checksum, if set.
108
 *    pd_flags  - flag bits.
109
 *    pd_lower  - offset to start of free space.
110
 *    pd_upper  - offset to end of free space.
111
 *    pd_special  - offset to start of special space.
112
 *    pd_pagesize_version - size in bytes and page layout version number.
113
 *    pd_prune_xid - oldest XID among potentially prunable tuples on page.
114
 *
115
 * The LSN is used by the buffer manager to enforce the basic rule of WAL:
116
 * "thou shalt write xlog before data".  A dirty buffer cannot be dumped
117
 * to disk until xlog has been flushed at least as far as the page's LSN.
118
 *
119
 * pd_checksum stores the page checksum, if it has been set for this page;
120
 * zero is a valid value for a checksum. If a checksum is not in use then
121
 * we leave the field unset. This will typically mean the field is zero
122
 * though non-zero values may also be present if databases have been
123
 * pg_upgraded from releases prior to 9.3, when the same byte offset was
124
 * used to store the current timelineid when the page was last updated.
125
 * Note that there is no indication on a page as to whether the checksum
126
 * is valid or not, a deliberate design choice which avoids the problem
127
 * of relying on the page contents to decide whether to verify it. Hence
128
 * there are no flag bits relating to checksums.
129
 *
130
 * pd_prune_xid is a hint field that helps determine whether pruning will be
131
 * useful.  It is currently unused in index pages.
132
 *
133
 * The page version number and page size are packed together into a single
134
 * uint16 field.  This is for historical reasons: before PostgreSQL 7.3,
135
 * there was no concept of a page version number, and doing it this way
136
 * lets us pretend that pre-7.3 databases have page version number zero.
137
 * We constrain page sizes to be multiples of 256, leaving the low eight
138
 * bits available for a version number.
139
 *
140
 * Minimum possible page size is perhaps 64B to fit page header, opaque space
141
 * and a minimal tuple; of course, in reality you want it much bigger, so
142
 * the constraint on pagesize mod 256 is not an important restriction.
143
 * On the high end, we can only support pages up to 32KB because lp_off/lp_len
144
 * are 15 bits.
145
 */
146
147
typedef struct PageHeaderData
148
{
149
  /* XXX LSN is member of *any* block, not only page-organized ones */
150
  PageXLogRecPtr pd_lsn;    /* LSN: next byte after last byte of xlog
151
                 * record for last change to this page */
152
  uint16    pd_checksum;  /* checksum */
153
  uint16    pd_flags;   /* flag bits, see below */
154
  LocationIndex pd_lower;   /* offset to start of free space */
155
  LocationIndex pd_upper;   /* offset to end of free space */
156
  LocationIndex pd_special; /* offset to start of special space */
157
  uint16    pd_pagesize_version;
158
  TransactionId pd_prune_xid; /* oldest prunable XID, or zero if none */
159
  ItemIdData  pd_linp[FLEXIBLE_ARRAY_MEMBER]; /* line pointer array */
160
} PageHeaderData;
161
162
typedef PageHeaderData *PageHeader;
163
164
/*
165
 * pd_flags contains the following flag bits.  Undefined bits are initialized
166
 * to zero and may be used in the future.
167
 *
168
 * PD_HAS_FREE_LINES is set if there are any LP_UNUSED line pointers before
169
 * pd_lower.  This should be considered a hint rather than the truth, since
170
 * changes to it are not WAL-logged.
171
 *
172
 * PD_PAGE_FULL is set if an UPDATE doesn't find enough free space in the
173
 * page for its new tuple version; this suggests that a prune is needed.
174
 * Again, this is just a hint.
175
 */
176
21.1k
#define PD_HAS_FREE_LINES 0x0001  /* are there any unused line pointers? */
177
136
#define PD_PAGE_FULL    0x0002  /* not enough free space for new tuple? */
178
63.6k
#define PD_ALL_VISIBLE    0x0004  /* all tuples on page are visible to
179
                   * everyone */
180
181
31
#define PD_VALID_FLAG_BITS  0x0007  /* OR of all valid pd_flags bits */
182
183
/*
184
 * Page layout version number 0 is for pre-7.3 Postgres releases.
185
 * Releases 7.3 and 7.4 use 1, denoting a new HeapTupleHeader layout.
186
 * Release 8.0 uses 2; it changed the HeapTupleHeader layout again.
187
 * Release 8.1 uses 3; it redefined HeapTupleHeader infomask bits.
188
 * Release 8.3 uses 4; it changed the HeapTupleHeader layout again, and
189
 *    added the pd_flags field (by stealing some bits from pd_tli),
190
 *    as well as adding the pd_prune_xid field (which enlarges the header).
191
 *
192
 * As of Release 9.3, the checksum version must also be considered when
193
 * handling pages.
194
 */
195
#define PG_PAGE_LAYOUT_VERSION    4
196
0
#define PG_DATA_CHECKSUM_VERSION  1
197
198
/* ----------------------------------------------------------------
199
 *            page support macros
200
 * ----------------------------------------------------------------
201
 */
202
203
/*
204
 * PageIsValid
205
 *    True iff page is valid.
206
 */
207
#define PageIsValid(page) PointerIsValid(page)
208
209
/*
210
 * line pointer(s) do not count as part of header
211
 */
212
395k
#define SizeOfPageHeaderData (offsetof(PageHeaderData, pd_linp))
213
214
/*
215
 * PageIsEmpty
216
 *    returns true iff no itemid has been allocated on the page
217
 */
218
#define PageIsEmpty(page) \
219
20.3k
  (((PageHeader) (page))->pd_lower <= SizeOfPageHeaderData)
220
221
/*
222
 * PageIsNew
223
 *    returns true iff page has not been initialized (by PageInit)
224
 */
225
52.4k
#define PageIsNew(page) (((PageHeader) (page))->pd_upper == 0)
226
227
/*
228
 * PageGetItemId
229
 *    Returns an item identifier of a page.
230
 */
231
#define PageGetItemId(page, offsetNumber) \
232
265k
  ((ItemId) (&((PageHeader) (page))->pd_linp[(offsetNumber) - 1]))
233
234
/*
235
 * PageGetContents
236
 *    To be used in case the page does not contain item pointers.
237
 *
238
 * Note: prior to 8.3 this was not guaranteed to yield a MAXALIGN'd result.
239
 * Now it is.  Beware of old code that might think the offset to the contents
240
 * is just SizeOfPageHeaderData rather than MAXALIGN(SizeOfPageHeaderData).
241
 */
242
#define PageGetContents(page) \
243
513
  ((char *) (page) + MAXALIGN(SizeOfPageHeaderData))
244
245
/* ----------------
246
 *    macros to access page size info
247
 * ----------------
248
 */
249
250
/*
251
 * PageSizeIsValid
252
 *    True iff the page size is valid.
253
 */
254
#define PageSizeIsValid(pageSize) ((pageSize) == BLCKSZ)
255
256
/*
257
 * PageGetPageSize
258
 *    Returns the page size of a page.
259
 *
260
 * this can only be called on a formatted page (unlike
261
 * BufferGetPageSize, which can be called on an unformatted page).
262
 * however, it can be called on a page that is not stored in a buffer.
263
 */
264
#define PageGetPageSize(page) \
265
52.9k
  ((Size) (((PageHeader) (page))->pd_pagesize_version & (uint16) 0xFF00))
266
267
/*
268
 * PageGetPageLayoutVersion
269
 *    Returns the page layout version of a page.
270
 */
271
#define PageGetPageLayoutVersion(page) \
272
  (((PageHeader) (page))->pd_pagesize_version & 0x00FF)
273
274
/*
275
 * PageSetPageSizeAndVersion
276
 *    Sets the page size and page layout version number of a page.
277
 *
278
 * We could support setting these two values separately, but there's
279
 * no real need for it at the moment.
280
 */
281
819
#define PageSetPageSizeAndVersion(page, size, version) \
282
819
( \
283
819
  AssertMacro(((size) & 0xFF00) == (size)), \
284
819
  AssertMacro(((version) & 0x00FF) == (version)), \
285
819
  ((PageHeader) (page))->pd_pagesize_version = (size) | (version) \
286
819
)
287
288
/* ----------------
289
 *    page special data macros
290
 * ----------------
291
 */
292
/*
293
 * PageGetSpecialSize
294
 *    Returns size of special space on a page.
295
 */
296
#define PageGetSpecialSize(page) \
297
52.3k
  ((uint16) (PageGetPageSize(page) - ((PageHeader)(page))->pd_special))
298
299
/*
300
 * Using assertions, validate that the page special pointer is OK.
301
 *
302
 * This is intended to catch use of the pointer before page initialization.
303
 * It is implemented as a function due to the limitations of the MSVC
304
 * compiler, which choked on doing all these tests within another macro.  We
305
 * return true so that MacroAssert() can be used while still getting the
306
 * specifics from the macro failure within this function.
307
 */
308
static inline bool
309
PageValidateSpecialPointer(Page page)
310
326k
{
311
326k
  Assert(PageIsValid(page));
312
326k
  Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
313
326k
  Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
314
315
326k
  return true;
316
326k
}
Unexecuted instantiation: pg_resetwal.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_rewind.c:PageValidateSpecialPointer
Unexecuted instantiation: file.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_verify_checksums.c:PageValidateSpecialPointer
Unexecuted instantiation: rmgrdesc.c:PageValidateSpecialPointer
Unexecuted instantiation: brindesc.c:PageValidateSpecialPointer
Unexecuted instantiation: genericdesc.c:PageValidateSpecialPointer
Unexecuted instantiation: gindesc.c:PageValidateSpecialPointer
Unexecuted instantiation: gistdesc.c:PageValidateSpecialPointer
Unexecuted instantiation: heapdesc.c:PageValidateSpecialPointer
Unexecuted instantiation: brin.c:PageValidateSpecialPointer
Unexecuted instantiation: brin_pageops.c:PageValidateSpecialPointer
Unexecuted instantiation: brin_revmap.c:PageValidateSpecialPointer
Unexecuted instantiation: brin_tuple.c:PageValidateSpecialPointer
Unexecuted instantiation: brin_xlog.c:PageValidateSpecialPointer
Unexecuted instantiation: brin_minmax.c:PageValidateSpecialPointer
Unexecuted instantiation: brin_inclusion.c:PageValidateSpecialPointer
Unexecuted instantiation: brin_validate.c:PageValidateSpecialPointer
Unexecuted instantiation: bufmask.c:PageValidateSpecialPointer
Unexecuted instantiation: heaptuple.c:PageValidateSpecialPointer
Unexecuted instantiation: indextuple.c:PageValidateSpecialPointer
Unexecuted instantiation: printtup.c:PageValidateSpecialPointer
Unexecuted instantiation: reloptions.c:PageValidateSpecialPointer
Unexecuted instantiation: tupconvert.c:PageValidateSpecialPointer
Unexecuted instantiation: tupdesc.c:PageValidateSpecialPointer
Unexecuted instantiation: ginutil.c:PageValidateSpecialPointer
Unexecuted instantiation: gininsert.c:PageValidateSpecialPointer
Unexecuted instantiation: ginxlog.c:PageValidateSpecialPointer
Unexecuted instantiation: ginentrypage.c:PageValidateSpecialPointer
Unexecuted instantiation: gindatapage.c:PageValidateSpecialPointer
Unexecuted instantiation: ginbtree.c:PageValidateSpecialPointer
Unexecuted instantiation: ginscan.c:PageValidateSpecialPointer
Unexecuted instantiation: ginget.c:PageValidateSpecialPointer
Unexecuted instantiation: ginvacuum.c:PageValidateSpecialPointer
Unexecuted instantiation: ginbulk.c:PageValidateSpecialPointer
Unexecuted instantiation: ginfast.c:PageValidateSpecialPointer
Unexecuted instantiation: ginpostinglist.c:PageValidateSpecialPointer
Unexecuted instantiation: ginlogic.c:PageValidateSpecialPointer
Unexecuted instantiation: ginvalidate.c:PageValidateSpecialPointer
gist.c:PageValidateSpecialPointer
Line
Count
Source
310
270k
{
311
270k
  Assert(PageIsValid(page));
312
270k
  Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
313
270k
  Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
314
315
270k
  return true;
316
270k
}
gistutil.c:PageValidateSpecialPointer
Line
Count
Source
310
31.4k
{
311
31.4k
  Assert(PageIsValid(page));
312
31.4k
  Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
313
31.4k
  Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
314
315
31.4k
  return true;
316
31.4k
}
Unexecuted instantiation: gistxlog.c:PageValidateSpecialPointer
Unexecuted instantiation: gistvacuum.c:PageValidateSpecialPointer
gistget.c:PageValidateSpecialPointer
Line
Count
Source
310
22.4k
{
311
22.4k
  Assert(PageIsValid(page));
312
22.4k
  Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
313
22.4k
  Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
314
315
22.4k
  return true;
316
22.4k
}
Unexecuted instantiation: gistscan.c:PageValidateSpecialPointer
Unexecuted instantiation: gistproc.c:PageValidateSpecialPointer
Unexecuted instantiation: gistsplit.c:PageValidateSpecialPointer
Unexecuted instantiation: gistbuild.c:PageValidateSpecialPointer
Unexecuted instantiation: gistbuildbuffers.c:PageValidateSpecialPointer
Unexecuted instantiation: gistvalidate.c:PageValidateSpecialPointer
Unexecuted instantiation: hash.c:PageValidateSpecialPointer
Unexecuted instantiation: hashfunc.c:PageValidateSpecialPointer
Unexecuted instantiation: hashinsert.c:PageValidateSpecialPointer
Unexecuted instantiation: hashovfl.c:PageValidateSpecialPointer
Unexecuted instantiation: hashpage.c:PageValidateSpecialPointer
Unexecuted instantiation: hashsearch.c:PageValidateSpecialPointer
Unexecuted instantiation: hashsort.c:PageValidateSpecialPointer
Unexecuted instantiation: hashutil.c:PageValidateSpecialPointer
Unexecuted instantiation: hashvalidate.c:PageValidateSpecialPointer
Unexecuted instantiation: hash_xlog.c:PageValidateSpecialPointer
Unexecuted instantiation: heapam.c:PageValidateSpecialPointer
Unexecuted instantiation: hio.c:PageValidateSpecialPointer
Unexecuted instantiation: pruneheap.c:PageValidateSpecialPointer
Unexecuted instantiation: rewriteheap.c:PageValidateSpecialPointer
Unexecuted instantiation: syncscan.c:PageValidateSpecialPointer
Unexecuted instantiation: tuptoaster.c:PageValidateSpecialPointer
Unexecuted instantiation: visibilitymap.c:PageValidateSpecialPointer
Unexecuted instantiation: amapi.c:PageValidateSpecialPointer
Unexecuted instantiation: amvalidate.c:PageValidateSpecialPointer
Unexecuted instantiation: genam.c:PageValidateSpecialPointer
Unexecuted instantiation: indexam.c:PageValidateSpecialPointer
nbtinsert.c:PageValidateSpecialPointer
Line
Count
Source
310
253
{
311
253
  Assert(PageIsValid(page));
312
253
  Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
313
253
  Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
314
315
253
  return true;
316
253
}
nbtpage.c:PageValidateSpecialPointer
Line
Count
Source
310
224
{
311
224
  Assert(PageIsValid(page));
312
224
  Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
313
224
  Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
314
315
224
  return true;
316
224
}
Unexecuted instantiation: nbtree.c:PageValidateSpecialPointer
nbtsearch.c:PageValidateSpecialPointer
Line
Count
Source
310
626
{
311
626
  Assert(PageIsValid(page));
312
626
  Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
313
626
  Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
314
315
626
  return true;
316
626
}
nbtutils.c:PageValidateSpecialPointer
Line
Count
Source
310
175
{
311
175
  Assert(PageIsValid(page));
312
175
  Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
313
175
  Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
314
315
175
  return true;
316
175
}
Unexecuted instantiation: nbtsort.c:PageValidateSpecialPointer
Unexecuted instantiation: nbtvalidate.c:PageValidateSpecialPointer
Unexecuted instantiation: nbtxlog.c:PageValidateSpecialPointer
Unexecuted instantiation: spgutils.c:PageValidateSpecialPointer
Unexecuted instantiation: spginsert.c:PageValidateSpecialPointer
Unexecuted instantiation: spgscan.c:PageValidateSpecialPointer
Unexecuted instantiation: spgvacuum.c:PageValidateSpecialPointer
Unexecuted instantiation: spgvalidate.c:PageValidateSpecialPointer
Unexecuted instantiation: spgdoinsert.c:PageValidateSpecialPointer
Unexecuted instantiation: spgxlog.c:PageValidateSpecialPointer
Unexecuted instantiation: bernoulli.c:PageValidateSpecialPointer
Unexecuted instantiation: system.c:PageValidateSpecialPointer
Unexecuted instantiation: tablesample.c:PageValidateSpecialPointer
Unexecuted instantiation: clog.c:PageValidateSpecialPointer
Unexecuted instantiation: commit_ts.c:PageValidateSpecialPointer
Unexecuted instantiation: generic_xlog.c:PageValidateSpecialPointer
Unexecuted instantiation: multixact.c:PageValidateSpecialPointer
Unexecuted instantiation: parallel.c:PageValidateSpecialPointer
Unexecuted instantiation: rmgr.c:PageValidateSpecialPointer
Unexecuted instantiation: twophase.c:PageValidateSpecialPointer
Unexecuted instantiation: varsup.c:PageValidateSpecialPointer
Unexecuted instantiation: xact.c:PageValidateSpecialPointer
Unexecuted instantiation: xlog.c:PageValidateSpecialPointer
Unexecuted instantiation: xlogfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: xloginsert.c:PageValidateSpecialPointer
Unexecuted instantiation: xlogutils.c:PageValidateSpecialPointer
Unexecuted instantiation: yb_scan.c:PageValidateSpecialPointer
Unexecuted instantiation: yb_lsm.c:PageValidateSpecialPointer
Unexecuted instantiation: ybgin.c:PageValidateSpecialPointer
Unexecuted instantiation: ybginget.c:PageValidateSpecialPointer
Unexecuted instantiation: ybginscan.c:PageValidateSpecialPointer
Unexecuted instantiation: ybginutil.c:PageValidateSpecialPointer
Unexecuted instantiation: ybginwrite.c:PageValidateSpecialPointer
Unexecuted instantiation: bootparse.c:PageValidateSpecialPointer
Unexecuted instantiation: bootstrap.c:PageValidateSpecialPointer
Unexecuted instantiation: ybcbootstrap.c:PageValidateSpecialPointer
Unexecuted instantiation: yb_type.c:PageValidateSpecialPointer
Unexecuted instantiation: yb_catalog_version.c:PageValidateSpecialPointer
Unexecuted instantiation: catalog.c:PageValidateSpecialPointer
Unexecuted instantiation: dependency.c:PageValidateSpecialPointer
Unexecuted instantiation: heap.c:PageValidateSpecialPointer
Unexecuted instantiation: index.c:PageValidateSpecialPointer
Unexecuted instantiation: indexing.c:PageValidateSpecialPointer
Unexecuted instantiation: namespace.c:PageValidateSpecialPointer
Unexecuted instantiation: aclchk.c:PageValidateSpecialPointer
Unexecuted instantiation: objectaddress.c:PageValidateSpecialPointer
Unexecuted instantiation: partition.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_aggregate.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_collation.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_constraint.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_conversion.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_depend.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_enum.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_inherits.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_largeobject.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_namespace.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_operator.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_proc.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_publication.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_range.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_db_role_setting.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_shdepend.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_subscription.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_type.c:PageValidateSpecialPointer
Unexecuted instantiation: storage.c:PageValidateSpecialPointer
Unexecuted instantiation: toasting.c:PageValidateSpecialPointer
Unexecuted instantiation: gram.c:PageValidateSpecialPointer
Unexecuted instantiation: parse_clause.c:PageValidateSpecialPointer
Unexecuted instantiation: parse_coerce.c:PageValidateSpecialPointer
Unexecuted instantiation: parse_expr.c:PageValidateSpecialPointer
Unexecuted instantiation: parse_func.c:PageValidateSpecialPointer
Unexecuted instantiation: parse_node.c:PageValidateSpecialPointer
Unexecuted instantiation: parse_oper.c:PageValidateSpecialPointer
Unexecuted instantiation: parse_relation.c:PageValidateSpecialPointer
Unexecuted instantiation: parse_target.c:PageValidateSpecialPointer
Unexecuted instantiation: parse_type.c:PageValidateSpecialPointer
Unexecuted instantiation: parse_utilcmd.c:PageValidateSpecialPointer
Unexecuted instantiation: amcmds.c:PageValidateSpecialPointer
Unexecuted instantiation: aggregatecmds.c:PageValidateSpecialPointer
Unexecuted instantiation: alter.c:PageValidateSpecialPointer
Unexecuted instantiation: analyze.c:PageValidateSpecialPointer
Unexecuted instantiation: async.c:PageValidateSpecialPointer
Unexecuted instantiation: cluster.c:PageValidateSpecialPointer
Unexecuted instantiation: comment.c:PageValidateSpecialPointer
Unexecuted instantiation: collationcmds.c:PageValidateSpecialPointer
Unexecuted instantiation: constraint.c:PageValidateSpecialPointer
Unexecuted instantiation: conversioncmds.c:PageValidateSpecialPointer
Unexecuted instantiation: copy.c:PageValidateSpecialPointer
Unexecuted instantiation: createas.c:PageValidateSpecialPointer
Unexecuted instantiation: dbcommands.c:PageValidateSpecialPointer
Unexecuted instantiation: discard.c:PageValidateSpecialPointer
Unexecuted instantiation: dropcmds.c:PageValidateSpecialPointer
Unexecuted instantiation: event_trigger.c:PageValidateSpecialPointer
Unexecuted instantiation: explain.c:PageValidateSpecialPointer
Unexecuted instantiation: extension.c:PageValidateSpecialPointer
Unexecuted instantiation: foreigncmds.c:PageValidateSpecialPointer
Unexecuted instantiation: functioncmds.c:PageValidateSpecialPointer
Unexecuted instantiation: indexcmds.c:PageValidateSpecialPointer
Unexecuted instantiation: lockcmds.c:PageValidateSpecialPointer
Unexecuted instantiation: matview.c:PageValidateSpecialPointer
Unexecuted instantiation: operatorcmds.c:PageValidateSpecialPointer
Unexecuted instantiation: opclasscmds.c:PageValidateSpecialPointer
Unexecuted instantiation: policy.c:PageValidateSpecialPointer
Unexecuted instantiation: portalcmds.c:PageValidateSpecialPointer
Unexecuted instantiation: prepare.c:PageValidateSpecialPointer
Unexecuted instantiation: proclang.c:PageValidateSpecialPointer
Unexecuted instantiation: publicationcmds.c:PageValidateSpecialPointer
Unexecuted instantiation: schemacmds.c:PageValidateSpecialPointer
Unexecuted instantiation: seclabel.c:PageValidateSpecialPointer
Unexecuted instantiation: sequence.c:PageValidateSpecialPointer
Unexecuted instantiation: statscmds.c:PageValidateSpecialPointer
Unexecuted instantiation: subscriptioncmds.c:PageValidateSpecialPointer
Unexecuted instantiation: tablecmds.c:PageValidateSpecialPointer
Unexecuted instantiation: tablespace.c:PageValidateSpecialPointer
Unexecuted instantiation: tablegroup.c:PageValidateSpecialPointer
Unexecuted instantiation: trigger.c:PageValidateSpecialPointer
Unexecuted instantiation: tsearchcmds.c:PageValidateSpecialPointer
Unexecuted instantiation: typecmds.c:PageValidateSpecialPointer
Unexecuted instantiation: user.c:PageValidateSpecialPointer
Unexecuted instantiation: vacuum.c:PageValidateSpecialPointer
Unexecuted instantiation: vacuumlazy.c:PageValidateSpecialPointer
Unexecuted instantiation: variable.c:PageValidateSpecialPointer
Unexecuted instantiation: view.c:PageValidateSpecialPointer
Unexecuted instantiation: ybccmds.c:PageValidateSpecialPointer
Unexecuted instantiation: ybc_builtin.c:PageValidateSpecialPointer
Unexecuted instantiation: execAmi.c:PageValidateSpecialPointer
Unexecuted instantiation: execCurrent.c:PageValidateSpecialPointer
Unexecuted instantiation: execExpr.c:PageValidateSpecialPointer
Unexecuted instantiation: execExprInterp.c:PageValidateSpecialPointer
Unexecuted instantiation: execGrouping.c:PageValidateSpecialPointer
Unexecuted instantiation: execIndexing.c:PageValidateSpecialPointer
Unexecuted instantiation: execJunk.c:PageValidateSpecialPointer
Unexecuted instantiation: execMain.c:PageValidateSpecialPointer
Unexecuted instantiation: execParallel.c:PageValidateSpecialPointer
Unexecuted instantiation: execPartition.c:PageValidateSpecialPointer
Unexecuted instantiation: execProcnode.c:PageValidateSpecialPointer
Unexecuted instantiation: execReplication.c:PageValidateSpecialPointer
Unexecuted instantiation: execScan.c:PageValidateSpecialPointer
Unexecuted instantiation: execSRF.c:PageValidateSpecialPointer
Unexecuted instantiation: execTuples.c:PageValidateSpecialPointer
Unexecuted instantiation: execUtils.c:PageValidateSpecialPointer
Unexecuted instantiation: functions.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeAppend.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeAgg.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeBitmapAnd.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeBitmapOr.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeBitmapHeapscan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeBitmapIndexscan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeCustom.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeFunctionscan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeGather.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeHash.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeHashjoin.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeIndexscan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeIndexonlyscan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeLimit.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeLockRows.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeGatherMerge.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeMaterial.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeMergeAppend.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeMergejoin.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeModifyTable.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeNestloop.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeProjectSet.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeRecursiveunion.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeResult.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeSamplescan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeSeqscan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeSetOp.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeSort.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeUnique.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeValuesscan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeCtescan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeNamedtuplestorescan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeWorktablescan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeGroup.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeSubplan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeSubqueryscan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeTidscan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeForeignscan.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeWindowAgg.c:PageValidateSpecialPointer
Unexecuted instantiation: tstoreReceiver.c:PageValidateSpecialPointer
Unexecuted instantiation: tqueue.c:PageValidateSpecialPointer
Unexecuted instantiation: spi.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeTableFuncscan.c:PageValidateSpecialPointer
Unexecuted instantiation: ybc_fdw.c:PageValidateSpecialPointer
Unexecuted instantiation: ybcModifyTable.c:PageValidateSpecialPointer
Unexecuted instantiation: ybcExpr.c:PageValidateSpecialPointer
Unexecuted instantiation: foreign.c:PageValidateSpecialPointer
Unexecuted instantiation: bloomfilter.c:PageValidateSpecialPointer
Unexecuted instantiation: hba.c:PageValidateSpecialPointer
Unexecuted instantiation: main.c:PageValidateSpecialPointer
Unexecuted instantiation: nodeFuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: bitmapset.c:PageValidateSpecialPointer
Unexecuted instantiation: tidbitmap.c:PageValidateSpecialPointer
Unexecuted instantiation: copyfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: equalfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: extensible.c:PageValidateSpecialPointer
Unexecuted instantiation: outfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: readfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: print.c:PageValidateSpecialPointer
Unexecuted instantiation: allpaths.c:PageValidateSpecialPointer
Unexecuted instantiation: costsize.c:PageValidateSpecialPointer
Unexecuted instantiation: joinpath.c:PageValidateSpecialPointer
Unexecuted instantiation: createplan.c:PageValidateSpecialPointer
Unexecuted instantiation: planagg.c:PageValidateSpecialPointer
Unexecuted instantiation: planner.c:PageValidateSpecialPointer
Unexecuted instantiation: subselect.c:PageValidateSpecialPointer
Unexecuted instantiation: preptlist.c:PageValidateSpecialPointer
Unexecuted instantiation: prepunion.c:PageValidateSpecialPointer
Unexecuted instantiation: clauses.c:PageValidateSpecialPointer
Unexecuted instantiation: pathnode.c:PageValidateSpecialPointer
Unexecuted instantiation: plancat.c:PageValidateSpecialPointer
Unexecuted instantiation: predtest.c:PageValidateSpecialPointer
Unexecuted instantiation: ybcplan.c:PageValidateSpecialPointer
Unexecuted instantiation: partprune.c:PageValidateSpecialPointer
Unexecuted instantiation: partbounds.c:PageValidateSpecialPointer
Unexecuted instantiation: autovacuum.c:PageValidateSpecialPointer
Unexecuted instantiation: bgwriter.c:PageValidateSpecialPointer
Unexecuted instantiation: checkpointer.c:PageValidateSpecialPointer
Unexecuted instantiation: pgstat.c:PageValidateSpecialPointer
Unexecuted instantiation: postmaster.c:PageValidateSpecialPointer
Unexecuted instantiation: walwriter.c:PageValidateSpecialPointer
Unexecuted instantiation: decode.c:PageValidateSpecialPointer
Unexecuted instantiation: launcher.c:PageValidateSpecialPointer
Unexecuted instantiation: logical.c:PageValidateSpecialPointer
Unexecuted instantiation: logicalfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: message.c:PageValidateSpecialPointer
Unexecuted instantiation: origin.c:PageValidateSpecialPointer
Unexecuted instantiation: proto.c:PageValidateSpecialPointer
Unexecuted instantiation: relation.c:PageValidateSpecialPointer
Unexecuted instantiation: reorderbuffer.c:PageValidateSpecialPointer
Unexecuted instantiation: snapbuild.c:PageValidateSpecialPointer
Unexecuted instantiation: tablesync.c:PageValidateSpecialPointer
Unexecuted instantiation: worker.c:PageValidateSpecialPointer
Unexecuted instantiation: walsender.c:PageValidateSpecialPointer
Unexecuted instantiation: walreceiverfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: walreceiver.c:PageValidateSpecialPointer
Unexecuted instantiation: basebackup.c:PageValidateSpecialPointer
Unexecuted instantiation: slotfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: rewriteRemove.c:PageValidateSpecialPointer
Unexecuted instantiation: rewriteDefine.c:PageValidateSpecialPointer
Unexecuted instantiation: rewriteHandler.c:PageValidateSpecialPointer
Unexecuted instantiation: rewriteSupport.c:PageValidateSpecialPointer
Unexecuted instantiation: rowsecurity.c:PageValidateSpecialPointer
Unexecuted instantiation: extended_stats.c:PageValidateSpecialPointer
Unexecuted instantiation: dependencies.c:PageValidateSpecialPointer
Unexecuted instantiation: mvdistinct.c:PageValidateSpecialPointer
Unexecuted instantiation: buf_table.c:PageValidateSpecialPointer
Unexecuted instantiation: buf_init.c:PageValidateSpecialPointer
Unexecuted instantiation: bufmgr.c:PageValidateSpecialPointer
Unexecuted instantiation: freelist.c:PageValidateSpecialPointer
Unexecuted instantiation: localbuf.c:PageValidateSpecialPointer
Unexecuted instantiation: buffile.c:PageValidateSpecialPointer
Unexecuted instantiation: sharedfileset.c:PageValidateSpecialPointer
Unexecuted instantiation: freespace.c:PageValidateSpecialPointer
Unexecuted instantiation: fsmpage.c:PageValidateSpecialPointer
Unexecuted instantiation: ipci.c:PageValidateSpecialPointer
Unexecuted instantiation: standby.c:PageValidateSpecialPointer
Unexecuted instantiation: inv_api.c:PageValidateSpecialPointer
Unexecuted instantiation: predicate.c:PageValidateSpecialPointer
bufpage.c:PageValidateSpecialPointer
Line
Count
Source
310
638
{
311
638
  Assert(PageIsValid(page));
312
638
  Assert(((PageHeader) (page))->pd_special <= BLCKSZ);
313
638
  Assert(((PageHeader) (page))->pd_special >= SizeOfPageHeaderData);
314
315
638
  return true;
316
638
}
Unexecuted instantiation: checksum.c:PageValidateSpecialPointer
Unexecuted instantiation: md.c:PageValidateSpecialPointer
Unexecuted instantiation: smgr.c:PageValidateSpecialPointer
Unexecuted instantiation: dest.c:PageValidateSpecialPointer
Unexecuted instantiation: fastpath.c:PageValidateSpecialPointer
Unexecuted instantiation: postgres.c:PageValidateSpecialPointer
Unexecuted instantiation: pquery.c:PageValidateSpecialPointer
Unexecuted instantiation: utility.c:PageValidateSpecialPointer
Unexecuted instantiation: wparser.c:PageValidateSpecialPointer
Unexecuted instantiation: ts_selfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: ts_typanalyze.c:PageValidateSpecialPointer
Unexecuted instantiation: acl.c:PageValidateSpecialPointer
Unexecuted instantiation: amutils.c:PageValidateSpecialPointer
Unexecuted instantiation: arrayfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: array_selfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: array_typanalyze.c:PageValidateSpecialPointer
Unexecuted instantiation: date.c:PageValidateSpecialPointer
Unexecuted instantiation: datetime.c:PageValidateSpecialPointer
Unexecuted instantiation: dbsize.c:PageValidateSpecialPointer
Unexecuted instantiation: domains.c:PageValidateSpecialPointer
Unexecuted instantiation: enum.c:PageValidateSpecialPointer
Unexecuted instantiation: expandedrecord.c:PageValidateSpecialPointer
Unexecuted instantiation: format_type.c:PageValidateSpecialPointer
Unexecuted instantiation: genfile.c:PageValidateSpecialPointer
Unexecuted instantiation: int.c:PageValidateSpecialPointer
Unexecuted instantiation: int8.c:PageValidateSpecialPointer
Unexecuted instantiation: json.c:PageValidateSpecialPointer
Unexecuted instantiation: jsonb.c:PageValidateSpecialPointer
Unexecuted instantiation: jsonb_gin.c:PageValidateSpecialPointer
Unexecuted instantiation: jsonb_util.c:PageValidateSpecialPointer
Unexecuted instantiation: jsonfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: jsonpath.c:PageValidateSpecialPointer
Unexecuted instantiation: jsonpath_exec.c:PageValidateSpecialPointer
Unexecuted instantiation: lockfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: mac.c:PageValidateSpecialPointer
Unexecuted instantiation: mac8.c:PageValidateSpecialPointer
Unexecuted instantiation: misc.c:PageValidateSpecialPointer
Unexecuted instantiation: network.c:PageValidateSpecialPointer
Unexecuted instantiation: network_gist.c:PageValidateSpecialPointer
Unexecuted instantiation: network_selfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: numeric.c:PageValidateSpecialPointer
Unexecuted instantiation: orderedsetaggs.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_locale.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_lsn.c:PageValidateSpecialPointer
Unexecuted instantiation: pgstatfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: rangetypes.c:PageValidateSpecialPointer
Unexecuted instantiation: rangetypes_gist.c:PageValidateSpecialPointer
Unexecuted instantiation: rangetypes_selfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: regexp.c:PageValidateSpecialPointer
Unexecuted instantiation: regproc.c:PageValidateSpecialPointer
Unexecuted instantiation: ri_triggers.c:PageValidateSpecialPointer
Unexecuted instantiation: rowtypes.c:PageValidateSpecialPointer
Unexecuted instantiation: ruleutils.c:PageValidateSpecialPointer
Unexecuted instantiation: selfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: tid.c:PageValidateSpecialPointer
Unexecuted instantiation: timestamp.c:PageValidateSpecialPointer
Unexecuted instantiation: trigfuncs.c:PageValidateSpecialPointer
Unexecuted instantiation: tsgistidx.c:PageValidateSpecialPointer
Unexecuted instantiation: tsquery_gist.c:PageValidateSpecialPointer
Unexecuted instantiation: tsquery_rewrite.c:PageValidateSpecialPointer
Unexecuted instantiation: tsvector_op.c:PageValidateSpecialPointer
Unexecuted instantiation: txid.c:PageValidateSpecialPointer
Unexecuted instantiation: uuid.c:PageValidateSpecialPointer
Unexecuted instantiation: varbit.c:PageValidateSpecialPointer
Unexecuted instantiation: varchar.c:PageValidateSpecialPointer
Unexecuted instantiation: varlena.c:PageValidateSpecialPointer
Unexecuted instantiation: xml.c:PageValidateSpecialPointer
Unexecuted instantiation: catcache.c:PageValidateSpecialPointer
Unexecuted instantiation: evtcache.c:PageValidateSpecialPointer
Unexecuted instantiation: inval.c:PageValidateSpecialPointer
Unexecuted instantiation: lsyscache.c:PageValidateSpecialPointer
Unexecuted instantiation: partcache.c:PageValidateSpecialPointer
Unexecuted instantiation: plancache.c:PageValidateSpecialPointer
Unexecuted instantiation: relcache.c:PageValidateSpecialPointer
Unexecuted instantiation: relfilenodemap.c:PageValidateSpecialPointer
Unexecuted instantiation: spccache.c:PageValidateSpecialPointer
Unexecuted instantiation: syscache.c:PageValidateSpecialPointer
Unexecuted instantiation: ts_cache.c:PageValidateSpecialPointer
Unexecuted instantiation: typcache.c:PageValidateSpecialPointer
Unexecuted instantiation: fmgr.c:PageValidateSpecialPointer
Unexecuted instantiation: funcapi.c:PageValidateSpecialPointer
Unexecuted instantiation: hashfn.c:PageValidateSpecialPointer
Unexecuted instantiation: miscinit.c:PageValidateSpecialPointer
Unexecuted instantiation: postinit.c:PageValidateSpecialPointer
Unexecuted instantiation: guc.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_config.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_controldata.c:PageValidateSpecialPointer
Unexecuted instantiation: queryenvironment.c:PageValidateSpecialPointer
Unexecuted instantiation: rls.c:PageValidateSpecialPointer
Unexecuted instantiation: superuser.c:PageValidateSpecialPointer
Unexecuted instantiation: pg_yb_utils.c:PageValidateSpecialPointer
Unexecuted instantiation: portalmem.c:PageValidateSpecialPointer
Unexecuted instantiation: resowner.c:PageValidateSpecialPointer
Unexecuted instantiation: sharedtuplestore.c:PageValidateSpecialPointer
Unexecuted instantiation: sortsupport.c:PageValidateSpecialPointer
Unexecuted instantiation: tuplesort.c:PageValidateSpecialPointer
Unexecuted instantiation: tuplestore.c:PageValidateSpecialPointer
Unexecuted instantiation: combocid.c:PageValidateSpecialPointer
Unexecuted instantiation: tqual.c:PageValidateSpecialPointer
Unexecuted instantiation: jit.c:PageValidateSpecialPointer
Unexecuted instantiation: ybgate_api.c:PageValidateSpecialPointer
317
318
/*
319
 * PageGetSpecialPointer
320
 *    Returns pointer to special space on a page.
321
 */
322
189k
#define PageGetSpecialPointer(page) \
323
189k
( \
324
189k
  AssertMacro(PageValidateSpecialPointer(page)), \
325
0
  (char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
326
189k
)
327
328
/*
329
 * PageGetItem
330
 *    Retrieves an item on the given page.
331
 *
332
 * Note:
333
 *    This does not change the status of any of the resources passed.
334
 *    The semantics may change in the future.
335
 */
336
910k
#define PageGetItem(page, itemId) \
337
910k
( \
338
910k
  AssertMacro(PageIsValid(page)), \
339
910k
  AssertMacro(ItemIdHasStorage(itemId)), \
340
910k
  (Item)(((char *)(page)) + ItemIdGetOffset(itemId)) \
341
910k
)
342
343
/*
344
 * PageGetMaxOffsetNumber
345
 *    Returns the maximum offset number used by the given page.
346
 *    Since offset numbers are 1-based, this is also the number
347
 *    of items on the page.
348
 *
349
 *    NOTE: if the page is not initialized (pd_lower == 0), we must
350
 *    return zero to ensure sane behavior.  Accept double evaluation
351
 *    of the argument so that we can ensure this.
352
 */
353
#define PageGetMaxOffsetNumber(page) \
354
74.1k
  (((PageHeader) (page))->pd_lower <= SizeOfPageHeaderData ? 0 : \
355
74.0k
   ((((PageHeader) (page))->pd_lower - SizeOfPageHeaderData) \
356
74.0k
    / sizeof(ItemIdData)))
357
358
/*
359
 * Additional macros for access to page headers. (Beware multiple evaluation
360
 * of the arguments!)
361
 */
362
#define PageGetLSN(page) \
363
72.2k
  PageXLogRecPtrGet(((PageHeader) (page))->pd_lsn)
364
#define PageSetLSN(page, lsn) \
365
20.9k
  PageXLogRecPtrSet(((PageHeader) (page))->pd_lsn, lsn)
366
367
#define PageHasFreeLinePointers(page) \
368
21.1k
  (((PageHeader) (page))->pd_flags & PD_HAS_FREE_LINES)
369
#define PageSetHasFreeLinePointers(page) \
370
0
  (((PageHeader) (page))->pd_flags |= PD_HAS_FREE_LINES)
371
#define PageClearHasFreeLinePointers(page) \
372
0
  (((PageHeader) (page))->pd_flags &= ~PD_HAS_FREE_LINES)
373
374
#define PageIsFull(page) \
375
215
  (((PageHeader) (page))->pd_flags & PD_PAGE_FULL)
376
#define PageSetFull(page) \
377
0
  (((PageHeader) (page))->pd_flags |= PD_PAGE_FULL)
378
#define PageClearFull(page) \
379
0
  (((PageHeader) (page))->pd_flags &= ~PD_PAGE_FULL)
380
381
#define PageIsAllVisible(page) \
382
316k
  (((PageHeader) (page))->pd_flags & PD_ALL_VISIBLE)
383
#define PageSetAllVisible(page) \
384
1
  (((PageHeader) (page))->pd_flags |= PD_ALL_VISIBLE)
385
#define PageClearAllVisible(page) \
386
0
  (((PageHeader) (page))->pd_flags &= ~PD_ALL_VISIBLE)
387
388
341
#define PageIsPrunable(page, oldestxmin) \
389
341
( \
390
341
  AssertMacro(TransactionIdIsNormal(oldestxmin)), \
391
341
  TransactionIdIsValid(((PageHeader) (page))->pd_prune_xid) && \
392
97
  TransactionIdPrecedes(((PageHeader) (page))->pd_prune_xid, oldestxmin) \
393
341
)
394
64
#define PageSetPrunable(page, xid) \
395
64
do { \
396
64
  Assert(TransactionIdIsNormal(xid)); \
397
64
  if (!TransactionIdIsValid(((PageHeader) (page))->pd_prune_xid) || \
398
49
    TransactionIdPrecedes(xid, ((PageHeader) (page))->pd_prune_xid)) \
399
15
    ((PageHeader) (page))->pd_prune_xid = (xid); \
400
64
} while (0)
401
#define PageClearPrunable(page) \
402
  (((PageHeader) (page))->pd_prune_xid = InvalidTransactionId)
403
404
405
/* ----------------------------------------------------------------
406
 *    extern declarations
407
 * ----------------------------------------------------------------
408
 */
409
59.6k
#define PAI_OVERWRITE     (1 << 0)
410
101k
#define PAI_IS_HEAP       (1 << 1)
411
412
#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap) \
413
80.8k
  PageAddItemExtended(page, item, size, offsetNumber, \
414
80.8k
            ((overwrite) ? PAI_OVERWRITE : 0) | \
415
59.6k
            ((is_heap) ? PAI_IS_HEAP : 0))
416
417
extern void PageInit(Page page, Size pageSize, Size specialSize);
418
extern bool PageIsVerified(Page page, BlockNumber blkno);
419
extern OffsetNumber PageAddItemExtended(Page page, Item item, Size size,
420
          OffsetNumber offsetNumber, int flags);
421
extern Page PageGetTempPage(Page page);
422
extern Page PageGetTempPageCopy(Page page);
423
extern Page PageGetTempPageCopySpecial(Page page);
424
extern void PageRestoreTempPage(Page tempPage, Page oldPage);
425
extern void PageRepairFragmentation(Page page);
426
extern Size PageGetFreeSpace(Page page);
427
extern Size PageGetFreeSpaceForMultipleTuples(Page page, int ntups);
428
extern Size PageGetExactFreeSpace(Page page);
429
extern Size PageGetHeapFreeSpace(Page page);
430
extern void PageIndexTupleDelete(Page page, OffsetNumber offset);
431
extern void PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems);
432
extern void PageIndexTupleDeleteNoCompact(Page page, OffsetNumber offset);
433
extern bool PageIndexTupleOverwrite(Page page, OffsetNumber offnum,
434
            Item newtup, Size newsize);
435
extern char *PageSetChecksumCopy(Page page, BlockNumber blkno);
436
extern void PageSetChecksumInplace(Page page, BlockNumber blkno);
437
438
#endif              /* BUFPAGE_H */