From d263d0887f93257c14e81747bbae5cbcd05012b4 Mon Sep 17 00:00:00 2001 From: Matej Ferencevic Date: Mon, 19 Aug 2019 12:44:07 +0200 Subject: [PATCH] Fix bug in storage v2 GC Reviewers: mtomic, teon.banek Reviewed By: mtomic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2304 --- src/storage/v2/storage.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/storage/v2/storage.cpp b/src/storage/v2/storage.cpp index a402f5ad9..a87c79bc7 100644 --- a/src/storage/v2/storage.cpp +++ b/src/storage/v2/storage.cpp @@ -957,7 +957,7 @@ void Storage::CollectGarbage() { switch (prev.type) { case PreviousPtr::Type::VERTEX: { Vertex *vertex = prev.vertex; - std::unique_lock vertex_guard(vertex->lock); + std::lock_guard vertex_guard(vertex->lock); if (vertex->delta != &delta) { // Something changed, we're not the first delta in the chain // anymore. @@ -971,12 +971,13 @@ void Storage::CollectGarbage() { } case PreviousPtr::Type::EDGE: { Edge *edge = prev.edge; - std::unique_lock edge_guard(edge->lock); + std::lock_guard edge_guard(edge->lock); if (edge->delta != &delta) { // Something changed, we're not the first delta in the chain // anymore. continue; } + edge->delta = nullptr; if (edge->deleted) { current_deleted_edges.push_back(edge->gid); }