diff --git a/src/storage/v2/disk/edge_type_index.cpp b/src/storage/v2/disk/edge_type_index.cpp index d11eb6caf..e48a1e760 100644 --- a/src/storage/v2/disk/edge_type_index.cpp +++ b/src/storage/v2/disk/edge_type_index.cpp @@ -46,4 +46,8 @@ void DiskEdgeTypeIndex::UpdateOnEdgeModification(Vertex * /*old_from*/, Vertex * spdlog::warn("Edge-type index related operations are not yet supported using on-disk storage mode."); } +void DiskEdgeTypeIndex::DropGraphClearIndices() { + spdlog::warn("Edge-type index related operations are not yet supported using on-disk storage mode."); +} + } // namespace memgraph::storage diff --git a/src/storage/v2/disk/edge_type_index.hpp b/src/storage/v2/disk/edge_type_index.hpp index fe79b2690..ccaf0fae9 100644 --- a/src/storage/v2/disk/edge_type_index.hpp +++ b/src/storage/v2/disk/edge_type_index.hpp @@ -30,6 +30,8 @@ class DiskEdgeTypeIndex : public storage::EdgeTypeIndex { void UpdateOnEdgeModification(Vertex *old_from, Vertex *old_to, Vertex *new_from, Vertex *new_to, EdgeRef edge_ref, EdgeTypeId edge_type, const Transaction &tx) override; + + void DropGraphClearIndices() override; }; } // namespace memgraph::storage diff --git a/src/storage/v2/indices/edge_type_index.hpp b/src/storage/v2/indices/edge_type_index.hpp index 788ccb225..94c4bf2d2 100644 --- a/src/storage/v2/indices/edge_type_index.hpp +++ b/src/storage/v2/indices/edge_type_index.hpp @@ -41,6 +41,8 @@ class EdgeTypeIndex { virtual void UpdateOnEdgeModification(Vertex *old_from, Vertex *old_to, Vertex *new_from, Vertex *new_to, EdgeRef edge_ref, EdgeTypeId edge_type, const Transaction &tx) = 0; + + virtual void DropGraphClearIndices() = 0; }; } // namespace memgraph::storage diff --git a/src/storage/v2/indices/indices.cpp b/src/storage/v2/indices/indices.cpp index 50bd97199..665e51151 100644 --- a/src/storage/v2/indices/indices.cpp +++ b/src/storage/v2/indices/indices.cpp @@ -45,6 +45,7 @@ void Indices::RemoveObsoleteEntries(uint64_t oldest_active_start_timestamp, std: void Indices::DropGraphClearIndices() const { static_cast(label_index_.get())->DropGraphClearIndices(); static_cast(label_property_index_.get())->DropGraphClearIndices(); + static_cast(edge_type_index_.get())->DropGraphClearIndices(); } void Indices::UpdateOnAddLabel(LabelId label, Vertex *vertex, const Transaction &tx) const { diff --git a/src/storage/v2/inmemory/edge_type_index.cpp b/src/storage/v2/inmemory/edge_type_index.cpp index e439628b4..288d6e9f5 100644 --- a/src/storage/v2/inmemory/edge_type_index.cpp +++ b/src/storage/v2/inmemory/edge_type_index.cpp @@ -215,6 +215,8 @@ void InMemoryEdgeTypeIndex::UpdateOnEdgeModification(Vertex *old_from, Vertex *o acc.insert(Entry{new_from, new_to, edge_ref.ptr, tx.start_timestamp}); } +void InMemoryEdgeTypeIndex::DropGraphClearIndices() { index_.clear(); } + InMemoryEdgeTypeIndex::Iterable::Iterable(utils::SkipList::Accessor index_accessor, EdgeTypeId edge_type, View view, Storage *storage, Transaction *transaction) : index_accessor_(std::move(index_accessor)), diff --git a/src/storage/v2/inmemory/edge_type_index.hpp b/src/storage/v2/inmemory/edge_type_index.hpp index db8f7843f..e083c7b38 100644 --- a/src/storage/v2/inmemory/edge_type_index.hpp +++ b/src/storage/v2/inmemory/edge_type_index.hpp @@ -61,6 +61,8 @@ class InMemoryEdgeTypeIndex : public storage::EdgeTypeIndex { void UpdateOnEdgeModification(Vertex *old_from, Vertex *old_to, Vertex *new_from, Vertex *new_to, EdgeRef edge_ref, EdgeTypeId edge_type, const Transaction &tx) override; + void DropGraphClearIndices() override; + static constexpr std::size_t kEdgeTypeIdPos = 0U; static constexpr std::size_t kVertexPos = 1U; static constexpr std::size_t kEdgeRefPos = 2U; diff --git a/src/storage/v2/inmemory/label_index.cpp b/src/storage/v2/inmemory/label_index.cpp index d1d4f5881..d504af528 100644 --- a/src/storage/v2/inmemory/label_index.cpp +++ b/src/storage/v2/inmemory/label_index.cpp @@ -237,9 +237,6 @@ std::vector InMemoryLabelIndex::Analysis() const { } void InMemoryLabelIndex::DropGraphClearIndices() { - for (auto &[label, storage] : index_) { - storage.clear(); - } index_.clear(); stats_->clear(); } diff --git a/src/storage/v2/inmemory/label_property_index.cpp b/src/storage/v2/inmemory/label_property_index.cpp index 21ccb736b..2a4bd5b73 100644 --- a/src/storage/v2/inmemory/label_property_index.cpp +++ b/src/storage/v2/inmemory/label_property_index.cpp @@ -500,9 +500,6 @@ void InMemoryLabelPropertyIndex::AbortEntries(LabelId label, } void InMemoryLabelPropertyIndex::DropGraphClearIndices() { - for (auto &[label_prop, storage] : index_) { - storage.clear(); - } index_.clear(); indices_by_property_.clear(); stats_->clear(); diff --git a/src/storage/v2/inmemory/unique_constraints.cpp b/src/storage/v2/inmemory/unique_constraints.cpp index a1b86bc17..fdb3983c3 100644 --- a/src/storage/v2/inmemory/unique_constraints.cpp +++ b/src/storage/v2/inmemory/unique_constraints.cpp @@ -525,9 +525,6 @@ void InMemoryUniqueConstraints::Clear() { bool InMemoryUniqueConstraints::empty() const { return constraints_.empty() && constraints_by_label_.empty(); } void InMemoryUniqueConstraints::DropGraphClearConstraints() { - for (auto &[label_props, storage] : constraints_) { - storage.clear(); - }; constraints_.clear(); constraints_by_label_.clear(); }