mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Make DDL operations play nicely with Serializable Snapshot Isolation.
Truncating or dropping a table is treated like deletion of all tuples, and check for conflicts accordingly. If a table is clustered or rewritten by ALTER TABLE, all predicate locks on the heap are promoted to relation-level locks, because the tuple or page ids of any existing tuples will change and won't be valid after rewriting the table. Arguably ALTER TABLE should be treated like a mass-UPDATE of every row, but if you e.g change the datatype of a column, you could also argue that it's just a change to the physical layout, not a logical change. Reindexing promotes all locks on the index to relation-level lock on the heap. Kevin Grittner, with a lot of cosmetic changes by me.
This commit is contained in:
@@ -49,11 +49,13 @@ extern void PredicateLockPage(const Relation relation, const BlockNumber blkno);
|
||||
extern void PredicateLockTuple(const Relation relation, const HeapTuple tuple);
|
||||
extern void PredicateLockPageSplit(const Relation relation, const BlockNumber oldblkno, const BlockNumber newblkno);
|
||||
extern void PredicateLockPageCombine(const Relation relation, const BlockNumber oldblkno, const BlockNumber newblkno);
|
||||
extern void TransferPredicateLocksToHeapRelation(const Relation relation);
|
||||
extern void ReleasePredicateLocks(const bool isCommit);
|
||||
|
||||
/* conflict detection (may also trigger rollback) */
|
||||
extern void CheckForSerializableConflictOut(const bool valid, const Relation relation, const HeapTuple tuple, const Buffer buffer);
|
||||
extern void CheckForSerializableConflictIn(const Relation relation, const HeapTuple tuple, const Buffer buffer);
|
||||
extern void CheckTableForSerializableConflictIn(const Relation relation);
|
||||
|
||||
/* final rollback checking */
|
||||
extern void PreCommit_CheckForSerializationFailure(void);
|
||||
|
||||
Reference in New Issue
Block a user