From a71447e6a020fef01ee023042547f3bcacfdb6e4 Mon Sep 17 00:00:00 2001 From: Jure Bajic Date: Tue, 7 Feb 2023 14:12:21 +0100 Subject: [PATCH] Update src/storage/v3/shard.cpp Co-authored-by: Tyler Neely --- src/storage/v3/shard.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/storage/v3/shard.cpp b/src/storage/v3/shard.cpp index f8a7e3862..da3f5b4ec 100644 --- a/src/storage/v3/shard.cpp +++ b/src/storage/v3/shard.cpp @@ -1105,6 +1105,8 @@ void Shard::StoreMapping(std::unordered_map id_to_name) { std::optional Shard::ShouldSplit() const noexcept { if (vertices_.size() > config_.split.max_shard_vertex_size) { auto mid_elem = vertices_.begin(); + // TODO(tyler) the first time we calculate the split point, we should store it so that we don't have to + // iterate over half of the entire index each time Cron is run until the split succeeds. std::ranges::advance(mid_elem, static_cast(vertices_.size() / 2)); return SplitInfo{mid_elem->first, shard_version_}; }