From 78b5731a0e5bd68d877d609852738dab84ea1027 Mon Sep 17 00:00:00 2001 From: jbajic Date: Mon, 30 Jan 2023 10:54:44 +0100 Subject: [PATCH] Protect delta id --- src/storage/v3/delta.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/storage/v3/delta.hpp b/src/storage/v3/delta.hpp index c4ffc33e1..95bd5d18a 100644 --- a/src/storage/v3/delta.hpp +++ b/src/storage/v3/delta.hpp @@ -20,6 +20,7 @@ #include "storage/v3/vertex.hpp" #include "storage/v3/vertex_id.hpp" #include "utils/logging.hpp" +#include "utils/synchronized.hpp" namespace memgraph::storage::v3 { @@ -29,8 +30,8 @@ struct Delta; struct CommitInfo; inline uint64_t GetNextDeltaUUID() noexcept { - static uint64_t uuid{0}; - return ++uuid; + static utils::Synchronized delta_id{0}; + return delta_id.WithLock([](auto id) { return id++; }); } // This class stores one of three pointers (`Delta`, `Vertex` and `Edge`)