Conversation
a5b871d to
41d3aa6
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8142 +/- ##
==========================================
+ Coverage 88.90% 88.93% +0.03%
==========================================
Files 287 287
Lines 63083 63088 +5
Branches 7930 7930
==========================================
+ Hits 56083 56107 +24
+ Misses 4693 4673 -20
- Partials 2307 2308 +1 🚀 New features to boost your workflow:
|
41d3aa6 to
20752e7
Compare
20752e7 to
e040d8b
Compare
|
Ran local tests with PG15 & PG17. No more assertion crashes. |
insert_select_into_local_table test
at SELECT alter_table_set_access_method('non_dist_default', 'columnar');
e040d8b to
c6c80de
Compare
| HeapTuple heapTuple = heap_form_tuple(tupleDescriptor, values, isNulls); | ||
|
|
||
| CATALOG_INSERT_WITH_SNAPSHOT(pgDistNode, heapTuple); | ||
| PushActiveSnapshot(GetTransactionSnapshot()); |
There was a problem hiding this comment.
nitpick:
we may reduce code duplication by similar like
/* maybe under a utils file */
static inline void
CatalogInsertWithTxnSnapshot(Relation rel, HeapTuple tup)
{
PushActiveSnapshot(GetTransactionSnapshot());
CatalogTupleInsert(rel, tup);
PopActiveSnapshot();
}
or more complex but more generic and can be used later as well
#define WITH_TXN_SNAPSHOT(...) \
do { \
PushActiveSnapshot(GetTransactionSnapshot()); \
__VA_ARGS__; \
PopActiveSnapshot(); \
} while (0)
WITH_TXN_SNAPSHOT(
InsertTupleAndEnforceConstraints(modifyState, values, nulls)
);
WITH_TXN_SNAPSHOT(
CatalogTupleInsert(pgDistTransaction, heapTuple)
);
There was a problem hiding this comment.
Prefer to go with Postgres approach postgres/postgres@706054b#diff-d373fb790605aded212c2e3a0fbe8c015d110077ff46c07d0a6d6647a2d7e928
| nulls[Anum_columnar_chunk_maximum_value - 1] = true; | ||
| } | ||
|
|
||
| PushActiveSnapshot(GetTransactionSnapshot()); |
There was a problem hiding this comment.
@naisila could you please tell why PushActiveSnapshot/PopActiveSnapshot are inside the loop rather than outside
Is it possible to do it this way to save resources?
PushActiveSnapshot(GetTransactionSnapshot());
for (columnIndex = 0; columnIndex < columnCount; columnIndex++)
{
for (chunkIndex = 0; chunkIndex < chunkList->chunkCount; chunkIndex++)
{
....
InsertTupleAndEnforceConstraints(modifyState, values, nulls);
...
}
...
}
PopActiveSnapshot();
your code:
for (columnIndex = 0; columnIndex < columnCount; columnIndex++)
{
for (chunkIndex = 0; chunkIndex < chunkList->chunkCount; chunkIndex++)
{
...
PushActiveSnapshot(GetTransactionSnapshot());
InsertTupleAndEnforceConstraints(modifyState, values, nulls);
PopActiveSnapshot();
...
}
...
}
Thank you!
In the PR [8142](#8142) was added `PushActiveSnapshot`. This commit places it outside a for loop as taking a snapshot is a resource heavy operation.
In the PR [8142](#8142) was added `PushActiveSnapshot`. This commit places it outside a for loop as taking a snapshot is a resource heavy operation.
In the PR [8142](#8142) was added `PushActiveSnapshot`. This commit places it outside a for loop as taking a snapshot is a resource heavy operation.
Sister PR citusdata/the-process#172
Fixes #8134 #8149