mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
tableam: relation creation, VACUUM FULL/CLUSTER, SET TABLESPACE.
This moves the responsibility for: - creating the storage necessary for a relation, including creating a new relfilenode for a relation with existing storage - non-transactional truncation of a relation - VACUUM FULL / CLUSTER's rewrite of a table below tableam. This is fairly straight forward, with a bit of complexity smattered in to move the computation of xid / multixid horizons below the AM, as they don't make sense for every table AM. Author: Andres Freund Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
This commit is contained in:
@ -312,12 +312,17 @@ ResetSequence(Oid seq_relid)
|
||||
seq->log_cnt = 0;
|
||||
|
||||
/*
|
||||
* Create a new storage file for the sequence. We want to keep the
|
||||
* sequence's relfrozenxid at 0, since it won't contain any unfrozen XIDs.
|
||||
* Same with relminmxid, since a sequence will never contain multixacts.
|
||||
* Create a new storage file for the sequence.
|
||||
*/
|
||||
RelationSetNewRelfilenode(seq_rel, seq_rel->rd_rel->relpersistence,
|
||||
InvalidTransactionId, InvalidMultiXactId);
|
||||
RelationSetNewRelfilenode(seq_rel, seq_rel->rd_rel->relpersistence);
|
||||
|
||||
/*
|
||||
* Ensure sequence's relfrozenxid is at 0, since it won't contain any
|
||||
* unfrozen XIDs. Same with relminmxid, since a sequence will never
|
||||
* contain multixacts.
|
||||
*/
|
||||
Assert(seq_rel->rd_rel->relfrozenxid == InvalidTransactionId);
|
||||
Assert(seq_rel->rd_rel->relminmxid == InvalidMultiXactId);
|
||||
|
||||
/*
|
||||
* Insert the modified tuple into the new storage file.
|
||||
@ -482,12 +487,17 @@ AlterSequence(ParseState *pstate, AlterSeqStmt *stmt)
|
||||
|
||||
/*
|
||||
* Create a new storage file for the sequence, making the state
|
||||
* changes transactional. We want to keep the sequence's relfrozenxid
|
||||
* at 0, since it won't contain any unfrozen XIDs. Same with
|
||||
* relminmxid, since a sequence will never contain multixacts.
|
||||
* changes transactional.
|
||||
*/
|
||||
RelationSetNewRelfilenode(seqrel, seqrel->rd_rel->relpersistence,
|
||||
InvalidTransactionId, InvalidMultiXactId);
|
||||
RelationSetNewRelfilenode(seqrel, seqrel->rd_rel->relpersistence);
|
||||
|
||||
/*
|
||||
* Ensure sequence's relfrozenxid is at 0, since it won't contain any
|
||||
* unfrozen XIDs. Same with relminmxid, since a sequence will never
|
||||
* contain multixacts.
|
||||
*/
|
||||
Assert(seqrel->rd_rel->relfrozenxid == InvalidTransactionId);
|
||||
Assert(seqrel->rd_rel->relminmxid == InvalidMultiXactId);
|
||||
|
||||
/*
|
||||
* Insert the modified tuple into the new storage file.
|
||||
|
Reference in New Issue
Block a user