fix mg_assert failing

This commit is contained in:
DavIvek 2024-03-08 22:55:45 +01:00
parent 077f9e6e99
commit 80e1e2d9ca
2 changed files with 7 additions and 2 deletions

View File

@ -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<storage::VertexAccessor> DiskStorage::LoadVertexToMainMemoryCache(
VertexAccessor DiskStorage::CreateVertexFromDisk(Transaction *transaction, utils::SkipList<Vertex>::Accessor &accessor,
storage::Gid gid, std::vector<LabelId> 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);

View File

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