Added edge type indices to be cleaned up inside drop graph

This commit is contained in:
Josip Mrden 2024-03-22 13:47:27 +01:00
parent 84df6dcd02
commit e99c7dd45b
9 changed files with 13 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -45,6 +45,7 @@ void Indices::RemoveObsoleteEntries(uint64_t oldest_active_start_timestamp, std:
void Indices::DropGraphClearIndices() const {
static_cast<InMemoryLabelIndex *>(label_index_.get())->DropGraphClearIndices();
static_cast<InMemoryLabelPropertyIndex *>(label_property_index_.get())->DropGraphClearIndices();
static_cast<InMemoryEdgeTypeIndex *>(edge_type_index_.get())->DropGraphClearIndices();
}
void Indices::UpdateOnAddLabel(LabelId label, Vertex *vertex, const Transaction &tx) const {

View File

@ -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<Entry>::Accessor index_accessor, EdgeTypeId edge_type,
View view, Storage *storage, Transaction *transaction)
: index_accessor_(std::move(index_accessor)),

View File

@ -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;

View File

@ -237,9 +237,6 @@ std::vector<LabelId> InMemoryLabelIndex::Analysis() const {
}
void InMemoryLabelIndex::DropGraphClearIndices() {
for (auto &[label, storage] : index_) {
storage.clear();
}
index_.clear();
stats_->clear();
}

View File

@ -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();

View File

@ -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();
}