Add final comments

This commit is contained in:
jbajic 2023-01-25 13:33:58 +01:00
parent 412b8c862f
commit 185b87ec85
3 changed files with 7 additions and 8 deletions

View File

@ -1101,9 +1101,7 @@ void Shard::StoreMapping(std::unordered_map<uint64_t, std::string> id_to_name) {
std::optional<SplitInfo> 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<VertexContainer::difference_type>(vertices_.size() / 2));
return SplitInfo{shard_version_, mid_elem->first};
}
@ -1111,6 +1109,7 @@ std::optional<SplitInfo> Shard::ShouldSplit() const noexcept {
}
SplitData Shard::PerformSplit(const PrimaryKey &split_key) {
++shard_version_;
return shard_splitter_.SplitShard(split_key, max_primary_key_);
}

View File

@ -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;

View File

@ -106,9 +106,9 @@ class Splitter final {
static void ScanDeltas(std::set<uint64_t> &collected_transactions_start_id, Delta *delta);
static void AdjustClonedTransaction(Transaction &cloned_transaction, const Transaction &transaction,
std::map<uint64_t, std::unique_ptr<Transaction>> &cloned_transactions,
VertexContainer &cloned_vertices, EdgeContainer &cloned_edges);
void AdjustClonedTransaction(Transaction &cloned_transaction, const Transaction &transaction,
std::map<uint64_t, std::unique_ptr<Transaction>> &cloned_transactions,
VertexContainer &cloned_vertices, EdgeContainer &cloned_edges);
void AdjustClonedTransactions(std::map<uint64_t, std::unique_ptr<Transaction>> &cloned_transactions,
VertexContainer &cloned_vertices, EdgeContainer &cloned_edges);