mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
Fix encrypted
This commit is contained in:
parent
cde5cecc4d
commit
5b9b053c61
@ -287,6 +287,7 @@ std::unique_ptr<ReadBufferFromFileBase> DiskEncrypted::readFile(
|
|||||||
{
|
{
|
||||||
auto wrapped_path = wrappedPath(path);
|
auto wrapped_path = wrappedPath(path);
|
||||||
auto buffer = delegate->readFile(wrapped_path, settings, read_hint, file_size);
|
auto buffer = delegate->readFile(wrapped_path, settings, read_hint, file_size);
|
||||||
|
buffer->setReadUntilPosition(FileEncryption::Header::kSize);
|
||||||
if (buffer->eof())
|
if (buffer->eof())
|
||||||
{
|
{
|
||||||
/// File is empty, that's a normal case, see DiskEncrypted::truncateFile().
|
/// File is empty, that's a normal case, see DiskEncrypted::truncateFile().
|
||||||
@ -296,6 +297,7 @@ std::unique_ptr<ReadBufferFromFileBase> DiskEncrypted::readFile(
|
|||||||
auto encryption_settings = current_settings.get();
|
auto encryption_settings = current_settings.get();
|
||||||
FileEncryption::Header header = readHeader(*buffer);
|
FileEncryption::Header header = readHeader(*buffer);
|
||||||
String key = getKey(path, header, *encryption_settings);
|
String key = getKey(path, header, *encryption_settings);
|
||||||
|
buffer->setReadUntilPosition(0); /// Reset position back.
|
||||||
return std::make_unique<ReadBufferFromEncryptedFile>(settings.local_fs_buffer_size, std::move(buffer), key, header);
|
return std::make_unique<ReadBufferFromEncryptedFile>(settings.local_fs_buffer_size, std::move(buffer), key, header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,6 +142,12 @@ void AsynchronousReadIndirectBufferFromRemoteFS::setReadUntilPosition(size_t pos
|
|||||||
prefetch_future = {};
|
prefetch_future = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (position == 0)
|
||||||
|
{
|
||||||
|
read_until_position.reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (position > read_until_position)
|
if (position > read_until_position)
|
||||||
{
|
{
|
||||||
read_until_position = position;
|
read_until_position = position;
|
||||||
|
Loading…
Reference in New Issue
Block a user