Fix tests

This commit is contained in:
kssenii 2023-01-20 14:09:04 +01:00
parent 170426c0a9
commit 545d3c276c
3 changed files with 6 additions and 4 deletions

View File

@ -123,7 +123,7 @@ bool FileCache::readThrowCacheAllowed()
} }
FileSegments FileCache::getImpl( FileSegments FileCache::getImpl(
const Key & key, const FileSegment::Range & range, const KeyTransaction & key_transaction) const const Key & key, const FileSegment::Range & range, const KeyTransaction & key_transaction)
{ {
/// Given range = [left, right] and non-overlapping ordered set of file segments, /// Given range = [left, right] and non-overlapping ordered set of file segments,
/// find list [segment1, ..., segmentN] of segments which intersect with given range. /// find list [segment1, ..., segmentN] of segments which intersect with given range.
@ -131,7 +131,7 @@ FileSegments FileCache::getImpl(
if (bypass_cache_threshold && range.size() > bypass_cache_threshold) if (bypass_cache_threshold && range.size() > bypass_cache_threshold)
{ {
auto file_segment = std::make_shared<FileSegment>( auto file_segment = std::make_shared<FileSegment>(
range.left, range.size(), key, nullptr, nullptr, range.left, range.size(), key, nullptr, this,
FileSegment::State::SKIP_CACHE, CreateFileSegmentSettings{}); FileSegment::State::SKIP_CACHE, CreateFileSegmentSettings{});
return { file_segment }; return { file_segment };
} }

View File

@ -325,7 +325,7 @@ private:
FileSegments getImpl( FileSegments getImpl(
const Key & key, const Key & key,
const FileSegment::Range & range, const FileSegment::Range & range,
const KeyTransaction & key_transaction) const; const KeyTransaction & key_transaction);
FileSegments splitRangeIntoCells( FileSegments splitRangeIntoCells(
const Key & key, const Key & key,

View File

@ -508,7 +508,9 @@ TEST_F(FileCacheTest, get)
auto settings2 = settings; auto settings2 = settings;
settings2.max_file_segment_size = 10; settings2.max_file_segment_size = 10;
auto cache2 = DB::FileCache(caches_dir / "cache2", settings2); std::string cache_path = caches_dir / "cache2";
fs::create_directories(cache_path);
auto cache2 = DB::FileCache(cache_path, settings2);
cache2.initialize(); cache2.initialize();
auto key = cache2.createKeyForPath("key1"); auto key = cache2.createKeyForPath("key1");