Fix update position of duplicated keys in memory partition buffer

This commit is contained in:
Maksim Kita 2021-03-02 02:49:39 +03:00
parent 7602c6c6cb
commit a6534c3b42

View File

@ -1143,14 +1143,18 @@ private:
PaddedPODArray<KeyType> keys_to_update;
current_memory_buffer_partition.readKeys(keys_to_update);
absl::flat_hash_set<KeyType, DefaultHash<KeyType>> updated_keys;
for (auto key_to_update : keys_to_update)
{
auto * it = index.find(key_to_update);
/// If lru cache does not contain old keys
if (!it)
/// If lru cache does not contain old keys or there were duplicated keys in memory buffer partition
if (!it || updated_keys.contains(it->getKey()))
continue;
updated_keys.insert(key_to_update);
Cell & cell_to_update = it->getMapped();
cell_to_update.in_memory = false;