* Fixing bug in writeIntoLiveView method where mergeable blocks

would always be reobtained after 64 inserts
This commit is contained in:
Vitaliy Zakaznikov 2019-06-17 12:39:01 -04:00
parent d876f7f332
commit 8df3e48a7b

View File

@ -141,6 +141,7 @@ public:
std::shared_ptr<BlocksPtr> getBlocksPtr() { return blocks_ptr; } std::shared_ptr<BlocksPtr> getBlocksPtr() { return blocks_ptr; }
BlocksPtrs getMergeableBlocks() { return mergeable_blocks; } BlocksPtrs getMergeableBlocks() { return mergeable_blocks; }
void setMergeableBlocks(BlocksPtrs blocks) { mergeable_blocks = blocks; }
std::shared_ptr<bool> getActivePtr() { return active_ptr; } std::shared_ptr<bool> getActivePtr() { return active_ptr; }
/// Read new data blocks that store query result /// Read new data blocks that store query result
@ -193,12 +194,13 @@ public:
{ {
mergeable_blocks = std::make_shared<std::vector<BlocksPtr>>(); mergeable_blocks = std::make_shared<std::vector<BlocksPtr>>();
BlocksPtr base_mergeable_blocks = std::make_shared<Blocks>(); BlocksPtr base_mergeable_blocks = std::make_shared<Blocks>();
InterpreterSelectQuery interpreter(live_view.getInnerQuery(), context, SelectQueryOptions(QueryProcessingStage::WithMergeableState), Names{}); InterpreterSelectQuery interpreter(live_view.getInnerQuery(), context, SelectQueryOptions(QueryProcessingStage::WithMergeableState), Names());
auto view_mergeable_stream = std::make_shared<MaterializingBlockInputStream>( auto view_mergeable_stream = std::make_shared<MaterializingBlockInputStream>(
interpreter.execute().in); interpreter.execute().in);
while (Block this_block = view_mergeable_stream->read()) while (Block this_block = view_mergeable_stream->read())
base_mergeable_blocks->push_back(this_block); base_mergeable_blocks->push_back(this_block);
mergeable_blocks->push_back(base_mergeable_blocks); mergeable_blocks->push_back(base_mergeable_blocks);
live_view.setMergeableBlocks(mergeable_blocks);
} }
/// Need make new mergeable block structure match the other mergeable blocks /// Need make new mergeable block structure match the other mergeable blocks