mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #29959 from azat/log-data-race-file-checker-fix
Fix possible data-race between FileChecker and StorageLog/StorageStripeLog
This commit is contained in:
commit
8d694cbcdc
@ -24,6 +24,7 @@
|
||||
#include <Parsers/ASTLiteral.h>
|
||||
#include "StorageLogSettings.h"
|
||||
#include <Processors/Sources/SourceWithProgress.h>
|
||||
#include <Processors/Sources/NullSource.h>
|
||||
#include <Processors/Pipe.h>
|
||||
#include <Processors/Sinks/SinkToStorage.h>
|
||||
|
||||
@ -122,9 +123,6 @@ Chunk LogSource::generate()
|
||||
if (rows_read == rows_limit)
|
||||
return {};
|
||||
|
||||
if (storage.file_checker.empty())
|
||||
return {};
|
||||
|
||||
/// How many rows to read for the next block.
|
||||
size_t max_rows_to_read = std::min(block_size, rows_limit - rows_read);
|
||||
std::unordered_map<String, ISerialization::SubstreamsCache> caches;
|
||||
@ -672,6 +670,9 @@ Pipe StorageLog::read(
|
||||
if (!lock)
|
||||
throw Exception("Lock timeout exceeded", ErrorCodes::TIMEOUT_EXCEEDED);
|
||||
|
||||
if (file_checker.empty())
|
||||
return Pipe(std::make_shared<NullSource>(metadata_snapshot->getSampleBlockForColumns(column_names, getVirtuals(), getStorageID())));
|
||||
|
||||
Pipes pipes;
|
||||
|
||||
const Marks & marks = getMarksWithRealRowCount(metadata_snapshot);
|
||||
|
@ -98,9 +98,6 @@ public:
|
||||
protected:
|
||||
Chunk generate() override
|
||||
{
|
||||
if (storage.file_checker.empty())
|
||||
return {};
|
||||
|
||||
Block res;
|
||||
start();
|
||||
|
||||
@ -337,7 +334,7 @@ Pipe StorageStripeLog::read(
|
||||
Pipes pipes;
|
||||
|
||||
String index_file = table_path + "index.mrk";
|
||||
if (!disk->exists(index_file))
|
||||
if (file_checker.empty() || !disk->exists(index_file))
|
||||
{
|
||||
return Pipe(std::make_shared<NullSource>(metadata_snapshot->getSampleBlockForColumns(column_names, getVirtuals(), getStorageID())));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user