From c26144968ad6202d6003e859bda32ed143dbeac9 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Mon, 11 May 2020 17:44:46 +0300 Subject: [PATCH] fix --- src/Dictionaries/BucketCache.h | 2 +- src/Dictionaries/SSDCacheDictionary.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Dictionaries/BucketCache.h b/src/Dictionaries/BucketCache.h index 9a231c7a1b5..262aef21019 100644 --- a/src/Dictionaries/BucketCache.h +++ b/src/Dictionaries/BucketCache.h @@ -162,7 +162,7 @@ private: size_t getCellIndex(const K key, const size_t bucket) const { const size_t pos = getPosition(bucket); - for (size_t idx = 0; idx < bucket_size; ++idx) + for (int idx = 7; idx >= 0; --idx) { const size_t cur = ((pos + 1 + idx) & pos_mask); if (cells[bucket * bucket_size + cur].index.exists() && diff --git a/src/Dictionaries/SSDCacheDictionary.cpp b/src/Dictionaries/SSDCacheDictionary.cpp index e3053e18e8e..a065b367101 100644 --- a/src/Dictionaries/SSDCacheDictionary.cpp +++ b/src/Dictionaries/SSDCacheDictionary.cpp @@ -418,10 +418,10 @@ void SSDCachePartition::flush() throwFromErrnoWithPath("Cannot fsync " + path + BIN_FILE_EXT, path + BIN_FILE_EXT, ErrorCodes::CANNOT_FSYNC); /// commit changes in index - for (size_t row = 0; row < ids.size(); ++row) + for (const auto & id : ids) { Index index; - if (key_to_index.get(ids[row], index)) + if (key_to_index.get(id, index)) { if (index.inMemory()) // Row can be inserted in the buffer twice, so we need to move to ssd only the last index. { @@ -429,7 +429,7 @@ void SSDCachePartition::flush() // Poco::Logger::get("pt").information("block: " + std::to_string(index.getBlockId()) + " " + std::to_string(current_file_block_id) + " "); index.setBlockId((current_file_block_id % max_size) + index.getBlockId()); } - key_to_index.set(ids[row], index); + key_to_index.set(id, index); } } @@ -1307,10 +1307,10 @@ SSDCacheDictionary::SSDCacheDictionary( checkAttributeType(name, attribute_name, dict_struct.attributes[index].underlying_type, AttributeUnderlyingType::ut##TYPE); \ const auto null_value = std::get(null_values[index]); /* NOLINT */ \ getItemsNumberImpl( /* NOLINT */ \ - index, \ - ids, \ - out, \ - [&](const size_t) { return null_value; }); \ + index, /* NOLINT */ \ + ids, /* NOLINT */ \ + out, /* NOLINT */ \ + [&](const size_t) { return null_value; }); /* NOLINT */ \ } DECLARE(UInt8)