From 96dcfae63ea559ed2251c1591ed67c3040304146 Mon Sep 17 00:00:00 2001 From: gvolfing Date: Thu, 5 Oct 2023 12:47:28 +0200 Subject: [PATCH] Remove unnecessary metadata placeholder --- src/storage/v2/disk/storage.cpp | 20 ++++++++++---------- src/storage/v2/disk/storage.hpp | 21 ++++++++------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/storage/v2/disk/storage.cpp b/src/storage/v2/disk/storage.cpp index b2cb0e6b8..fed6ef282 100644 --- a/src/storage/v2/disk/storage.cpp +++ b/src/storage/v2/disk/storage.cpp @@ -587,8 +587,8 @@ VerticesIterable DiskStorage::DiskAccessor::Vertices(LabelId label, View view) { std::list *index_deltas{nullptr}; auto merge_with_main_cache = [&](auto &index) -> std::unordered_set { - index[cache_key] = VerticesWithFlag(); - indexed_vertices = &index[cache_key].vertices; + index[cache_key] = utils::SkipList(); + indexed_vertices = &index[cache_key]; index_deltas_storage_.emplace_back(); index_deltas = &index_deltas_storage_.back(); @@ -640,8 +640,8 @@ VerticesIterable DiskStorage::DiskAccessor::Vertices(LabelId label, PropertyId p std::list *index_deltas{nullptr}; auto merge_with_main_cache = [&](auto &index) -> std::unordered_set { - index[cache_key] = VerticesWithFlag(); - indexed_vertices = &index[cache_key].vertices; + index[cache_key] = utils::SkipList(); + indexed_vertices = &index[cache_key]; index_deltas_storage_.emplace_back(); index_deltas = &index_deltas_storage_.back(); @@ -743,8 +743,8 @@ VerticesIterable DiskStorage::DiskAccessor::Vertices(LabelId label, PropertyId p std::list *index_deltas{nullptr}; auto merge_with_main_cache = [&](auto &index) -> std::unordered_set { - index[cache_key] = VerticesWithFlag(); - indexed_vertices = &index[cache_key].vertices; + index[cache_key] = utils::SkipList(); + indexed_vertices = &index[cache_key]; index_deltas_storage_.emplace_back(); index_deltas = &index_deltas_storage_.back(); @@ -830,8 +830,8 @@ VerticesIterable DiskStorage::DiskAccessor::Vertices(LabelId label, PropertyId p std::list *index_deltas{nullptr}; auto merge_with_main_cache = [&](auto &index) -> std::unordered_set { - index[cache_key] = VerticesWithFlag(); - indexed_vertices = &index[cache_key].vertices; + index[cache_key] = utils::SkipList(); + indexed_vertices = &index[cache_key]; index_deltas_storage_.emplace_back(); index_deltas = &index_deltas_storage_.back(); @@ -1246,7 +1246,7 @@ std::optional DiskStorage::DiskAccessor::FindVertex(storage::Gid auto find_in_indices = [&](auto &index_storage) -> std::optional { for (auto &[k, v] : index_storage) { - acc = v.vertices.access(); + acc = v.access(); auto index_it = acc.find(gid); if (index_it != acc.end()) { return VertexAccessor::Create(&*index_it, &transaction_, &storage_->indices_, &storage_->constraints_, config_, @@ -1647,7 +1647,7 @@ DiskStorage::DiskAccessor::ClearDanglingVertices() { auto flush_index = [&](auto &index_storage) -> utils::BasicResult { for (const auto &[k, v] : index_storage) { - if (auto vertices_res = FlushVertices(v.vertices.access(), unique_storage); vertices_res.HasError()) { + if (auto vertices_res = FlushVertices(v.access(), unique_storage); vertices_res.HasError()) { return vertices_res.GetError(); } } diff --git a/src/storage/v2/disk/storage.hpp b/src/storage/v2/disk/storage.hpp index c9d9e6a77..25bbeb08b 100644 --- a/src/storage/v2/disk/storage.hpp +++ b/src/storage/v2/disk/storage.hpp @@ -267,11 +267,6 @@ class DiskStorage final : public Storage { /// Main storage utils::SkipList vertices_; - struct VerticesWithFlag { - utils::SkipList vertices; - bool already_in_memory{false}; - }; - using LabelIndex = LabelId; using LabelPropertyIndex = std::pair; using LabelPropertyValIndex = std::tuple; @@ -279,28 +274,28 @@ class DiskStorage final : public Storage { using LabelPropertyRangeIndex = std::tuple; // TODO rename these. - std::map label_index_old_; + std::map> label_index_old_; uint64_t label_index_old_ci_{transaction_.command_id}; - std::map label_index_new_; + std::map> label_index_new_; uint64_t label_index_new_ci_{transaction_.command_id}; - std::map label_property_index_old_; + std::map> label_property_index_old_; uint64_t label_property_index_old_ci_{transaction_.command_id}; - std::map label_property_index_new_; + std::map> label_property_index_new_; uint64_t label_property_index_new_ci_{transaction_.command_id}; - std::map label_property_val_index_old_; + std::map> label_property_val_index_old_; uint64_t label_property_val_index_old_ci_{transaction_.command_id}; - std::map label_property_val_index_new_; + std::map> label_property_val_index_new_; uint64_t label_property_val_index_new_ci_{transaction_.command_id}; - std::map label_property_range_index_old_; + std::map> label_property_range_index_old_; uint64_t label_property_range_index_old_ci_{transaction_.command_id}; - std::map label_property_range_index_new_; + std::map> label_property_range_index_new_; uint64_t label_property_range_index_new_ci_{transaction_.command_id}; /// We need them because query context for indexed reading is cleared after the query is done not after the