diff options
author | Andres Freund <andres@anarazel.de> | 2019-04-23 21:42:12 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2019-04-23 21:42:12 -0700 |
commit | fdc7efcc30b1da950ade72fd35852c21bf8de839 (patch) | |
tree | 8ba16e49f1af187bbaac653bdb267143b6fc231c /src/backend/access/heap/heapam_handler.c | |
parent | 7ad1cd31bfcbaed122993deb778e6587a226e338 (diff) | |
download | postgresql-fdc7efcc30b1da950ade72fd35852c21bf8de839.tar.gz postgresql-fdc7efcc30b1da950ade72fd35852c21bf8de839.zip |
Allow pg_class xid & multixid horizons to not be set.
This allows table AMs that don't need these horizons. This was already
documented in the tableam relation_set_new_filenode callback, but an
assert prevented if from actually working (the test AM code contained
the change itself). Defang the asserts in the general code, and move
the stronger ones into heap AM.
Relatedly, after CLUSTER/VACUUM, we'd always assign a relfrozenxid /
relminmxid. Change the table_relation_copy_for_cluster() interface to
allow the AM to overwrite the horizons that get set on the pg_class
entry. This'd also in the future allow AMs like heap to compute a
relfrozenxid during rewrite that's the table's actual minimum rather
than a pre-determined value. Arguably it'd have been better to move
the whole computation / setting of those values into the callback, but
it seems likely that for other reasons it'd be better to be able to
use one value to vacuum/cluster multiple tables (e.g. a toast's
horizon shouldn't be different than the table's).
Reported-By: Heikki Linnakangas
Author: Andres Freund
Discussion: https://postgr.es/m/9a7fb9cc-2419-5db7-8840-ddc10c93f122@iki.fi
Diffstat (limited to 'src/backend/access/heap/heapam_handler.c')
-rw-r--r-- | src/backend/access/heap/heapam_handler.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index 1d8ca2429f9..6584a9cb8da 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -668,8 +668,8 @@ static void heapam_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap, Relation OldIndex, bool use_sort, TransactionId OldestXmin, - TransactionId FreezeXid, - MultiXactId MultiXactCutoff, + TransactionId *xid_cutoff, + MultiXactId *multi_cutoff, double *num_tuples, double *tups_vacuumed, double *tups_recently_dead) @@ -707,8 +707,8 @@ heapam_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap, isnull = (bool *) palloc(natts * sizeof(bool)); /* Initialize the rewrite operation */ - rwstate = begin_heap_rewrite(OldHeap, NewHeap, OldestXmin, FreezeXid, - MultiXactCutoff, use_wal); + rwstate = begin_heap_rewrite(OldHeap, NewHeap, OldestXmin, *xid_cutoff, + *multi_cutoff, use_wal); /* Set up sorting if wanted */ |