mirror of https://github.com/citusdata/citus.git
Flush write state when initializing read state
In next commit, we will adjust curcid of the snapshot being used when scanning the columnar table. However, for index scan, snapshot is provided not when beginning scan but within fetch-tuple call. For this reason, start flushing pending writes in init_columnar_read_state since this seem to be a prerequisite step that needs to be done before scanning a columnar table regardless of the scan method being used.pull/5154/head
parent
db0e4ce889
commit
6c26c67ea0
|
@ -227,8 +227,6 @@ columnar_beginscan_extended(Relation relation, Snapshot snapshot,
|
|||
"cannot read from table when there is unflushed data in upper transactions");
|
||||
}
|
||||
|
||||
FlushWriteStateForRelfilenode(relfilenode, GetCurrentSubTransactionId());
|
||||
|
||||
MemoryContextSwitchTo(oldContext);
|
||||
|
||||
return ((TableScanDesc) scan);
|
||||
|
@ -257,6 +255,9 @@ init_columnar_read_state(Relation relation, TupleDesc tupdesc, Bitmapset *attr_n
|
|||
{
|
||||
MemoryContext oldContext = MemoryContextSwitchTo(scanContext);
|
||||
|
||||
Oid relfilenode = relation->rd_node.relNode;
|
||||
FlushWriteStateForRelfilenode(relfilenode, GetCurrentSubTransactionId());
|
||||
|
||||
List *neededColumnList = NeededColumnsList(tupdesc, attr_needed);
|
||||
ColumnarReadState *readState = ColumnarBeginRead(relation, tupdesc, neededColumnList,
|
||||
scanQual, scanContext, snapshot);
|
||||
|
@ -429,8 +430,6 @@ columnar_index_fetch_begin(Relation rel)
|
|||
"upper transactions");
|
||||
}
|
||||
|
||||
FlushWriteStateForRelfilenode(relfilenode, GetCurrentSubTransactionId());
|
||||
|
||||
MemoryContext scanContext = CreateColumnarScanMemoryContext();
|
||||
MemoryContext oldContext = MemoryContextSwitchTo(scanContext);
|
||||
|
||||
|
|
Loading…
Reference in New Issue