mirror of https://github.com/citusdata/citus.git
Move PushActiveSnapshot outside a for loop (#8253)
In the PR [8142](https://github.com/citusdata/citus/pull/8142) was added `PushActiveSnapshot`. This commit places it outside a for loop as taking a snapshot is a resource heavy operation.pull/8305/head
parent
86010de733
commit
503a2aba73
|
|
@ -618,7 +618,13 @@ SaveStripeSkipList(RelFileLocator relfilelocator, uint64 stripe,
|
|||
Oid columnarChunkOid = ColumnarChunkRelationId();
|
||||
Relation columnarChunk = table_open(columnarChunkOid, RowExclusiveLock);
|
||||
ModifyState *modifyState = StartModifyRelation(columnarChunk);
|
||||
bool pushed_snapshot = false;
|
||||
|
||||
if (!ActiveSnapshotSet())
|
||||
{
|
||||
PushActiveSnapshot(GetTransactionSnapshot());
|
||||
pushed_snapshot = true;
|
||||
}
|
||||
for (columnIndex = 0; columnIndex < columnCount; columnIndex++)
|
||||
{
|
||||
for (chunkIndex = 0; chunkIndex < chunkList->chunkCount; chunkIndex++)
|
||||
|
|
@ -659,11 +665,13 @@ SaveStripeSkipList(RelFileLocator relfilelocator, uint64 stripe,
|
|||
nulls[Anum_columnar_chunk_minimum_value - 1] = true;
|
||||
nulls[Anum_columnar_chunk_maximum_value - 1] = true;
|
||||
}
|
||||
PushActiveSnapshot(GetTransactionSnapshot());
|
||||
InsertTupleAndEnforceConstraints(modifyState, values, nulls);
|
||||
PopActiveSnapshot();
|
||||
}
|
||||
}
|
||||
if (pushed_snapshot)
|
||||
{
|
||||
PopActiveSnapshot();
|
||||
}
|
||||
|
||||
FinishModifyRelation(modifyState);
|
||||
table_close(columnarChunk, RowExclusiveLock);
|
||||
|
|
|
|||
Loading…
Reference in New Issue