From 6834ce01fee25ce38673b0a74976ff4c958564d0 Mon Sep 17 00:00:00 2001
From: jbajic <jure.bajic@memgraph.com>
Date: Mon, 31 Oct 2022 16:26:56 +0100
Subject: [PATCH] Fix edge id allocator

---
 src/query/v2/context.hpp       | 2 +-
 src/query/v2/interpreter.cpp   | 2 +-
 src/query/v2/plan/operator.cpp | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/query/v2/context.hpp b/src/query/v2/context.hpp
index 24b472438..338546f4d 100644
--- a/src/query/v2/context.hpp
+++ b/src/query/v2/context.hpp
@@ -98,7 +98,7 @@ struct ExecutionContext {
   ExecutionStats execution_stats;
   utils::AsyncTimer timer;
   msgs::ShardRequestManagerInterface *shard_request_manager{nullptr};
-  IdAllocator edge_ids_alloc;
+  IdAllocator *edge_ids_alloc;
 };
 
 static_assert(std::is_move_assignable_v<ExecutionContext>, "ExecutionContext must be move assignable!");
diff --git a/src/query/v2/interpreter.cpp b/src/query/v2/interpreter.cpp
index a1637b4c3..93ef20764 100644
--- a/src/query/v2/interpreter.cpp
+++ b/src/query/v2/interpreter.cpp
@@ -697,7 +697,7 @@ PullPlan::PullPlan(const std::shared_ptr<CachedPlan> plan, const Parameters &par
   ctx_.is_shutting_down = &interpreter_context->is_shutting_down;
   ctx_.is_profile_query = is_profile_query;
   ctx_.shard_request_manager = shard_request_manager;
-  ctx_.edge_ids_alloc = interpreter_context->edge_ids_alloc;
+  ctx_.edge_ids_alloc = &interpreter_context->edge_ids_alloc;
 }
 
 std::optional<plan::ProfilingStatsWithTotalTime> PullPlan::Pull(AnyStream *stream, std::optional<int> n,
diff --git a/src/query/v2/plan/operator.cpp b/src/query/v2/plan/operator.cpp
index 0832c60cf..1a83be36f 100644
--- a/src/query/v2/plan/operator.cpp
+++ b/src/query/v2/plan/operator.cpp
@@ -2402,7 +2402,7 @@ class DistributedCreateExpandCursor : public Cursor {
   std::vector<msgs::NewExpand> ExpandCreationInfoToRequest(ExecutionContext &context, Frame &frame) const {
     std::vector<msgs::NewExpand> edge_requests;
     for (const auto &edge_info : std::vector{self_.edge_info_}) {
-      msgs::NewExpand request{.id = {context.edge_ids_alloc.AllocateId()}};
+      msgs::NewExpand request{.id = {context.edge_ids_alloc->AllocateId()}};
       ExpressionEvaluator evaluator(&frame, context.symbol_table, context.evaluation_context, nullptr,
                                     storage::v3::View::NEW);
       request.type = {edge_info.edge_type};