From 185b87ec85b5a8aaeb6f66d9ae696c9708d01bf6 Mon Sep 17 00:00:00 2001 From: jbajic Date: Wed, 25 Jan 2023 13:33:58 +0100 Subject: [PATCH] Add final comments --- src/storage/v3/shard.cpp | 3 +-- src/storage/v3/splitter.cpp | 6 +++--- src/storage/v3/splitter.hpp | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/storage/v3/shard.cpp b/src/storage/v3/shard.cpp index d2ede3603..cb46efc34 100644 --- a/src/storage/v3/shard.cpp +++ b/src/storage/v3/shard.cpp @@ -1101,9 +1101,7 @@ void Shard::StoreMapping(std::unordered_map id_to_name) { std::optional Shard::ShouldSplit() const noexcept { if (vertices_.size() > config_.split.max_shard_vertex_size) { - // Why should we care if the selected vertex is deleted auto mid_elem = vertices_.begin(); - // mid_elem->first std::ranges::advance(mid_elem, static_cast(vertices_.size() / 2)); return SplitInfo{shard_version_, mid_elem->first}; } @@ -1111,6 +1109,7 @@ std::optional Shard::ShouldSplit() const noexcept { } SplitData Shard::PerformSplit(const PrimaryKey &split_key) { + ++shard_version_; return shard_splitter_.SplitShard(split_key, max_primary_key_); } diff --git a/src/storage/v3/splitter.cpp b/src/storage/v3/splitter.cpp index eb5a29d34..d89392e13 100644 --- a/src/storage/v3/splitter.cpp +++ b/src/storage/v3/splitter.cpp @@ -206,14 +206,14 @@ void Splitter::AdjustClonedTransaction(Transaction &cloned_transaction, const Tr } case PreviousPtr::Type::VERTEX: { // What if the vertex is already moved to garbage collection... - // TODO(jbajic) Maybe revisit when we apply Garbage collection with new - // transaction management system + // TODO(jbajic) Maybe revisit when we apply Garbage collection with + // new transaction management system auto *cloned_vertex = &*cloned_vertices.find(ptr.vertex->first); cloned_delta->prev.Set(cloned_vertex); break; } case PreviousPtr::Type::EDGE: { - // TODO(jbajic) Case when there are no properties on edge is not handled + // We can never be here if we have properties on edge disabled auto *cloned_edge = &*cloned_edges.find(ptr.edge->gid); cloned_delta->prev.Set(&cloned_edge->second); break; diff --git a/src/storage/v3/splitter.hpp b/src/storage/v3/splitter.hpp index 2549a280c..d584ab6d0 100644 --- a/src/storage/v3/splitter.hpp +++ b/src/storage/v3/splitter.hpp @@ -106,9 +106,9 @@ class Splitter final { static void ScanDeltas(std::set &collected_transactions_start_id, Delta *delta); - static void AdjustClonedTransaction(Transaction &cloned_transaction, const Transaction &transaction, - std::map> &cloned_transactions, - VertexContainer &cloned_vertices, EdgeContainer &cloned_edges); + void AdjustClonedTransaction(Transaction &cloned_transaction, const Transaction &transaction, + std::map> &cloned_transactions, + VertexContainer &cloned_vertices, EdgeContainer &cloned_edges); void AdjustClonedTransactions(std::map> &cloned_transactions, VertexContainer &cloned_vertices, EdgeContainer &cloned_edges);