summaryrefslogtreecommitdiff
path: root/src/backend/catalog/index.c
diff options
context:
space:
mode:
authorThomas Munro2023-09-05 06:26:12 +0000
committerThomas Munro2023-09-05 07:53:43 +0000
commitf691f5b80a85c66d715b4340ffabb503eb19393e (patch)
tree26a06c87096de2f9571956b4370ccbf1852d4cba /src/backend/catalog/index.c
parentaa0d3504560d40f4300a3d49d1c6c3bfc3b894e5 (diff)
Remove the "snapshot too old" feature.
Remove the old_snapshot_threshold setting and mechanism for producing the error "snapshot too old", originally added by commit 848ef42b. Unfortunately it had a number of known problems in terms of correctness and performance, mostly reported by Andres in the course of his work on snapshot scalability. We agreed to remove it, after a long period without an active plan to fix it. This is certainly a desirable feature, and someone might propose a new or improved implementation in the future. Reported-by: Andres Freund <[email protected]> Discussion: https://postgr.es/m/CACG%3DezYV%2BEvO135fLRdVn-ZusfVsTY6cH1OZqWtezuEYH6ciQA%40mail.gmail.com Discussion: https://postgr.es/m/20200401064008.qob7bfnnbu4w5cw4%40alap3.anarazel.de Discussion: https://postgr.es/m/CA%2BTgmoY%3Daqf0zjTD%2B3dUWYkgMiNDegDLFjo%2B6ze%3DWtpik%2B3XqA%40mail.gmail.com
Diffstat (limited to 'src/backend/catalog/index.c')
-rw-r--r--src/backend/catalog/index.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index fd09378848e..72f476b51de 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -3048,12 +3048,11 @@ index_build(Relation heapRelation,
/*
* If we found any potentially broken HOT chains, mark the index as not
* being usable until the current transaction is below the event horizon.
- * See src/backend/access/heap/README.HOT for discussion. Also set this
- * if early pruning/vacuuming is enabled for the heap relation. While it
- * might become safe to use the index earlier based on actual cleanup
- * activity and other active transactions, the test for that would be much
- * more complex and would require some form of blocking, so keep it simple
- * and fast by just using the current transaction.
+ * See src/backend/access/heap/README.HOT for discussion. While it might
+ * become safe to use the index earlier based on actual cleanup activity
+ * and other active transactions, the test for that would be much more
+ * complex and would require some form of blocking, so keep it simple and
+ * fast by just using the current transaction.
*
* However, when reindexing an existing index, we should do nothing here.
* Any HOT chains that are broken with respect to the index must predate
@@ -3065,7 +3064,7 @@ index_build(Relation heapRelation,
*
* We also need not set indcheckxmin during a concurrent index build,
* because we won't set indisvalid true until all transactions that care
- * about the broken HOT chains or early pruning/vacuuming are gone.
+ * about the broken HOT chains are gone.
*
* Therefore, this code path can only be taken during non-concurrent
* CREATE INDEX. Thus the fact that heap_update will set the pg_index
@@ -3074,7 +3073,7 @@ index_build(Relation heapRelation,
* about any concurrent readers of the tuple; no other transaction can see
* it yet.
*/
- if ((indexInfo->ii_BrokenHotChain || EarlyPruningEnabled(heapRelation)) &&
+ if (indexInfo->ii_BrokenHotChain &&
!isreindex &&
!indexInfo->ii_Concurrent)
{
@@ -3759,11 +3758,6 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
* reindexing pg_index itself, we must not try to update tuples in it.
* pg_index's indexes should always have these flags in their clean state,
* so that won't happen.
- *
- * If early pruning/vacuuming is enabled for the heap relation, the
- * usability horizon must be advanced to the current transaction on every
- * build or rebuild. pg_index is OK in this regard because catalog tables
- * are not subject to early cleanup.
*/
if (!skipped_constraint)
{
@@ -3771,7 +3765,6 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
HeapTuple indexTuple;
Form_pg_index indexForm;
bool index_bad;
- bool early_pruning_enabled = EarlyPruningEnabled(heapRelation);
pg_index = table_open(IndexRelationId, RowExclusiveLock);
@@ -3785,12 +3778,11 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
!indexForm->indisready ||
!indexForm->indislive);
if (index_bad ||
- (indexForm->indcheckxmin && !indexInfo->ii_BrokenHotChain) ||
- early_pruning_enabled)
+ (indexForm->indcheckxmin && !indexInfo->ii_BrokenHotChain))
{
- if (!indexInfo->ii_BrokenHotChain && !early_pruning_enabled)
+ if (!indexInfo->ii_BrokenHotChain)
indexForm->indcheckxmin = false;
- else if (index_bad || early_pruning_enabled)
+ else if (index_bad)
indexForm->indcheckxmin = true;
indexForm->indisvalid = true;
indexForm->indisready = true;