From 80e1e2d9ca27d7e6d0855c3d50841758190ea647 Mon Sep 17 00:00:00 2001 From: DavIvek Date: Fri, 8 Mar 2024 22:55:45 +0100 Subject: [PATCH] fix mg_assert failing --- src/storage/v2/disk/storage.cpp | 3 ++- src/storage/v2/vertex.hpp | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/storage/v2/disk/storage.cpp b/src/storage/v2/disk/storage.cpp index b0511dc9f..7b47768a9 100644 --- a/src/storage/v2/disk/storage.cpp +++ b/src/storage/v2/disk/storage.cpp @@ -50,6 +50,7 @@ #include "storage/v2/storage.hpp" #include "storage/v2/storage_error.hpp" #include "storage/v2/transaction.hpp" +#include "storage/v2/vertex.hpp" #include "storage/v2/vertex_accessor.hpp" #include "storage/v2/vertices_iterable.hpp" #include "storage/v2/view.hpp" @@ -1342,7 +1343,7 @@ std::optional DiskStorage::LoadVertexToMainMemoryCache( VertexAccessor DiskStorage::CreateVertexFromDisk(Transaction *transaction, utils::SkipList::Accessor &accessor, storage::Gid gid, std::vector label_ids, PropertyStore properties, Delta *delta) { - auto [it, inserted] = accessor.insert(Vertex{gid, delta}); + auto [it, inserted] = accessor.insert(Vertex{gid, delta, MergeVerticesTag{}}); MG_ASSERT(inserted, "The vertex must be inserted here!"); MG_ASSERT(it != accessor.end(), "Invalid Vertex accessor!"); it->labels = std::move(label_ids); diff --git a/src/storage/v2/vertex.hpp b/src/storage/v2/vertex.hpp index 41021b436..23a473655 100644 --- a/src/storage/v2/vertex.hpp +++ b/src/storage/v2/vertex.hpp @@ -1,4 +1,4 @@ -// Copyright 2023 Memgraph Ltd. +// Copyright 2024 Memgraph Ltd. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source @@ -23,7 +23,11 @@ namespace memgraph::storage { +struct MergeVerticesTag {}; + struct Vertex { + Vertex(Gid gid, Delta *delta, MergeVerticesTag) : gid(gid), deleted(false), delta(delta) {} + Vertex(Gid gid, Delta *delta) : gid(gid), deleted(false), delta(delta) { MG_ASSERT(delta == nullptr || delta->action == Delta::Action::DELETE_OBJECT || delta->action == Delta::Action::DELETE_DESERIALIZED_OBJECT,