mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 09:10:48 +00:00
Merge pull request #22721 from kitaisreal/memory-storage-sync-comments-and-code
MemoryStorage sync comments and code
This commit is contained in:
commit
e38206ee02
@ -26,10 +26,6 @@ class MemorySource : public SourceWithProgress
|
||||
{
|
||||
using InitializerFunc = std::function<void(std::shared_ptr<const Blocks> &)>;
|
||||
public:
|
||||
/// Blocks are stored in std::list which may be appended in another thread.
|
||||
/// We use pointer to the beginning of the list and its current size.
|
||||
/// We don't need synchronisation in this reader, because while we hold SharedLock on storage,
|
||||
/// only new elements can be added to the back of the list, so our iterators remain valid
|
||||
|
||||
MemorySource(
|
||||
Names column_names_,
|
||||
@ -59,7 +55,7 @@ protected:
|
||||
|
||||
size_t current_index = getAndIncrementExecutionIndex();
|
||||
|
||||
if (current_index >= data->size())
|
||||
if (!data || current_index >= data->size())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
void delayReadForGlobalSubqueries() { delay_read_for_global_subqueries = true; }
|
||||
|
||||
private:
|
||||
/// MultiVersion data storage, so that we can copy the list of blocks to readers.
|
||||
/// MultiVersion data storage, so that we can copy the vector of blocks to readers.
|
||||
|
||||
MultiVersion<Blocks> data;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user