Temporary build fix with PG17 development branch

Because the current smgr patchset is based on the PG17 branch, smgr
development needs to be based on that. But our current copied PG16
code doesn't compile with PG17.

This commit doesn't try to make the pg_tde AM work with PG17, only
"comments out" with conditional commands parts that do not compile.

PG16 builds work as before, without any changes.

PG17 at least compiles with missing code, probably doesn't really work.
pull/209/head
Zsolt Parragi 1 year ago
parent 578e962d44
commit cbec8ceb52
  1. 10
      src/access/pg_tde_prune.c
  2. 7
      src/access/pg_tde_vacuumlazy.c
  3. 21
      src/access/pg_tdeam.c

@ -127,6 +127,7 @@ pg_tde_page_prune_opt(Relation relation, Buffer buffer)
if (RecoveryInProgress())
return;
#if PG_VERSION_NUM < 170000
/*
* XXX: Magic to keep old_snapshot_threshold tests appear "working". They
* currently are broken, and discussion of what to do about them is
@ -135,7 +136,7 @@ pg_tde_page_prune_opt(Relation relation, Buffer buffer)
*/
if (old_snapshot_threshold == 0)
SnapshotTooOldMagicForTest();
#endif
/*
* First check whether there's any chance there's something to prune,
* determining the appropriate horizon is a waste if there's no prune_xid
@ -166,14 +167,14 @@ pg_tde_page_prune_opt(Relation relation, Buffer buffer)
if (!GlobalVisTestIsRemovableXid(vistest, prune_xid))
{
#if PG_VERSION_NUM < 170000
if ( !OldSnapshotThresholdActive())
return;
if (!TransactionIdLimitedForOldSnapshots(GlobalVisTestNonRemovableHorizon(vistest),
relation,
&limited_xmin, &limited_ts))
return;
#endif
if (!TransactionIdPrecedes(prune_xid, limited_xmin))
return;
}
@ -539,6 +540,7 @@ heap_prune_satisfies_vacuum(PruneState *prstate, HeapTuple tup, Buffer buffer)
*/
if (GlobalVisTestIsRemovableXid(prstate->vistest, dead_after))
res = HEAPTUPLE_DEAD;
#if PG_VERSION_NUM < 170000
else if (OldSnapshotThresholdActive())
{
/* haven't determined limited horizon yet, requests */
@ -566,7 +568,7 @@ heap_prune_satisfies_vacuum(PruneState *prstate, HeapTuple tup, Buffer buffer)
res = HEAPTUPLE_DEAD;
}
}
#endif
return res;
}

@ -2828,8 +2828,11 @@ should_attempt_truncation(LVRelState *vacrel)
{
BlockNumber possibly_freeable;
if (!vacrel->do_rel_truncate || VacuumFailsafeActive ||
old_snapshot_threshold >= 0)
if (!vacrel->do_rel_truncate || VacuumFailsafeActive
#if PG_VERSION_NUM < 170000
|| old_snapshot_threshold >= 0
#endif
)
return false;
possibly_freeable = vacrel->rel_pages - vacrel->nonempty_pages;

@ -430,7 +430,9 @@ pg_tde_getpage(TableScanDesc sscan, BlockNumber block)
LockBuffer(buffer, BUFFER_LOCK_SHARE);
page = BufferGetPage(buffer);
#if PG_VERSION_NUM < 170000
TestForOldSnapshot(snapshot, scan->rs_base.rs_rd, page);
#endif
lines = PageGetMaxOffsetNumber(page);
ntup = 0;
@ -569,9 +571,9 @@ pg_tde_gettup_start_page(HeapScanDesc scan, ScanDirection dir, int *linesleft,
/* Caller is responsible for ensuring buffer is locked if needed */
page = BufferGetPage(scan->rs_cbuf);
#if PG_VERSION_NUM < 170000
TestForOldSnapshot(scan->rs_base.rs_snapshot, scan->rs_base.rs_rd, page);
#endif
*linesleft = PageGetMaxOffsetNumber(page) - FirstOffsetNumber + 1;
if (ScanDirectionIsForward(dir))
@ -602,9 +604,9 @@ pg_tde_gettup_continue_page(HeapScanDesc scan, ScanDirection dir, int *linesleft
/* Caller is responsible for ensuring buffer is locked if needed */
page = BufferGetPage(scan->rs_cbuf);
#if PG_VERSION_NUM < 170000
TestForOldSnapshot(scan->rs_base.rs_snapshot, scan->rs_base.rs_rd, page);
#endif
if (ScanDirectionIsForward(dir))
{
*lineoff = OffsetNumberNext(scan->rs_coffset);
@ -869,8 +871,9 @@ pg_tde_gettup_pagemode(HeapScanDesc scan,
/* continue from previously returned page/tuple */
block = scan->rs_cblock; /* current page */
page = BufferGetPage(scan->rs_cbuf);
#if PG_VERSION_NUM < 170000
TestForOldSnapshot(scan->rs_base.rs_snapshot, scan->rs_base.rs_rd, page);
#endif
lineindex = scan->rs_cindex + dir;
if (ScanDirectionIsForward(dir))
linesleft = scan->rs_ntuples - lineindex;
@ -889,7 +892,9 @@ pg_tde_gettup_pagemode(HeapScanDesc scan,
{
pg_tde_getpage((TableScanDesc) scan, block);
page = BufferGetPage(scan->rs_cbuf);
#if PG_VERSION_NUM < 170000
TestForOldSnapshot(scan->rs_base.rs_snapshot, scan->rs_base.rs_rd, page);
#endif
linesleft = scan->rs_ntuples;
lineindex = ScanDirectionIsForward(dir) ? 0 : linesleft - 1;
@ -1377,8 +1382,9 @@ pg_tde_fetch(Relation relation,
*/
LockBuffer(buffer, BUFFER_LOCK_SHARE);
page = BufferGetPage(buffer);
#if PG_VERSION_NUM < 170000
TestForOldSnapshot(snapshot, relation, page);
#endif
/*
* We'd better check for out-of-range offnum in case of VACUUM since the
* TID was obtained.
@ -1668,8 +1674,9 @@ pg_tde_get_latest_tid(TableScanDesc sscan,
buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(&ctid));
LockBuffer(buffer, BUFFER_LOCK_SHARE);
page = BufferGetPage(buffer);
#if PG_VERSION_NUM < 170000
TestForOldSnapshot(snapshot, relation, page);
#endif
/*
* Check for bogus item number. This is not treated as an error
* condition because it can happen while following a t_ctid link. We

Loading…
Cancel
Save