This commit is contained in:
kssenii 2024-12-03 12:21:35 +01:00
parent 3a4f2ab890
commit 9a0ae45e50
3 changed files with 7 additions and 8 deletions

View File

@ -10,7 +10,6 @@
#include <Interpreters/Cache/SLRUFileCachePriority.h>
#include <Interpreters/Cache/FileCacheUtils.h>
#include <Interpreters/Cache/EvictionCandidates.h>
#include <Interpreters/Cache/FileCacheUtils.h>
#include <Interpreters/Context.h>
#include <base/hex.h>
#include <Common/callOnce.h>

View File

@ -392,12 +392,6 @@ void FileSegment::write(char * from, size_t size, size_t offset_in_file)
range().size(), first_non_downloaded_offset, size, current_downloaded_size);
}
}
if (!cache_writer && current_downloaded_size > 0)
throw Exception(
ErrorCodes::LOGICAL_ERROR,
"Cache writer was finalized (downloaded size: {}, state: {})",
current_downloaded_size, stateToString(download_state));
}
try
@ -409,7 +403,12 @@ void FileSegment::write(char * from, size_t size, size_t offset_in_file)
#endif
if (!cache_writer)
cache_writer = std::make_unique<WriteBufferFromFile>(getPath(), /* buf_size */0);
{
int flags = -1;
if (downloaded_size > 0)
flags = O_WRONLY | O_APPEND | O_CLOEXEC;
cache_writer = std::make_unique<WriteBufferFromFile>(getPath(), /* buf_size */0, flags);
}
/// Size is equal to offset as offset for write buffer points to data end.
cache_writer->set(from, /* size */size, /* offset */size);

View File

@ -64,6 +64,7 @@
<disk>s3</disk>
<path>/jbod1/</path>
<max_size>1000000000</max_size>
<boundary_alignment>20Ki</boundary_alignment>
<max_file_segment_size>1Gi</max_file_segment_size>
</s3_with_cache_and_jbod>
<s3_r>