This commit is contained in:
Nikita Vasilev 2020-05-11 17:44:46 +03:00
parent 5e9cb4060f
commit c26144968a
2 changed files with 8 additions and 8 deletions

View File

@ -162,7 +162,7 @@ private:
size_t getCellIndex(const K key, const size_t bucket) const size_t getCellIndex(const K key, const size_t bucket) const
{ {
const size_t pos = getPosition(bucket); 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); const size_t cur = ((pos + 1 + idx) & pos_mask);
if (cells[bucket * bucket_size + cur].index.exists() && if (cells[bucket * bucket_size + cur].index.exists() &&

View File

@ -418,10 +418,10 @@ void SSDCachePartition::flush()
throwFromErrnoWithPath("Cannot fsync " + path + BIN_FILE_EXT, path + BIN_FILE_EXT, ErrorCodes::CANNOT_FSYNC); throwFromErrnoWithPath("Cannot fsync " + path + BIN_FILE_EXT, path + BIN_FILE_EXT, ErrorCodes::CANNOT_FSYNC);
/// commit changes in index /// commit changes in index
for (size_t row = 0; row < ids.size(); ++row) for (const auto & id : ids)
{ {
Index index; 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. 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) + " "); // 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()); 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); \ checkAttributeType(name, attribute_name, dict_struct.attributes[index].underlying_type, AttributeUnderlyingType::ut##TYPE); \
const auto null_value = std::get<TYPE>(null_values[index]); /* NOLINT */ \ const auto null_value = std::get<TYPE>(null_values[index]); /* NOLINT */ \
getItemsNumberImpl<TYPE, TYPE>( /* NOLINT */ \ getItemsNumberImpl<TYPE, TYPE>( /* NOLINT */ \
index, \ index, /* NOLINT */ \
ids, \ ids, /* NOLINT */ \
out, \ out, /* NOLINT */ \
[&](const size_t) { return null_value; }); \ [&](const size_t) { return null_value; }); /* NOLINT */ \
} }
DECLARE(UInt8) DECLARE(UInt8)