From 3bcb9b8db5dd4745f0c83940bbe11d21394754c1 Mon Sep 17 00:00:00 2001 From: feng lv Date: Thu, 8 Oct 2020 17:18:56 +0800 Subject: [PATCH] fix --- src/Storages/StorageMemory.cpp | 2 +- src/Storages/StorageMemory.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Storages/StorageMemory.cpp b/src/Storages/StorageMemory.cpp index 4231e45c74d..ad67696adaa 100644 --- a/src/Storages/StorageMemory.cpp +++ b/src/Storages/StorageMemory.cpp @@ -159,7 +159,7 @@ Pipe StorageMemory::read( metadata_snapshot, /// This hack is needed for global subqueries. /// It allows to set up this Source for read AFTER Storage::read() has been called and just before actual reading - [this](BlocksList::const_iterator & current_it, size_t & num_blocks) { + [this, ¤t_data](BlocksList::const_iterator & current_it, size_t & num_blocks) { std::lock_guard guard(mutex); current_it = current_data->begin(); num_blocks = current_data->size(); diff --git a/src/Storages/StorageMemory.h b/src/Storages/StorageMemory.h index a443d73a459..a1e98dcdedf 100644 --- a/src/Storages/StorageMemory.h +++ b/src/Storages/StorageMemory.h @@ -94,6 +94,8 @@ private: /// MultiVersion data storage, so that we can copy the list of blocks to readers. MultiVersion data; + mutable std::mutex mutex; + bool delay_read_for_global_subqueries = false; std::atomic total_size_bytes = 0;