TxGraphImpl::PullIn: only allowed when staging exists

This commit is contained in:
Greg Sanders 2025-03-31 12:47:10 -04:00
parent 3358b1d105
commit 2c5cf987e9

View file

@ -411,8 +411,8 @@ public:
* values for remaining Entry objects, so this only does something when no to-be-applied * values for remaining Entry objects, so this only does something when no to-be-applied
* operations or staged removals referring to GraphIndexes remain). */ * operations or staged removals referring to GraphIndexes remain). */
void Compact() noexcept; void Compact() noexcept;
/** If cluster is not in staging, copy it there, and return a pointer to it. This has no /** If cluster is not in staging, copy it there, and return a pointer to it.
* effect if only a main graph exists, but if staging exists this modifies the locators of its * Staging must exist, and this modifies the locators of its
* transactions from inherited (P,M) to explicit (P,P). */ * transactions from inherited (P,M) to explicit (P,P). */
Cluster* PullIn(Cluster* cluster) noexcept; Cluster* PullIn(Cluster* cluster) noexcept;
/** Apply all removals queued up in m_to_remove to the relevant Clusters (which get a /** Apply all removals queued up in m_to_remove to the relevant Clusters (which get a
@ -928,7 +928,7 @@ Cluster* TxGraphImpl::FindCluster(GraphIndex idx, int level) const noexcept
Cluster* TxGraphImpl::PullIn(Cluster* cluster) noexcept Cluster* TxGraphImpl::PullIn(Cluster* cluster) noexcept
{ {
int to_level = GetTopLevel(); int to_level = GetTopLevel();
if (to_level == 0) return cluster; Assume(to_level == 1);
int level = cluster->m_level; int level = cluster->m_level;
Assume(level <= to_level); Assume(level <= to_level);
// Copy the Cluster from main to staging, if it's not already there. // Copy the Cluster from main to staging, if it's not already there.