do-nothing is exactly `0`. A destination with a large `refs` and a negative
`debt` was worth rewriting because the space it frees outweighs the cost of
moving its references.
+ * `pivot` — present when this destination belongs to a re-centered plan: with
+ `rewrite.prefer-canonical-src`, the dedupe star was pivoted onto a
+ higher-reference whole-extent duplicate, so this destination (possibly the
+ scanned extent itself) is being deduped onto that canonical rather than the
+ scanned extent surviving as the source.
/// m_dst_ref_count (read fresh at build): if this is ~0 while that is large,
/// the planner priced the dst against a stale/reduced ref view.
uint64_t m_sel_refs_created = 0;
+ /// True when this dst belongs to a re-centered Plan B (prefer-canonical-src
+ /// pivoted the star onto a higher-ref whole-extent duplicate, so this dst —
+ /// possibly the former start — is deduped onto that canonical). Logged as a
+ /// "pivot" tag on the "plan:" line so re-centered plans are greppable.
+ bool m_pivoted = false;
};
/// Output of the planner: a list of accepted dst plans plus
<< to_hex(dst.bytenr()) << "} ["
<< bar << "] refs " << dst_plan.m_dst_ref_count
<< " rc " << dst_plan.m_sel_refs_created
- << " debt " << setprecision(1) << dst_plan.m_space_debt);
+ << " debt " << setprecision(1) << dst_plan.m_space_debt
+ << (dst_plan.m_pivoted ? " pivot" : ""));
return true;
}
dp->m_space_debt = winner_space_debt;
dp->m_sel_refs_created = winner_refs_created;
dp->m_dst_ref_count = dst.refs(diag_layer)->size();
+ dp->m_pivoted = true;
out.m_total_cost += dp->m_cost;
out.m_dst_plans.push_back(std::move(*dp));
}