From 91fd608a7f6da19f4421974c994ad386db036fdd Mon Sep 17 00:00:00 2001
From: niko4299 <niko.krvavica@gmail.com>
Date: Mon, 31 Oct 2022 16:23:20 +0100
Subject: [PATCH] Removed extra fixes

---
 src/storage/v2/durability/snapshot.cpp | 13 +++----------
 src/storage/v2/durability/wal.cpp      |  3 +--
 src/storage/v2/edge.hpp                | 13 +------------
 src/storage/v2/storage.cpp             |  4 ++--
 4 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/src/storage/v2/durability/snapshot.cpp b/src/storage/v2/durability/snapshot.cpp
index 1c612a99d..16c7d017c 100644
--- a/src/storage/v2/durability/snapshot.cpp
+++ b/src/storage/v2/durability/snapshot.cpp
@@ -245,13 +245,8 @@ RecoveredSnapshot LoadSnapshot(const std::filesystem::path &path, utils::SkipLis
           if (!gid) throw RecoveryFailure("Invalid snapshot data!");
           if (i > 0 && *gid <= last_edge_gid) throw RecoveryFailure("Invalid snapshot data!");
           last_edge_gid = *gid;
-          auto vertex_from_gid = snapshot.ReadUint();
-          auto vertex_to_gid = snapshot.ReadUint();
-          auto edge_type_id = snapshot.ReadUint();
           spdlog::debug("Recovering edge {} with properties.", *gid);
-          auto [it, inserted] =
-              edge_acc.insert(Edge{Gid::FromUint(*gid), Gid::FromUint(*vertex_from_gid), Gid::FromUint(*vertex_to_gid),
-                                   get_edge_type_from_id(*edge_type_id), nullptr});
+          auto [it, inserted] = edge_acc.insert(Edge{Gid::FromUint(*gid), nullptr});
           if (!inserted) throw RecoveryFailure("The edge must be inserted here!");
 
           // Recover properties.
@@ -437,8 +432,7 @@ RecoveredSnapshot LoadSnapshot(const std::filesystem::path &path, utils::SkipLis
               if (edge == edge_acc.end()) throw RecoveryFailure("Invalid edge!");
               edge_ref = EdgeRef(&*edge);
             } else {
-              auto [edge, inserted] = edge_acc.insert(Edge{Gid::FromUint(*edge_gid), from_vertex->gid, vertex.gid,
-                                                           get_edge_type_from_id(*edge_type), nullptr});
+              auto [edge, inserted] = edge_acc.insert(Edge{Gid::FromUint(*edge_gid), nullptr});
               edge_ref = EdgeRef(&*edge);
             }
           }
@@ -474,8 +468,7 @@ RecoveredSnapshot LoadSnapshot(const std::filesystem::path &path, utils::SkipLis
               if (edge == edge_acc.end()) throw RecoveryFailure("Invalid edge!");
               edge_ref = EdgeRef(&*edge);
             } else {
-              auto [edge, inserted] = edge_acc.insert(Edge{Gid::FromUint(*edge_gid), vertex.gid, to_vertex->gid,
-                                                           get_edge_type_from_id(*edge_type), nullptr});
+              auto [edge, inserted] = edge_acc.insert(Edge{Gid::FromUint(*edge_gid), nullptr});
               edge_ref = EdgeRef(&*edge);
             }
           }
diff --git a/src/storage/v2/durability/wal.cpp b/src/storage/v2/durability/wal.cpp
index fdda18231..a8faf064a 100644
--- a/src/storage/v2/durability/wal.cpp
+++ b/src/storage/v2/durability/wal.cpp
@@ -713,8 +713,7 @@ RecoveryInfo LoadWal(const std::filesystem::path &path, RecoveredIndicesAndConst
           auto edge_type_id = EdgeTypeId::FromUint(name_id_mapper->NameToId(delta.edge_create_delete.edge_type));
           EdgeRef edge_ref(edge_gid);
           if (items.properties_on_edges) {
-            auto [edge, inserted] =
-                edge_acc.insert(Edge{edge_gid, from_vertex->gid, to_vertex->gid, edge_type_id, nullptr});
+            auto [edge, inserted] = edge_acc.insert(Edge{edge_gid, nullptr});
             if (!inserted) throw RecoveryFailure("The edge must be inserted here!");
             edge_ref = EdgeRef(&*edge);
           }
diff --git a/src/storage/v2/edge.hpp b/src/storage/v2/edge.hpp
index a4ea7cc70..fcf8ff8e7 100644
--- a/src/storage/v2/edge.hpp
+++ b/src/storage/v2/edge.hpp
@@ -24,28 +24,17 @@ namespace memgraph::storage {
 struct Vertex;
 
 struct Edge {
-  Edge(Gid gid, Gid vertex_gid_from, Gid vertex_gid_to, EdgeTypeId edge_type_id, Delta *delta)
-      : gid(gid),
-        vertex_gid_to(vertex_gid_to),
-        vertex_gid_from(vertex_gid_from),
-        edge_type_id(edge_type_id),
-        deleted(false),
-        delta(delta) {
+  Edge(Gid gid, Delta *delta) : gid(gid), deleted(false), delta(delta) {
     MG_ASSERT(delta == nullptr || delta->action == Delta::Action::DELETE_OBJECT,
               "Edge must be created with an initial DELETE_OBJECT delta!");
   }
 
   Gid gid;
 
-  Gid vertex_gid_to;
-  Gid vertex_gid_from;
-  EdgeTypeId edge_type_id;
-
   PropertyStore properties;
 
   mutable utils::SpinLock lock;
   bool deleted;
-
   // uint8_t PAD;
   // uint16_t PAD;
 
diff --git a/src/storage/v2/storage.cpp b/src/storage/v2/storage.cpp
index 9535cfa2c..dc31408ef 100644
--- a/src/storage/v2/storage.cpp
+++ b/src/storage/v2/storage.cpp
@@ -684,7 +684,7 @@ Result<EdgeAccessor> Storage::Accessor::CreateEdge(VertexAccessor *from, VertexA
   if (config_.properties_on_edges) {
     auto acc = storage_->edges_.access();
     auto delta = CreateDeleteObjectDelta(&transaction_);
-    auto [it, inserted] = acc.insert(Edge(gid, from_vertex->gid, to_vertex->gid, edge_type, delta));
+    auto [it, inserted] = acc.insert(Edge(gid, delta));
     MG_ASSERT(inserted, "The edge must be inserted here!");
     MG_ASSERT(it != acc.end(), "Invalid Edge accessor!");
     edge = EdgeRef(&*it);
@@ -752,7 +752,7 @@ Result<EdgeAccessor> Storage::Accessor::CreateEdge(VertexAccessor *from, VertexA
   if (config_.properties_on_edges) {
     auto acc = storage_->edges_.access();
     auto delta = CreateDeleteObjectDelta(&transaction_);
-    auto [it, inserted] = acc.insert(Edge(gid, from_vertex->gid, to_vertex->gid, edge_type, delta));
+    auto [it, inserted] = acc.insert(Edge(gid, delta));
     MG_ASSERT(inserted, "The edge must be inserted here!");
     MG_ASSERT(it != acc.end(), "Invalid Edge accessor!");
     edge = EdgeRef(&*it);