Protect delta id
This commit is contained in:
parent
be9600835f
commit
78b5731a0e
@ -20,6 +20,7 @@
|
|||||||
#include "storage/v3/vertex.hpp"
|
#include "storage/v3/vertex.hpp"
|
||||||
#include "storage/v3/vertex_id.hpp"
|
#include "storage/v3/vertex_id.hpp"
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
|
#include "utils/synchronized.hpp"
|
||||||
|
|
||||||
namespace memgraph::storage::v3 {
|
namespace memgraph::storage::v3 {
|
||||||
|
|
||||||
@ -29,8 +30,8 @@ struct Delta;
|
|||||||
struct CommitInfo;
|
struct CommitInfo;
|
||||||
|
|
||||||
inline uint64_t GetNextDeltaUUID() noexcept {
|
inline uint64_t GetNextDeltaUUID() noexcept {
|
||||||
static uint64_t uuid{0};
|
static utils::Synchronized<uint64_t, utils::SpinLock> delta_id{0};
|
||||||
return ++uuid;
|
return delta_id.WithLock([](auto id) { return id++; });
|
||||||
}
|
}
|
||||||
|
|
||||||
// This class stores one of three pointers (`Delta`, `Vertex` and `Edge`)
|
// This class stores one of three pointers (`Delta`, `Vertex` and `Edge`)
|
||||||
|
Loading…
Reference in New Issue
Block a user