/// them — e.g. spotting a high-ref extent drained as a dst.
double m_space_debt = 0.0;
uint64_t m_dst_ref_count = 0;
+ /// refs_created the winning plan's cost() actually carried into the debt
+ /// (dst_ref_count as the cost model saw it, times F). Logged beside
+ /// 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;
};
/// Output of the planner: a list of accepted dst plans plus
<< "s/" << planner_timer.age() << "s {"
<< 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);
return true;
// recorded below (logged on the "plan:" line). refs() reads here are the
// planner's cached, pre-execution values.
auto &diag_layer = Borrower::current().layer();
- const double winner_space_debt = winner.cost().m_space_debt;
+ const auto winner_cost = winner.cost();
+ const double winner_space_debt = winner_cost.m_space_debt;
+ const uint64_t winner_refs_created = winner_cost.m_refs_created;
if (auto *pa = dynamic_cast<const BeesStartAsDstPlan *>(&winner)) {
const auto *impl = pa->impl();
return out;
}
- dp->m_space_debt = winner_space_debt;
- dp->m_dst_ref_count = start.refs(diag_layer)->size();
+ dp->m_space_debt = winner_space_debt;
+ dp->m_sel_refs_created = winner_refs_created;
+ dp->m_dst_ref_count = start.refs(diag_layer)->size();
out.m_total_cost = dp->m_cost;
for (const auto &g : groups) {
out.m_src_bytenrs.insert(g.m_extent.bytenr());
auto dp = scan_next_try_build_dst_plan(ctx,
entry.m_candidate, sources, policy, force);
if (dp) {
- dp->m_space_debt = winner_space_debt;
+ dp->m_space_debt = winner_space_debt;
+ dp->m_sel_refs_created = winner_refs_created;
dp->m_dst_ref_count =
entry.m_candidate.refs(diag_layer)->size();
out.m_total_cost += dp->m_cost;