mirror of https://github.com/citusdata/citus.git
PG18 - register snapshot where needed (#8196)
Register and push snapshots as needed per the relevant PG18 commits
8076c00592
https://github.com/postgres/postgres/commit/706054b
`citus_split_shard_columnar_partitioned`, `multi_partitioning` tests are
handled.
Fixes #8195
pull/7723/head
parent
81776fe190
commit
de045402f3
|
|
@ -1267,7 +1267,21 @@ StripesForRelfilelocator(RelFileLocator relfilelocator)
|
||||||
{
|
{
|
||||||
uint64 storageId = LookupStorageId(relfilelocator);
|
uint64 storageId = LookupStorageId(relfilelocator);
|
||||||
|
|
||||||
return ReadDataFileStripeList(storageId, GetTransactionSnapshot());
|
/*
|
||||||
|
* PG18 requires snapshot to be active or registered before it's used
|
||||||
|
* Without this, we hit
|
||||||
|
* Assert(snapshot->regd_count > 0 || snapshot->active_count > 0);
|
||||||
|
* when reading columnar stripes.
|
||||||
|
* Relevant PG18 commit:
|
||||||
|
* 8076c00592e40e8dbd1fce7a98b20d4bf075e4ba
|
||||||
|
*/
|
||||||
|
Snapshot snapshot = RegisterSnapshot(GetTransactionSnapshot());
|
||||||
|
|
||||||
|
List *readDataFileStripeList = ReadDataFileStripeList(storageId, snapshot);
|
||||||
|
|
||||||
|
UnregisterSnapshot(snapshot);
|
||||||
|
|
||||||
|
return readDataFileStripeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -854,8 +854,11 @@ PostprocessIndexStmt(Node *node, const char *queryString)
|
||||||
table_close(relation, NoLock);
|
table_close(relation, NoLock);
|
||||||
index_close(indexRelation, NoLock);
|
index_close(indexRelation, NoLock);
|
||||||
|
|
||||||
|
PushActiveSnapshot(GetTransactionSnapshot());
|
||||||
|
|
||||||
/* mark index as invalid, in-place (cannot be rolled back) */
|
/* mark index as invalid, in-place (cannot be rolled back) */
|
||||||
index_set_state_flags(indexRelationId, INDEX_DROP_CLEAR_VALID);
|
index_set_state_flags(indexRelationId, INDEX_DROP_CLEAR_VALID);
|
||||||
|
PopActiveSnapshot();
|
||||||
|
|
||||||
/* re-open a transaction command from here on out */
|
/* re-open a transaction command from here on out */
|
||||||
CommitTransactionCommand();
|
CommitTransactionCommand();
|
||||||
|
|
@ -1370,8 +1373,11 @@ MarkIndexValid(IndexStmt *indexStmt)
|
||||||
schemaId);
|
schemaId);
|
||||||
Relation indexRelation = index_open(indexRelationId, RowExclusiveLock);
|
Relation indexRelation = index_open(indexRelationId, RowExclusiveLock);
|
||||||
|
|
||||||
|
PushActiveSnapshot(GetTransactionSnapshot());
|
||||||
|
|
||||||
/* mark index as valid, in-place (cannot be rolled back) */
|
/* mark index as valid, in-place (cannot be rolled back) */
|
||||||
index_set_state_flags(indexRelationId, INDEX_CREATE_SET_VALID);
|
index_set_state_flags(indexRelationId, INDEX_CREATE_SET_VALID);
|
||||||
|
PopActiveSnapshot();
|
||||||
|
|
||||||
table_close(relation, NoLock);
|
table_close(relation, NoLock);
|
||||||
index_close(indexRelation, NoLock);
|
index_close(indexRelation, NoLock);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue