From 34f80722c20a97e1c197616b488e46bc9c80353d Mon Sep 17 00:00:00 2001 From: Teon Banek Date: Fri, 9 Aug 2019 10:08:01 +0200 Subject: [PATCH] Return Error::DELETED_OBJECT from CreateEdge instead of aborting Reviewers: mtomic, mferencevic Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2295 --- src/storage/v2/storage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storage/v2/storage.cpp b/src/storage/v2/storage.cpp index 435a9af6e..a402f5ad9 100644 --- a/src/storage/v2/storage.cpp +++ b/src/storage/v2/storage.cpp @@ -454,12 +454,12 @@ Result Storage::Accessor::CreateEdge(VertexAccessor *from, if (!PrepareForWrite(&transaction_, from_vertex)) return Error::SERIALIZATION_ERROR; - CHECK(!from_vertex->deleted) << "Invalid database state!"; + if (from_vertex->deleted) return Error::DELETED_OBJECT; if (to_vertex != from_vertex) { if (!PrepareForWrite(&transaction_, to_vertex)) return Error::SERIALIZATION_ERROR; - CHECK(!to_vertex->deleted) << "Invalid database state!"; + if (to_vertex->deleted) return Error::DELETED_OBJECT; } auto gid = storage_->edge_id_.fetch_add(1, std::memory_order_acq_rel);