77 bool all_visible_cleared,
bool new_all_visible_cleared);
85 bool *have_tuple_lock);
159 #define LOCKMODE_from_mxstatus(status) \
160 (tupleLockExtraInfo[TUPLOCK_from_mxstatus((status))].hwlock)
167 #define LockTupleTuplock(rel, tup, mode) \
168 LockTuple((rel), (tup), tupleLockExtraInfo[mode].hwlock)
169 #define UnlockTupleTuplock(rel, tup, mode) \
170 UnlockTuple((rel), (tup), tupleLockExtraInfo[mode].hwlock)
171 #define ConditionalLockTupleTuplock(rel, tup, mode) \
172 ConditionalLockTuple((rel), (tup), tupleLockExtraInfo[mode].hwlock)
185 } IndexDeletePrefetchState;
189 #define BOTTOMUP_MAX_NBLOCKS 6
190 #define BOTTOMUP_TOLERANCE_NBLOCKS 3
218 #define TUPLOCK_from_mxstatus(status) \
219 (MultiXactStatusLock[(status)])
232 void *callback_private_data,
233 void *per_buffer_data)
270 void *callback_private_data,
271 void *per_buffer_data)
337 allow_strat = allow_sync =
false;
360 else if (keep_startblock)
430 Assert(startBlk == 0 || startBlk < scan->rs_nblocks);
446 bool all_visible,
bool check_serializable)
470 if (check_serializable)
472 &loctup, buffer, snapshot);
502 bool check_serializable;
557 if (
likely(!check_serializable))
559 block, lines,
true,
false);
562 block, lines,
true,
true);
566 if (
likely(!check_serializable))
568 block, lines,
false,
false);
571 block, lines,
false,
true);
731 *linesleft = *lineoff;
880 for (; linesleft > 0; linesleft--, lineoff += dir)
989 linesleft = scan->rs_ntuples;
995 for (; linesleft > 0; linesleft--, lineindex += dir)
1000 lineoff = scan->rs_vistuples[lineindex];
1014 scan->rs_cindex = lineindex;
1104 if (parallel_scan != NULL)
1152 bool allow_strat,
bool allow_sync,
bool allow_pagemode)
1261 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1272 elog(
ERROR,
"unexpected heap_getnext call during logical decoding");
1629 bool *all_dead,
bool first_call)
1635 bool at_chain_start;
1642 *all_dead = first_call;
1646 at_chain_start = first_call;
1672 at_chain_start =
false;
1739 if (all_dead && *all_dead)
1757 at_chain_start =
false;
1997 bool all_visible_cleared =
false;
2045 all_visible_cleared =
true;
2096 if (all_visible_cleared)
2190 (
errcode(ERRCODE_INVALID_TRANSACTION_STATE),
2191 errmsg(
"cannot insert tuples in a parallel worker")));
2208 if (relation->
rd_rel->relkind != RELKIND_RELATION &&
2209 relation->
rd_rel->relkind != RELKIND_MATVIEW)
2232 for (
int i = done;
i < ntuples;
i++)
2236 if (page_avail < tup_sz)
2241 page_avail -= tup_sz;
2273 bool starting_with_empty_page =
false;
2275 int npages_used = 0;
2286 for (
i = 0;
i < ntuples;
i++)
2323 while (ndone < ntuples)
2326 bool all_visible_cleared =
false;
2327 bool all_frozen_set =
false;
2342 if (ndone == 0 || !starting_with_empty_page)
2361 npages - npages_used);
2367 all_frozen_set =
true;
2382 if (needwal && need_cids)
2385 for (nthispage = 1; ndone + nthispage < ntuples; nthispage++)
2387 HeapTuple heaptup = heaptuples[ndone + nthispage];
2398 if (needwal && need_cids)
2411 all_visible_cleared =
true;
2417 else if (all_frozen_set)
2434 char *scratchptr = scratch.
data;
2442 init = starting_with_empty_page;
2458 tupledata = scratchptr;
2461 Assert(!(all_visible_cleared && all_frozen_set));
2464 if (all_visible_cleared)
2475 for (
i = 0;
i < nthispage;
i++)
2497 scratchptr += datalen;
2499 totaldatalen = scratchptr - tupledata;
2500 Assert((scratchptr - scratch.
data) < BLCKSZ);
2502 if (need_tuple_data)
2510 if (ndone + nthispage == ntuples)
2523 if (need_tuple_data)
2600 for (
i = 0;
i < ntuples;
i++)
2605 for (
i = 0;
i < ntuples;
i++)
2606 slots[
i]->tts_tid = heaptuples[
i]->t_self;
2658 const uint16 interesting =
2661 if ((new_infomask & interesting) != (old_infomask & interesting))
2694 bool have_tuple_lock =
false;
2696 bool all_visible_cleared =
false;
2698 bool old_key_copied =
false;
2709 (
errcode(ERRCODE_INVALID_TRANSACTION_STATE),
2710 errmsg(
"cannot delete tuples during a parallel operation")));
2756 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
2757 errmsg(
"attempted to delete invisible tuple")));
2783 bool current_is_member =
false;
2794 if (!current_is_member)
2874 if (result !=
TM_Ok)
2892 if (result !=
TM_Ok)
2901 if (have_tuple_lock)
2941 &new_xmax, &new_infomask, &new_infomask2);
2956 all_visible_cleared =
true;
2999 if (all_visible_cleared)
3006 xlrec.
xmax = new_xmax;
3008 if (old_key_tuple != NULL)
3010 if (relation->
rd_rel->relreplident == REPLICA_IDENTITY_FULL)
3024 if (old_key_tuple != NULL)
3033 old_key_tuple->
t_len
3058 if (relation->
rd_rel->relkind != RELKIND_RELATION &&
3059 relation->
rd_rel->relkind != RELKIND_MATVIEW)
3080 if (have_tuple_lock)
3085 if (old_key_tuple != NULL && old_key_copied)
3113 elog(
ERROR,
"tuple already updated by self");
3121 elog(
ERROR,
"tuple concurrently updated");
3125 elog(
ERROR,
"tuple concurrently deleted");
3129 elog(
ERROR,
"unrecognized heap_delete status: %u", result);
3163 bool old_key_copied =
false;
3174 bool have_tuple_lock =
false;
3176 bool use_hot_update =
false;
3177 bool summarized_update =
false;
3179 bool all_visible_cleared =
false;
3180 bool all_visible_cleared_new =
false;
3181 bool checked_lockers;
3182 bool locker_remains;
3183 bool id_has_external =
false;
3186 uint16 infomask_old_tuple,
3187 infomask2_old_tuple,
3189 infomask2_new_tuple;
3204 (
errcode(ERRCODE_INVALID_TRANSACTION_STATE),
3205 errmsg(
"cannot update tuples during a parallel operation")));
3230 interesting_attrs = NULL;
3276 newtup, &id_has_external);
3321 checked_lockers =
false;
3322 locker_remains =
false;
3332 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
3333 errmsg(
"attempted to update invisible tuple")));
3339 bool can_continue =
false;
3384 bool current_is_member =
false;
3387 *lockmode, ¤t_is_member))
3395 if (!current_is_member)
3403 checked_lockers =
true;
3404 locker_remains = remain != 0;
3451 can_continue =
true;
3459 checked_lockers =
true;
3460 locker_remains =
true;
3461 can_continue =
true;
3470 checked_lockers =
true;
3471 locker_remains =
true;
3472 can_continue =
true;
3485 checked_lockers =
true;
3501 can_continue =
true;
3513 if (result !=
TM_Ok)
3531 if (result !=
TM_Ok)
3540 if (have_tuple_lock)
3581 xid, *lockmode,
true,
3582 &xmax_old_tuple, &infomask_old_tuple,
3583 &infomask2_old_tuple);
3594 (checked_lockers && !locker_remains))
3602 infomask2_new_tuple = 0;
3615 &infomask2_new_tuple);
3620 infomask2_new_tuple = 0;
3653 if (relation->
rd_rel->relkind != RELKIND_RELATION &&
3654 relation->
rd_rel->relkind != RELKIND_MATVIEW)
3670 if (need_toast || newtupsize > pagefree)
3673 uint16 infomask_lock_old_tuple,
3674 infomask2_lock_old_tuple;
3675 bool cleared_all_frozen =
false;
3698 xid, *lockmode,
false,
3699 &xmax_lock_old_tuple, &infomask_lock_old_tuple,
3700 &infomask2_lock_old_tuple);
3729 cleared_all_frozen =
true;
3742 xlrec.
xmax = xmax_lock_old_tuple;
3797 if (newtupsize > pagefree)
3802 &vmbuffer_new, &vmbuffer,
3814 if (newtupsize > pagefree ||
3862 if (newbuf == buffer)
3871 use_hot_update =
true;
3881 summarized_update =
true;
3955 all_visible_cleared =
true;
3962 all_visible_cleared_new =
true;
3968 if (newbuf != buffer)
3988 newbuf, &oldtup, heaptup,
3990 all_visible_cleared,
3991 all_visible_cleared_new);
3992 if (newbuf != buffer)
4001 if (newbuf != buffer)
4016 if (newbuf != buffer)
4027 if (have_tuple_lock)
4036 if (heaptup != newtup)
4050 if (summarized_update)
4056 *update_indexes =
TU_All;
4058 if (old_key_tuple != NULL && old_key_copied)
4077 bool isnull1,
bool isnull2)
4085 if (isnull1 != isnull2)
4110 Assert(attrnum <= tupdesc->natts);
4112 return datumIsEqual(value1, value2, att->attbyval, att->attlen);
4178 value1 =
heap_getattr(oldtup, attrnum, tupdesc, &isnull1);
4179 value2 =
heap_getattr(newtup, attrnum, tupdesc, &isnull2);
4182 value2, isnull1, isnull2))
4192 if (attrnum < 0 || isnull1 ||
4202 *has_external =
true;
4227 &tmfd, &lockmode, update_indexes);
4232 elog(
ERROR,
"tuple already updated by self");
4240 elog(
ERROR,
"tuple concurrently updated");
4244 elog(
ERROR,
"tuple concurrently deleted");
4248 elog(
ERROR,
"unrecognized heap_update status: %u", result);
4269 is_update ?
"true" :
"false");
4308 bool follow_updates,
4322 bool first_time =
true;
4323 bool skip_tuple_lock =
false;
4324 bool have_tuple_lock =
false;
4325 bool cleared_all_frozen =
false;
4412 for (
i = 0;
i < nmembers;
i++)
4437 skip_tuple_lock =
true;
4486 require_sleep =
true;
4520 if (follow_updates && updated)
4551 require_sleep =
false;
4580 require_sleep =
false;
4606 require_sleep =
false;
4619 require_sleep =
false;
4645 require_sleep =
false;
4664 else if (require_sleep)
4676 if (!skip_tuple_lock &&
4696 elog(
ERROR,
"invalid lock mode in heap_lock_tuple");
4699 switch (wait_policy)
4707 status, infomask, relation,
4718 status, infomask, relation,
4721 (
errcode(ERRCODE_LOCK_NOT_AVAILABLE),
4722 errmsg(
"could not obtain lock on row in relation \"%s\"",
4741 switch (wait_policy)
4759 (
errcode(ERRCODE_LOCK_NOT_AVAILABLE),
4760 errmsg(
"could not obtain lock on row in relation \"%s\"",
4816 if (!require_sleep ||
4828 if (result !=
TM_Ok)
4890 &xid, &new_infomask, &new_infomask2);
4926 cleared_all_frozen =
true;
4985 if (have_tuple_lock)
5007 if (*have_tuple_lock)
5010 switch (wait_policy)
5024 (
errcode(ERRCODE_LOCK_NOT_AVAILABLE),
5025 errmsg(
"could not obtain lock on row in relation \"%s\"",
5029 *have_tuple_lock =
true;
5057 uint16 *result_infomask2)
5080 new_xmax = add_to_xmax;
5090 new_xmax = add_to_xmax;
5094 new_xmax = add_to_xmax;
5098 new_xmax = add_to_xmax;
5102 new_xmax = add_to_xmax;
5226 elog(
WARNING,
"LOCK_ONLY found for Xid in progress %u", xmax);
5248 if (xmax == add_to_xmax)
5262 if (
mode < old_mode)
5273 add_to_xmax, new_status);
5313 *result_infomask = new_infomask;
5314 *result_infomask2 = new_infomask2;
5315 *result_xmax = new_xmax;
5439 bool cleared_all_frozen =
false;
5440 bool pinned_desired_page;
5478 pinned_desired_page =
true;
5481 pinned_desired_page =
false;
5561 for (
i = 0;
i < nmembers;
i++)
5594 if (result !=
TM_Ok)
5631 elog(
ERROR,
"invalid lock status in tuple");
5665 if (result !=
TM_Ok)
5675 &new_xmax, &new_infomask, &new_infomask2);
5680 cleared_all_frozen =
true;
5704 xlrec.
xmax = new_xmax;
5939 elog(
ERROR,
"attempted to kill a tuple inserted by another transaction");
5941 elog(
ERROR,
"attempted to kill a non-speculative tuple");
5964 prune_xid = relation->
rd_rel->relfrozenxid;
6073 (
errcode(ERRCODE_INVALID_TRANSACTION_STATE),
6074 errmsg(
"cannot update tuples during a parallel operation")));
6097 memcpy((
char *) htup + htup->
t_hoff,
6138 #define FRM_NOOP 0x0001
6139 #define FRM_INVALIDATE_XMAX 0x0002
6140 #define FRM_RETURN_IS_XID 0x0004
6141 #define FRM_RETURN_IS_MULTI 0x0008
6142 #define FRM_MARK_COMMITTED 0x0010
6203 bool update_committed;
6237 errmsg_internal(
"multixact %u from before multi freeze cutoff %u found to be still running",
6252 errmsg_internal(
"multixact %u contains update XID %u from before relfrozenxid %u",
6265 errmsg_internal(
"multixact %u contains committed update XID %u from before removable cutoff %u",
6313 need_replace =
false;
6315 for (
int i = 0;
i < nmembers;
i++)
6324 need_replace =
true;
6328 FreezePageRelfrozenXid = xid;
6360 has_lockers =
false;
6362 update_committed =
false;
6367 for (
int i = 0;
i < nmembers;
i++)
6386 errmsg_internal(
"multixact %u contains running locker XID %u from before removable cutoff %u",
6389 newmembers[nnewmembers++] = members[
i];
6430 update_committed =
true;
6449 errmsg_internal(
"multixact %u contains committed update XID %u from before removable cutoff %u",
6451 newmembers[nnewmembers++] = members[
i];
6460 if (nnewmembers == 0)
6475 Assert(nnewmembers == 1);
6477 if (update_committed)
6479 newxmax = update_xid;
6546 bool xmin_already_frozen =
false,
6547 xmax_already_frozen =
false;
6548 bool freeze_xmin =
false,
6549 replace_xvac =
false,
6550 replace_xmax =
false,
6551 freeze_xmax =
false;
6567 xmin_already_frozen =
true;
6660 frz->
xmax = newxmax;
6663 replace_xmax =
true;
6687 frz->
xmax = newxmax;
6688 replace_xmax =
true;
6730 xmax_already_frozen =
true;
6735 errmsg_internal(
"found raw xmax %u (infomask 0x%04x) not invalid and not multi",
6740 Assert(!xmin_already_frozen);
6759 Assert(!xmax_already_frozen && !freeze_xmax);
6766 Assert(!xmax_already_frozen && !replace_xmax);
6785 *totally_frozen = ((freeze_xmin || xmin_already_frozen) &&
6786 (freeze_xmax || xmax_already_frozen));
6789 xmax_already_frozen))
6802 return freeze_xmin || replace_xvac || replace_xmax || freeze_xmax;
6843 for (
int i = 0;
i < ntuples;
i++)
6895 for (
int i = 0;
i < ntuples;
i++)
6919 bool totally_frozen;
6930 pagefrz.freeze_required =
true;
6937 &pagefrz, &frz, &totally_frozen);
6965 bool has_update =
false;
6974 for (
i = 0;
i < nmembers;
i++)
6983 if (
mode > strongest)
6987 switch (members[
i].status)
7023 *new_infomask = bits;
7024 *new_infomask2 = bits2;
7057 for (
i = 0;
i < nmembers;
i++)
7065 update_xact = members[
i].
xid;
7066 #ifndef USE_ASSERT_CHECKING
7111 bool result =
false;
7123 for (
i = 0;
i < nmembers;
i++)
7128 if (result && (current_is_member == NULL || *current_is_member))
7134 memxid = members[
i].
xid;
7137 if (current_is_member != NULL)
7138 *current_is_member =
true;
7206 uint16 infomask,
bool nowait,
7224 for (
i = 0;
i < nmembers;
i++)
7381 bool freeze =
false;
7389 *NoFreezePageRelfrozenXid = xid;
7407 *NoFreezePageRelfrozenXid = xid;
7419 *NoFreezePageRelminMxid = multi;
7431 *NoFreezePageRelminMxid = multi;
7439 for (
int i = 0;
i < nmembers;
i++)
7441 xid = members[
i].
xid;
7444 *NoFreezePageRelfrozenXid = xid;
7459 *NoFreezePageRelfrozenXid = xid;
7492 *snapshotConflictHorizon = xvac;
7506 *snapshotConflictHorizon = xmax;
7522 index_delete_prefetch_buffer(
Relation rel,
7523 IndexDeletePrefetchState *prefetch_state,
7526 BlockNumber cur_hblkno = prefetch_state->cur_hblkno;
7529 int ndeltids = prefetch_state->ndeltids;
7532 for (
i = prefetch_state->next_item;
7533 i < ndeltids && count < prefetch_count;
7551 prefetch_state->next_item =
i;
7552 prefetch_state->cur_hblkno = cur_hblkno;
7576 if (
unlikely(indexpagehoffnum > maxoff))
7578 (
errcode(ERRCODE_INDEX_CORRUPTED),
7579 errmsg_internal(
"heap tid from index tuple (%u,%u) points past end of heap page line pointer array at offset %u of block %u in index \"%s\"",
7588 (
errcode(ERRCODE_INDEX_CORRUPTED),
7589 errmsg_internal(
"heap tid from index tuple (%u,%u) points to unused heap page item at offset %u of block %u in index \"%s\"",
7604 (
errcode(ERRCODE_INDEX_CORRUPTED),
7605 errmsg_internal(
"heap tid from index tuple (%u,%u) points to heap-only tuple at offset %u of block %u in index \"%s\"",
7637 IndexDeletePrefetchState prefetch_state;
7638 int prefetch_distance;
7641 int finalndeltids = 0,
7642 nblocksaccessed = 0;
7645 int nblocksfavorable = 0;
7648 actualfreespace = 0;
7649 bool bottomup_final_block =
false;
7669 prefetch_state.next_item = 0;
7670 prefetch_state.ndeltids = delstate->
ndeltids;
7671 prefetch_state.deltids = delstate->
deltids;
7689 Assert(nblocksfavorable >= 1);
7691 prefetch_distance =
Min(prefetch_distance, nblocksfavorable);
7695 index_delete_prefetch_buffer(rel, &prefetch_state, prefetch_distance);
7738 if (bottomup_final_block)
7747 if (nblocksaccessed >= 1 && actualfreespace == lastfreespace)
7749 lastfreespace = actualfreespace;
7775 Assert(nblocksaccessed > 0 || nblocksfavorable > 0);
7776 if (nblocksfavorable > 0)
7779 curtargetfreespace /= 2;
7798 index_delete_prefetch_buffer(rel, &prefetch_state, 1);
7824 &heapTuple, NULL,
true))
7835 if (actualfreespace >= curtargetfreespace)
7836 bottomup_final_block =
true;
7860 if (offnum > maxoff)
7897 &snapshotConflictHorizon);
7915 finalndeltids =
i + 1;
7927 delstate->
ndeltids = finalndeltids;
7929 return snapshotConflictHorizon;
7946 return (blk1 < blk2) ? -1 : 1;
7953 return (pos1 < pos2) ? -1 : 1;
7984 const int gaps[9] = {1968, 861, 336, 112, 48, 21, 7, 3, 1};
7988 "element size exceeds 8 bytes");
7990 for (
int g = 0; g <
lengthof(gaps); g++)
7992 for (
int hi = gaps[g],
i = low + hi;
i < ndeltids;
i++)
7999 deltids[
j] = deltids[
j - hi];
8072 int64 lastblock = -1;
8073 int nblocksfavorable = 0;
8075 Assert(nblockgroups >= 1);
8087 for (
int b = 0;
b < nblockgroups;
b++)
8093 if (lastblock != -1 &&
8103 Assert(nblocksfavorable >= 1);
8105 return nblocksfavorable;
8140 if (ntids1 > ntids2)
8142 if (ntids1 < ntids2)
8190 int nblockgroups = 0;
8192 int nblocksfavorable = 0;
8216 blockgroups[nblockgroups - 1].
ntids = 1;
8221 blockgroups[nblockgroups - 1].
ntids++;
8256 for (
int b = 0;
b < nblockgroups;
b++)
8278 for (
int b = 0;
b < nblockgroups;
b++)
8283 memcpy(reordereddeltids + ncopied, firstdtid,
8285 ncopied += group->
ntids;
8289 memcpy(delstate->
deltids, reordereddeltids,
8293 pfree(reordereddeltids);
8296 return nblocksfavorable;
8325 xlrec.
flags = vmflags;
8351 bool all_visible_cleared,
bool new_all_visible_cleared)
8396 if (oldbuf == newbuf && !need_tuple_data &&
8405 for (prefixlen = 0; prefixlen <
Min(oldlen, newlen); prefixlen++)
8407 if (newp[prefixlen] != oldp[prefixlen])
8419 for (suffixlen = 0; suffixlen <
Min(oldlen, newlen) - prefixlen; suffixlen++)
8421 if (newp[newlen - suffixlen - 1] != oldp[oldlen - suffixlen - 1])
8430 if (all_visible_cleared)
8432 if (new_all_visible_cleared)
8438 if (need_tuple_data)
8443 if (reln->
rd_rel->relreplident == REPLICA_IDENTITY_FULL)
8473 if (need_tuple_data)
8477 if (oldbuf != newbuf)
8485 if (prefixlen > 0 || suffixlen > 0)
8487 if (prefixlen > 0 && suffixlen > 0)
8489 prefix_suffix[0] = prefixlen;
8490 prefix_suffix[1] = suffixlen;
8493 else if (prefixlen > 0)
8541 if (need_tuple_data && old_key_tuple)
8655 char replident = relation->
rd_rel->relreplident;
8666 if (replident == REPLICA_IDENTITY_NOTHING)
8669 if (replident == REPLICA_IDENTITY_FULL)
8707 for (
int i = 0;
i < desc->
natts;
i++)
8777 memcpy(&snapshot_conflict_horizon, maindataptr,
sizeof(
TransactionId));
8808 &nplans, &plans, &frz_offsets,
8809 &nredirected, &redirected,
8811 &nunused, &nowunused);
8817 if (nredirected > 0 || ndead > 0 || nunused > 0)
8820 redirected, nredirected,
8822 nowunused, nunused);
8825 for (
int p = 0; p < nplans; p++)
8852 Assert((
char *) frz_offsets == dataptr + datalen);
9115 htup->
t_ctid = target_tid;
9184 elog(
PANIC,
"invalid max offset number");
9200 htup->t_infomask2 = xlhdr.t_infomask2;
9201 htup->t_infomask = xlhdr.t_infomask;
9202 htup->t_hoff = xlhdr.t_hoff;
9205 htup->t_ctid = target_tid;
9308 endptr = tupdata +
len;
9327 elog(
PANIC,
"invalid max offset number");
9345 htup->t_hoff = xlhdr->
t_hoff;
9355 if (tupdata != endptr)
9356 elog(
PANIC,
"total tuple length mismatch");
9504 if (oldblk == newblk)
9507 newaction = oldaction;
9543 recdata_end = recdata + datalen;
9549 elog(
PANIC,
"invalid max offset number");
9553 Assert(newblk == oldblk);
9554 memcpy(&prefixlen, recdata,
sizeof(
uint16));
9555 recdata +=
sizeof(
uint16);
9559 Assert(newblk == oldblk);
9560 memcpy(&suffixlen, recdata,
sizeof(
uint16));
9561 recdata +=
sizeof(
uint16);
9567 tuplen = recdata_end - recdata;
9584 memcpy(newp, recdata,
len);
9594 memcpy(newp, recdata,
len);
9604 memcpy(newp, recdata, tuplen);
9608 Assert(recdata == recdata_end);
9612 memcpy(newp, (
char *) oldtup.
t_data + oldtup.
t_len - suffixlen, suffixlen);
9615 htup->t_infomask2 = xlhdr.t_infomask2;
9616 htup->t_infomask = xlhdr.t_infomask;
9617 htup->t_hoff = xlhdr.t_hoff;
9623 htup->t_ctid = newtid;
9658 if (newaction ==
BLK_NEEDS_REDO && !hot_update && freespace < BLCKSZ / 5)
9858 if (oldlen != newlen)
9861 memcpy((
char *) htup + htup->
t_hoff, newtup, newlen);
9912 elog(
PANIC,
"heap_redo: unknown op code %u", info);
9948 elog(
PANIC,
"heap2_redo: unknown op code %u", info);
9995 page_htup->t_choice.t_heap.t_field3.t_cid =
MASK_MARKER;
10074 switch (htsvResult)
10108 elog(
ERROR,
"unrecognized return value from HeapTupleSatisfiesVacuum: %u", htsvResult);
int bms_next_member(const Bitmapset *a, int prevbit)
void bms_free(Bitmapset *a)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_add_members(Bitmapset *a, const Bitmapset *b)
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
#define InvalidBlockNumber
static bool BlockNumberIsValid(BlockNumber blockNumber)
static Datum values[MAXATTR]
void mask_page_lsn_and_checksum(Page page)
void mask_unused_space(Page page)
void mask_page_hint_bits(Page page)
BlockNumber BufferGetBlockNumber(Buffer buffer)
PrefetchBufferResult PrefetchBuffer(Relation reln, ForkNumber forkNum, BlockNumber blockNum)
void ReleaseBuffer(Buffer buffer)
void UnlockReleaseBuffer(Buffer buffer)
void MarkBufferDirty(Buffer buffer)
void LockBuffer(Buffer buffer, int mode)
int maintenance_io_concurrency
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
#define BUFFER_LOCK_UNLOCK
#define BUFFER_LOCK_SHARE
#define RelationGetNumberOfBlocks(reln)
static Page BufferGetPage(Buffer buffer)
static Size BufferGetPageSize(Buffer buffer)
#define BUFFER_LOCK_EXCLUSIVE
static bool BufferIsValid(Buffer bufnum)
Size PageGetHeapFreeSpace(Page page)
void PageInit(Page page, Size pageSize, Size specialSize)
Size PageGetFreeSpace(Page page)
static Item PageGetItem(Page page, ItemId itemId)
static void PageClearAllVisible(Page page)
#define SizeOfPageHeaderData
static void PageSetAllVisible(Page page)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static bool PageIsNew(Page page)
static bool PageIsAllVisible(Page page)
static void PageSetFull(Page page)
static void PageSetLSN(Page page, XLogRecPtr lsn)
static OffsetNumber PageGetMaxOffsetNumber(Page page)
#define PageSetPrunable(page, xid)
#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap)
#define Assert(condition)
TransactionId MultiXactId
#define pg_attribute_always_inline
#define MemSet(start, val, len)
#define StaticAssertDecl(condition, errmessage)
bool IsToastRelation(Relation relation)
bool IsCatalogRelation(Relation relation)
void HeapTupleHeaderAdjustCmax(HeapTupleHeader tup, CommandId *cmax, bool *iscombo)
CommandId HeapTupleHeaderGetCmin(HeapTupleHeader tup)
CommandId HeapTupleHeaderGetCmax(HeapTupleHeader tup)
bool datumIsEqual(Datum value1, Datum value2, bool typByVal, int typLen)
static void PGresult * res
int errmsg_internal(const char *fmt,...)
int errdetail_internal(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
TupleTableSlot * ExecStoreBufferHeapTuple(HeapTuple tuple, TupleTableSlot *slot, Buffer buffer)
HeapTuple ExecFetchSlotHeapTuple(TupleTableSlot *slot, bool materialize, bool *shouldFree)
BufferAccessStrategy GetAccessStrategy(BufferAccessStrategyType btype)
void FreeAccessStrategy(BufferAccessStrategy strategy)
void XLogRecordPageWithFreeSpace(RelFileLocator rlocator, BlockNumber heapBlk, Size spaceAvail)
static bool DoesMultiXactIdConflict(MultiXactId multi, uint16 infomask, LockTupleMode lockmode, bool *current_is_member)
void heap_finish_speculative(Relation relation, ItemPointer tid)
void heap_insert(Relation relation, HeapTuple tup, CommandId cid, int options, BulkInsertState bistate)
static XLogRecPtr log_heap_new_cid(Relation relation, HeapTuple tup)
XLogRecPtr log_heap_visible(Relation rel, Buffer heap_buffer, Buffer vm_buffer, TransactionId snapshotConflictHorizon, uint8 vmflags)
static void compute_new_xmax_infomask(TransactionId xmax, uint16 old_infomask, uint16 old_infomask2, TransactionId add_to_xmax, LockTupleMode mode, bool is_update, TransactionId *result_xmax, uint16 *result_infomask, uint16 *result_infomask2)
void heap_redo(XLogReaderState *record)
static void heap_xlog_prune_freeze(XLogReaderState *record)
struct IndexDeleteCounts IndexDeleteCounts
static void heap_fetch_next_buffer(HeapScanDesc scan, ScanDirection dir)
bool heap_fetch(Relation relation, Snapshot snapshot, HeapTuple tuple, Buffer *userbuf, bool keep_buf)
static bool Do_MultiXactIdWait(MultiXactId multi, MultiXactStatus status, uint16 infomask, bool nowait, Relation rel, ItemPointer ctid, XLTW_Oper oper, int *remaining)
#define BOTTOMUP_TOLERANCE_NBLOCKS
static HeapTuple heap_prepare_insert(Relation relation, HeapTuple tup, TransactionId xid, CommandId cid, int options)
static BlockNumber heap_scan_stream_read_next_parallel(ReadStream *stream, void *callback_private_data, void *per_buffer_data)
static int bottomup_sort_and_shrink(TM_IndexDeleteOp *delstate)
void heap_mask(char *pagedata, BlockNumber blkno)
static int heap_multi_insert_pages(HeapTuple *heaptuples, int done, int ntuples, Size saveFreeSpace)
static pg_attribute_always_inline int page_collect_tuples(HeapScanDesc scan, Snapshot snapshot, Page page, Buffer buffer, BlockNumber block, int lines, bool all_visible, bool check_serializable)
void simple_heap_delete(Relation relation, ItemPointer tid)
static BlockNumber heap_scan_stream_read_next_serial(ReadStream *stream, void *callback_private_data, void *per_buffer_data)
static void GetMultiXactIdHintBits(MultiXactId multi, uint16 *new_infomask, uint16 *new_infomask2)
TM_Result heap_delete(Relation relation, ItemPointer tid, CommandId cid, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
void HeapTupleHeaderAdvanceConflictHorizon(HeapTupleHeader tuple, TransactionId *snapshotConflictHorizon)
bool heap_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
#define LOCKMODE_from_mxstatus(status)
void heap_endscan(TableScanDesc sscan)
static void heap_xlog_insert(XLogReaderState *record)
TransactionId HeapTupleGetUpdateXid(HeapTupleHeader tuple)
static void index_delete_check_htid(TM_IndexDeleteOp *delstate, Page page, OffsetNumber maxoff, ItemPointer htid, TM_IndexStatus *istatus)
#define FRM_RETURN_IS_XID
#define TUPLOCK_from_mxstatus(status)
void heap_rescan(TableScanDesc sscan, ScanKey key, bool set_params, bool allow_strat, bool allow_sync, bool allow_pagemode)
static int index_delete_sort_cmp(TM_IndexDelete *deltid1, TM_IndexDelete *deltid2)
TM_Result heap_update(Relation relation, ItemPointer otid, HeapTuple newtup, CommandId cid, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, TU_UpdateIndexes *update_indexes)
#define ConditionalLockTupleTuplock(rel, tup, mode)
static void fix_infomask_from_infobits(uint8 infobits, uint16 *infomask, uint16 *infomask2)
bool heap_tuple_needs_eventual_freeze(HeapTupleHeader tuple)
static TransactionId FreezeMultiXactId(MultiXactId multi, uint16 t_infomask, const struct VacuumCutoffs *cutoffs, uint16 *flags, HeapPageFreeze *pagefrz)
static HeapTuple ExtractReplicaIdentity(Relation relation, HeapTuple tp, bool key_required, bool *copy)
void heap_inplace_update(Relation relation, HeapTuple tuple)
static pg_noinline BlockNumber heapgettup_initial_block(HeapScanDesc scan, ScanDirection dir)
#define LockTupleTuplock(rel, tup, mode)
bool heap_tuple_should_freeze(HeapTupleHeader tuple, const struct VacuumCutoffs *cutoffs, TransactionId *NoFreezePageRelfrozenXid, MultiXactId *NoFreezePageRelminMxid)
static void heap_xlog_update(XLogReaderState *record, bool hot_update)
bool heap_freeze_tuple(HeapTupleHeader tuple, TransactionId relfrozenxid, TransactionId relminmxid, TransactionId FreezeLimit, TransactionId MultiXactCutoff)
static BlockNumber heapgettup_advance_block(HeapScanDesc scan, BlockNumber block, ScanDirection dir)
static TransactionId MultiXactIdGetUpdateXid(TransactionId xmax, uint16 t_infomask)
static bool heap_acquire_tuplock(Relation relation, ItemPointer tid, LockTupleMode mode, LockWaitPolicy wait_policy, bool *have_tuple_lock)
static TM_Result heap_lock_updated_tuple(Relation rel, HeapTuple tuple, ItemPointer ctid, TransactionId xid, LockTupleMode mode)
#define BOTTOMUP_MAX_NBLOCKS
void ReleaseBulkInsertStatePin(BulkInsertState bistate)
static void MultiXactIdWait(MultiXactId multi, MultiXactStatus status, uint16 infomask, Relation rel, ItemPointer ctid, XLTW_Oper oper, int *remaining)
#define FRM_MARK_COMMITTED
HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction)
bool heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer, Snapshot snapshot, HeapTuple heapTuple, bool *all_dead, bool first_call)
void simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup, TU_UpdateIndexes *update_indexes)
void heap_freeze_prepared_tuples(Buffer buffer, HeapTupleFreeze *tuples, int ntuples)
static void heap_execute_freeze_tuple(HeapTupleHeader tuple, HeapTupleFreeze *frz)
bool heap_getnextslot_tidrange(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
static void heap_xlog_delete(XLogReaderState *record)
void heap_set_tidrange(TableScanDesc sscan, ItemPointer mintid, ItemPointer maxtid)
static void heap_xlog_lock_updated(XLogReaderState *record)
static void heap_xlog_lock(XLogReaderState *record)
static void heap_xlog_multi_insert(XLogReaderState *record)
void heap_abort_speculative(Relation relation, ItemPointer tid)
static void heap_xlog_visible(XLogReaderState *record)
TableScanDesc heap_beginscan(Relation relation, Snapshot snapshot, int nkeys, ScanKey key, ParallelTableScanDesc parallel_scan, uint32 flags)
static void heapgettup(HeapScanDesc scan, ScanDirection dir, int nkeys, ScanKey key)
static Page heapgettup_continue_page(HeapScanDesc scan, ScanDirection dir, int *linesleft, OffsetNumber *lineoff)
static uint8 compute_infobits(uint16 infomask, uint16 infomask2)
#define FRM_RETURN_IS_MULTI
static void heap_xlog_inplace(XLogReaderState *record)
#define FRM_INVALIDATE_XMAX
static void heap_xlog_confirm(XLogReaderState *record)
static bool ConditionalMultiXactIdWait(MultiXactId multi, MultiXactStatus status, uint16 infomask, Relation rel, int *remaining)
static bool heap_attr_equals(TupleDesc tupdesc, int attrnum, Datum value1, Datum value2, bool isnull1, bool isnull2)
static void index_delete_sort(TM_IndexDeleteOp *delstate)
void heap_prepare_pagescan(TableScanDesc sscan)
static Bitmapset * HeapDetermineColumnsInfo(Relation relation, Bitmapset *interesting_cols, Bitmapset *external_cols, HeapTuple oldtup, HeapTuple newtup, bool *has_external)
static const int MultiXactStatusLock[MaxMultiXactStatus+1]
void simple_heap_insert(Relation relation, HeapTuple tup)
static bool xmax_infomask_changed(uint16 new_infomask, uint16 old_infomask)
void heap2_redo(XLogReaderState *record)
#define UnlockTupleTuplock(rel, tup, mode)
static TM_Result test_lockmode_for_conflict(MultiXactStatus status, TransactionId xid, LockTupleMode mode, HeapTuple tup, bool *needwait)
bool heap_prepare_freeze_tuple(HeapTupleHeader tuple, const struct VacuumCutoffs *cutoffs, HeapPageFreeze *pagefrz, HeapTupleFreeze *frz, bool *totally_frozen)
static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf, Buffer newbuf, HeapTuple oldtup, HeapTuple newtup, HeapTuple old_key_tuple, bool all_visible_cleared, bool new_all_visible_cleared)
TransactionId heap_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate)
void heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples, CommandId cid, int options, BulkInsertState bistate)
static void initscan(HeapScanDesc scan, ScanKey key, bool keep_startblock)
static int bottomup_nblocksfavorable(IndexDeleteCounts *blockgroups, int nblockgroups, TM_IndexDelete *deltids)
static void heapgettup_pagemode(HeapScanDesc scan, ScanDirection dir, int nkeys, ScanKey key)
TM_Result heap_lock_tuple(Relation relation, HeapTuple tuple, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, bool follow_updates, Buffer *buffer, TM_FailureData *tmfd)
static void UpdateXmaxHintBits(HeapTupleHeader tuple, Buffer buffer, TransactionId xid)
static int bottomup_sort_and_shrink_cmp(const void *arg1, const void *arg2)
void heap_get_latest_tid(TableScanDesc sscan, ItemPointer tid)
void heap_setscanlimits(TableScanDesc sscan, BlockNumber startBlk, BlockNumber numBlks)
void HeapCheckForSerializableConflictOut(bool visible, Relation relation, HeapTuple tuple, Buffer buffer, Snapshot snapshot)
static Page heapgettup_start_page(HeapScanDesc scan, ScanDirection dir, int *linesleft, OffsetNumber *lineoff)
static MultiXactStatus get_mxact_status_for_lock(LockTupleMode mode, bool is_update)
void heap_pre_freeze_checks(Buffer buffer, HeapTupleFreeze *tuples, int ntuples)
BulkInsertState GetBulkInsertState(void)
void FreeBulkInsertState(BulkInsertState bistate)
static TM_Result heap_lock_updated_tuple_rec(Relation rel, ItemPointer tid, TransactionId xid, LockTupleMode mode)
static const struct @15 tupleLockExtraInfo[MaxLockTupleMode+1]
#define HEAP_INSERT_SPECULATIVE
#define HEAP_FREEZE_CHECK_XMAX_ABORTED
struct HeapScanDescData * HeapScanDesc
@ HEAPTUPLE_RECENTLY_DEAD
@ HEAPTUPLE_INSERT_IN_PROGRESS
@ HEAPTUPLE_DELETE_IN_PROGRESS
#define HEAP_INSERT_FROZEN
#define HEAP_FREEZE_CHECK_XMIN_COMMITTED
#define HEAP_INSERT_NO_LOGICAL
struct BulkInsertStateData * BulkInsertState
const TableAmRoutine * GetHeapamTableAmRoutine(void)
void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer, uint16 infomask, TransactionId xid)
bool HeapTupleSatisfiesVisibility(HeapTuple htup, Snapshot snapshot, Buffer buffer)
bool HeapTupleIsSurelyDead(HeapTuple htup, GlobalVisState *vistest)
HTSV_Result HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin, Buffer buffer)
bool HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple)
TM_Result HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid, Buffer buffer)
#define XLH_INSERT_ON_TOAST_RELATION
#define SizeOfHeapMultiInsert
#define XLOG_HEAP2_MULTI_INSERT
#define XLH_UPDATE_NEW_ALL_VISIBLE_CLEARED
#define SizeOfHeapVisible
#define XLOG_HEAP_HOT_UPDATE
#define XLH_INSERT_IS_SPECULATIVE
#define XLHP_HAS_CONFLICT_HORIZON
#define XLOG_HEAP2_REWRITE
#define XLH_LOCK_ALL_FROZEN_CLEARED
#define XLH_DELETE_CONTAINS_OLD_KEY
#define SizeOfHeapInplace
#define XLOG_HEAP_TRUNCATE
#define XLH_UPDATE_CONTAINS_NEW_TUPLE
#define XLH_INSERT_LAST_IN_MULTI
#define XLH_INSERT_ALL_FROZEN_SET
#define XLHL_XMAX_KEYSHR_LOCK
#define XLH_DELETE_ALL_VISIBLE_CLEARED
#define XLH_UPDATE_CONTAINS_OLD_TUPLE
#define XLHP_HAS_NOW_UNUSED_ITEMS
#define SizeOfHeapLockUpdated
#define XLHL_XMAX_IS_MULTI
#define XLHP_HAS_REDIRECTIONS
#define XLH_INSERT_ALL_VISIBLE_CLEARED
#define XLOG_HEAP2_PRUNE_VACUUM_SCAN
#define XLH_DELETE_IS_PARTITION_MOVE
#define XLH_UPDATE_OLD_ALL_VISIBLE_CLEARED
#define XLHL_XMAX_LOCK_ONLY
#define XLOG_HEAP_INPLACE
#define XLOG_HEAP2_LOCK_UPDATED
#define XLH_UPDATE_SUFFIX_FROM_OLD
#define XLH_UPDATE_PREFIX_FROM_OLD
#define SizeOfMultiInsertTuple
#define XLHL_XMAX_EXCL_LOCK
#define XLOG_HEAP2_PRUNE_ON_ACCESS
#define XLOG_HEAP2_NEW_CID
#define XLHP_CLEANUP_LOCK
#define XLH_DELETE_CONTAINS_OLD_TUPLE
#define XLHP_HAS_DEAD_ITEMS
#define XLOG_HEAP2_PRUNE_VACUUM_CLEANUP
#define XLH_DELETE_IS_SUPER
#define XLH_UPDATE_CONTAINS_OLD_KEY
#define XLHL_KEYS_UPDATED
#define XLOG_HEAP2_VISIBLE
#define XLHP_IS_CATALOG_REL
#define XLH_INSERT_CONTAINS_NEW_TUPLE
#define XLOG_HEAP_INIT_PAGE
#define SizeOfHeapConfirm
#define XLOG_HEAP_CONFIRM
void heap_xlog_deserialize_prune_and_freeze(char *cursor, uint8 flags, int *nplans, xlhp_freeze_plan **plans, OffsetNumber **frz_offsets, int *nredirected, OffsetNumber **redirected, int *ndead, OffsetNumber **nowdead, int *nunused, OffsetNumber **nowunused)
void heap_toast_delete(Relation rel, HeapTuple oldtup, bool is_speculative)
HeapTuple heap_toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup, int options)
HeapTuple toast_flatten_tuple(HeapTuple tup, TupleDesc tupleDesc)
#define TOAST_TUPLE_THRESHOLD
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
void heap_freetuple(HeapTuple htup)
void RelationPutHeapTuple(Relation relation, Buffer buffer, HeapTuple tuple, bool token)
Buffer RelationGetBufferForTuple(Relation relation, Size len, Buffer otherBuffer, int options, BulkInsertState bistate, Buffer *vmbuffer, Buffer *vmbuffer_other, int num_pages)
HeapTupleHeaderData * HeapTupleHeader
#define HEAP_XMAX_IS_EXCL_LOCKED(infomask)
#define HeapTupleHeaderSetXminFrozen(tup)
#define HEAP_XMAX_SHR_LOCK
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
#define HEAP_XMAX_IS_LOCKED_ONLY(infomask)
#define HeapTupleHeaderGetNatts(tup)
#define SizeofHeapTupleHeader
#define HEAP_XMAX_IS_KEYSHR_LOCKED(infomask)
#define HEAP_KEYS_UPDATED
#define HeapTupleHeaderIsHeapOnly(tup)
#define HeapTupleHeaderIndicatesMovedPartitions(tup)
#define HeapTupleSetHotUpdated(tuple)
#define HeapTupleHeaderGetXvac(tup)
#define HeapTupleHeaderSetXmin(tup, xid)
#define HeapTupleHeaderSetXmax(tup, xid)
#define HEAP_XMAX_LOCK_ONLY
#define HeapTupleHeaderGetXmin(tup)
#define HeapTupleHasExternal(tuple)
#define HeapTupleHeaderClearHotUpdated(tup)
#define HeapTupleHeaderSetCmin(tup, cid)
#define HeapTupleHeaderSetHotUpdated(tup)
#define HeapTupleHeaderSetXvac(tup, xid)
#define HEAP_XMAX_IS_MULTI
#define HEAP_XMAX_COMMITTED
#define HeapTupleIsHeapOnly(tuple)
#define HeapTupleHeaderGetRawXmin(tup)
#define HeapTupleHeaderXminFrozen(tup)
#define HEAP_XMAX_EXCL_LOCK
#define HEAP_XMAX_INVALID
#define HeapTupleHeaderXminCommitted(tup)
#define MaxHeapAttributeNumber
#define HeapTupleHeaderSetMovedPartitions(tup)
#define HeapTupleIsHotUpdated(tuple)
#define HeapTupleHeaderGetRawXmax(tup)
#define MaxHeapTuplesPerPage
#define HeapTupleSetHeapOnly(tuple)
#define HEAP_XMAX_IS_SHR_LOCKED(infomask)
#define HeapTupleClearHeapOnly(tuple)
#define HEAP_XMAX_KEYSHR_LOCK
#define HeapTupleHeaderGetUpdateXid(tup)
#define HeapTupleClearHotUpdated(tuple)
#define HeapTupleHeaderGetRawCommandId(tup)
#define HEAP_LOCKED_UPGRADED(infomask)
#define HeapTupleHeaderIsSpeculative(tup)
#define HeapTupleHeaderIsHotUpdated(tup)
#define HeapTupleHeaderXminInvalid(tup)
#define HeapTupleHeaderSetCmax(tup, cid, iscombo)
#define IsParallelWorker()
void CacheInvalidateHeapTuple(Relation relation, HeapTuple tuple, HeapTuple newtuple)
if(TABLE==NULL||TABLE_index==NULL)
#define ItemIdGetLength(itemId)
#define ItemIdIsNormal(itemId)
#define ItemIdGetOffset(itemId)
struct ItemIdData ItemIdData
#define ItemIdGetRedirect(itemId)
#define ItemIdIsUsed(itemId)
#define ItemIdIsRedirected(itemId)
#define ItemIdHasStorage(itemId)
int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2)
bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2)
static void ItemPointerSet(ItemPointerData *pointer, BlockNumber blockNumber, OffsetNumber offNum)
static void ItemPointerSetInvalid(ItemPointerData *pointer)
static void ItemPointerSetOffsetNumber(ItemPointerData *pointer, OffsetNumber offsetNumber)
static void ItemPointerSetBlockNumber(ItemPointerData *pointer, BlockNumber blockNumber)
static OffsetNumber ItemPointerGetOffsetNumber(const ItemPointerData *pointer)
static BlockNumber ItemPointerGetBlockNumber(const ItemPointerData *pointer)
static BlockNumber ItemPointerGetBlockNumberNoCheck(const ItemPointerData *pointer)
static void ItemPointerCopy(const ItemPointerData *fromPointer, ItemPointerData *toPointer)
static bool ItemPointerIsValid(const ItemPointerData *pointer)
void XactLockTableWait(TransactionId xid, Relation rel, ItemPointer ctid, XLTW_Oper oper)
bool ConditionalXactLockTableWait(TransactionId xid)
bool DoLockModesConflict(LOCKMODE mode1, LOCKMODE mode2)
#define AccessExclusiveLock
@ LockTupleNoKeyExclusive
void pfree(void *pointer)
#define IsBootstrapProcessingMode()
#define START_CRIT_SECTION()
#define CHECK_FOR_INTERRUPTS()
#define END_CRIT_SECTION()
MultiXactId MultiXactIdExpand(MultiXactId multi, TransactionId xid, MultiXactStatus status)
bool MultiXactIdPrecedes(MultiXactId multi1, MultiXactId multi2)
bool MultiXactIdPrecedesOrEquals(MultiXactId multi1, MultiXactId multi2)
bool MultiXactIdIsRunning(MultiXactId multi, bool isLockOnly)
void MultiXactIdSetOldestMember(void)
MultiXactId MultiXactIdCreateFromMembers(int nmembers, MultiXactMember *members)
MultiXactId MultiXactIdCreate(TransactionId xid1, MultiXactStatus status1, TransactionId xid2, MultiXactStatus status2)
int GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members, bool from_pgupgrade, bool isLockOnly)
#define MultiXactIdIsValid(multi)
@ MultiXactStatusForShare
@ MultiXactStatusForNoKeyUpdate
@ MultiXactStatusNoKeyUpdate
@ MultiXactStatusForUpdate
@ MultiXactStatusForKeyShare
#define ISUPDATE_from_mxstatus(status)
#define InvalidMultiXactId
#define MaxMultiXactStatus
#define InvalidOffsetNumber
#define OffsetNumberIsValid(offsetNumber)
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
#define OffsetNumberPrev(offsetNumber)
Operator oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId, bool noError, int location)
FormData_pg_attribute * Form_pg_attribute
#define ERRCODE_DATA_CORRUPTED
static uint32 pg_nextpower2_32(uint32 num)
static PgChecksumMode mode
static const struct exclude_list_item skip[]
#define pgstat_count_heap_getnext(rel)
#define pgstat_count_heap_scan(rel)
void pgstat_count_heap_update(Relation rel, bool hot, bool newpage)
void pgstat_count_heap_delete(Relation rel)
void pgstat_count_heap_insert(Relation rel, PgStat_Counter n)
#define qsort(a, b, c, d)
static Oid DatumGetObjectId(Datum X)
static Pointer DatumGetPointer(Datum X)
void CheckForSerializableConflictOut(Relation relation, TransactionId xid, Snapshot snapshot)
void CheckForSerializableConflictIn(Relation relation, ItemPointer tid, BlockNumber blkno)
void PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot, TransactionId tuple_xid)
void PredicateLockRelation(Relation relation, Snapshot snapshot)
bool CheckForSerializableConflictOutNeeded(Relation relation, Snapshot snapshot)
GlobalVisState * GlobalVisTestFor(Relation rel)
bool TransactionIdIsInProgress(TransactionId xid)
void heap_page_prune_opt(Relation relation, Buffer buffer)
void heap_page_prune_execute(Buffer buffer, bool lp_truncate_only, OffsetNumber *redirected, int nredirected, OffsetNumber *nowdead, int ndead, OffsetNumber *nowunused, int nunused)
ReadStream * read_stream_begin_relation(int flags, BufferAccessStrategy strategy, Relation rel, ForkNumber forknum, ReadStreamBlockNumberCB callback, void *callback_private_data, size_t per_buffer_data_size)
void read_stream_reset(ReadStream *stream)
Buffer read_stream_next_buffer(ReadStream *stream, void **per_buffer_data)
void read_stream_end(ReadStream *stream)
BlockNumber(* ReadStreamBlockNumberCB)(ReadStream *stream, void *callback_private_data, void *per_buffer_data)
#define READ_STREAM_SEQUENTIAL
#define RelationGetRelid(relation)
#define RelationIsLogicallyLogged(relation)
#define RelationGetTargetPageFreeSpace(relation, defaultff)
#define RelationGetDescr(relation)
#define RelationGetNumberOfAttributes(relation)
#define RelationGetRelationName(relation)
#define RelationIsAccessibleInLogicalDecoding(relation)
#define RelationNeedsWAL(relation)
#define RelationUsesLocalBuffers(relation)
#define HEAP_DEFAULT_FILLFACTOR
void RelationDecrementReferenceCount(Relation rel)
void RelationIncrementReferenceCount(Relation rel)
Bitmapset * RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
@ INDEX_ATTR_BITMAP_HOT_BLOCKING
@ INDEX_ATTR_BITMAP_SUMMARIZED
@ INDEX_ATTR_BITMAP_IDENTITY_KEY
struct ParallelBlockTableScanDescData * ParallelBlockTableScanDesc
void heap_xlog_logical_rewrite(XLogReaderState *r)
#define ScanDirectionIsForward(direction)
#define ScanDirectionIsBackward(direction)
void UnregisterSnapshot(Snapshot snapshot)
TransactionId TransactionXmin
#define InitNonVacuumableSnapshot(snapshotdata, vistestp)
#define IsMVCCSnapshot(snapshot)
int get_tablespace_maintenance_io_concurrency(Oid spcid)
void ResolveRecoveryConflictWithSnapshot(TransactionId snapshotConflictHorizon, bool isCatalogRel, RelFileLocator locator)
BufferAccessStrategy strategy
uint32 already_extended_by
MultiXactId NoFreezePageRelminMxid
TransactionId FreezePageRelfrozenXid
MultiXactId FreezePageRelminMxid
TransactionId NoFreezePageRelfrozenXid
BufferAccessStrategy rs_strategy
ParallelBlockTableScanWorkerData * rs_parallelworkerdata
BlockNumber rs_startblock
OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]
ReadStream * rs_read_stream
int rs_empty_tuples_pending
BlockNumber rs_prefetch_block
TableScanDescData rs_base
const struct TableAmRoutine * rd_tableam
RelFileLocator rd_locator
ItemPointerData rs_mintid
ItemPointerData rs_maxtid
struct ScanKeyData * rs_key
struct SnapshotData * rs_snapshot
struct ParallelTableScanDescData * rs_parallel
TransactionId FreezeLimit
TransactionId relfrozenxid
MultiXactId MultiXactCutoff
OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]
ItemPointerData target_tid
RelFileLocator target_locator
TransactionId snapshotConflictHorizon
TransactionId SubTransGetTopmostTransaction(TransactionId xid)
void ss_report_location(Relation rel, BlockNumber location)
BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks)
#define FirstLowInvalidHeapAttributeNumber
#define TableOidAttributeNumber
void table_block_parallelscan_startblock_init(Relation rel, ParallelBlockTableScanWorker pbscanwork, ParallelBlockTableScanDesc pbscan)
BlockNumber table_block_parallelscan_nextpage(Relation rel, ParallelBlockTableScanWorker pbscanwork, ParallelBlockTableScanDesc pbscan)
bool synchronize_seqscans
bool TransactionIdDidCommit(TransactionId transactionId)
bool TransactionIdPrecedes(TransactionId id1, TransactionId id2)
bool TransactionIdPrecedesOrEquals(TransactionId id1, TransactionId id2)
bool TransactionIdDidAbort(TransactionId transactionId)
bool TransactionIdFollows(TransactionId id1, TransactionId id2)
bool TransactionIdFollowsOrEquals(TransactionId id1, TransactionId id2)
#define FrozenTransactionId
#define InvalidTransactionId
#define TransactionIdEquals(id1, id2)
#define TransactionIdIsValid(xid)
#define TransactionIdIsNormal(xid)
#define TupleDescAttr(tupdesc, i)
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
static bool HeapKeyTest(HeapTuple tuple, TupleDesc tupdesc, int nkeys, ScanKey keys)
#define VARATT_IS_EXTERNAL(PTR)
void visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf, XLogRecPtr recptr, Buffer vmBuf, TransactionId cutoff_xid, uint8 flags)
bool visibilitymap_pin_ok(BlockNumber heapBlk, Buffer vmbuf)
bool visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer vmbuf, uint8 flags)
void visibilitymap_pin(Relation rel, BlockNumber heapBlk, Buffer *vmbuf)
#define VISIBILITYMAP_VALID_BITS
#define VISIBILITYMAP_ALL_FROZEN
#define VISIBILITYMAP_XLOG_VALID_BITS
#define VISIBILITYMAP_XLOG_CATALOG_REL
#define VISIBILITYMAP_ALL_VISIBLE
TransactionId GetTopTransactionId(void)
TransactionId CheckXidAlive
TransactionId GetTopTransactionIdIfAny(void)
bool TransactionIdIsCurrentTransactionId(TransactionId xid)
bool IsInParallelMode(void)
TransactionId GetCurrentTransactionId(void)
CommandId GetCurrentCommandId(bool used)
#define XLOG_INCLUDE_ORIGIN
#define XLogHintBitIsNeeded()
#define InvalidXLogRecPtr
void XLogRegisterData(char *data, uint32 len)
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
bool XLogCheckBufferNeedsBackup(Buffer buffer)
void XLogSetRecordFlags(uint8 flags)
void XLogRegisterBufData(uint8 block_id, char *data, uint32 len)
void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags)
void XLogBeginInsert(void)
bool XLogRecGetBlockTagExtended(XLogReaderState *record, uint8 block_id, RelFileLocator *rlocator, ForkNumber *forknum, BlockNumber *blknum, Buffer *prefetch_buffer)
void XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id, RelFileLocator *rlocator, ForkNumber *forknum, BlockNumber *blknum)
char * XLogRecGetBlockData(XLogReaderState *record, uint8 block_id, Size *len)
#define XLogRecGetInfo(decoder)
#define XLogRecGetData(decoder)
#define XLogRecGetXid(decoder)
void FreeFakeRelcacheEntry(Relation fakerel)
XLogRedoAction XLogReadBufferForRedo(XLogReaderState *record, uint8 block_id, Buffer *buf)
Buffer XLogInitBufferForRedo(XLogReaderState *record, uint8 block_id)
Relation CreateFakeRelcacheEntry(RelFileLocator rlocator)
XLogRedoAction XLogReadBufferForRedoExtended(XLogReaderState *record, uint8 block_id, ReadBufferMode mode, bool get_cleanup_lock, Buffer *buf)