Return Error::DELETED_OBJECT from CreateEdge instead of aborting

Reviewers: mtomic, mferencevic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2295
This commit is contained in:
Teon Banek 2019-08-09 10:08:01 +02:00
parent e18cb7b4c7
commit 34f80722c2

View File

@ -454,12 +454,12 @@ Result<EdgeAccessor> 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);