mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 19:12:03 +00:00
Removed extraordinarily bad code in StorageFile #2150
This commit is contained in:
parent
7100a74e41
commit
ef51f126b4
@ -121,7 +121,7 @@ public:
|
||||
{
|
||||
if (storage.use_table_fd)
|
||||
{
|
||||
storage.rwlock.lock();
|
||||
unique_lock = std::unique_lock(storage.rwlock);
|
||||
|
||||
/// We could use common ReadBuffer and WriteBuffer in storage to leverage cache
|
||||
/// and add ability to seek unseekable files, but cache sync isn't supported.
|
||||
@ -141,7 +141,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
storage.rwlock.lock_shared();
|
||||
shared_lock = std::shared_lock(storage.rwlock);
|
||||
|
||||
read_buf = std::make_unique<ReadBufferFromFile>(storage.path);
|
||||
}
|
||||
@ -149,14 +149,6 @@ public:
|
||||
reader = FormatFactory::instance().getInput(storage.format_name, *read_buf, storage.getSampleBlock(), context, max_block_size);
|
||||
}
|
||||
|
||||
~StorageFileBlockInputStream() override
|
||||
{
|
||||
if (storage.use_table_fd)
|
||||
storage.rwlock.unlock();
|
||||
else
|
||||
storage.rwlock.unlock_shared();
|
||||
}
|
||||
|
||||
String getName() const override
|
||||
{
|
||||
return storage.getName();
|
||||
@ -184,6 +176,9 @@ private:
|
||||
Block sample_block;
|
||||
std::unique_ptr<ReadBufferFromFileDescriptor> read_buf;
|
||||
BlockInputStreamPtr reader;
|
||||
|
||||
std::shared_lock<std::shared_mutex> shared_lock;
|
||||
std::unique_lock<std::shared_mutex> unique_lock;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user