Skip to content

Commit 6ba316e

Browse files
committed
txgraph: 1-or-2-tx split-off clusters are optimal (optimization)
1 parent fad0eb0 commit 6ba316e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/txgraph.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,10 +978,11 @@ bool Cluster::Split(TxGraphImpl& graph) noexcept
978978
// Iterate over the connected components of this Cluster's m_depgraph.
979979
while (todo.Any()) {
980980
auto component = m_depgraph.FindConnectedComponent(todo);
981+
auto split_quality = component.Count() <= 2 ? QualityLevel::OPTIMAL : new_quality;
981982
if (first && component == todo) {
982983
// The existing Cluster is an entire component. Leave it be, but update its quality.
983984
Assume(todo == m_depgraph.Positions());
984-
graph.SetClusterQuality(m_level, m_quality, m_setindex, new_quality);
985+
graph.SetClusterQuality(m_level, m_quality, m_setindex, split_quality);
985986
// If this made the quality ACCEPTABLE or OPTIMAL, we need to compute and cache its
986987
// chunking.
987988
Updated(graph);
@@ -996,7 +997,7 @@ bool Cluster::Split(TxGraphImpl& graph) noexcept
996997
for (auto i : component) {
997998
remap[i] = {new_cluster.get(), DepGraphIndex(-1)};
998999
}
999-
graph.InsertCluster(m_level, std::move(new_cluster), new_quality);
1000+
graph.InsertCluster(m_level, std::move(new_cluster), split_quality);
10001001
todo -= component;
10011002
}
10021003
// Redistribute the transactions.

0 commit comments

Comments
 (0)