});
// Record which plan type won the ballot (Plan A / Plan B / do-nothing).
(*winner_it)->count_accepted();
+
+ // Diagnostic: the do-nothing floor won — but did it decline a *real*
+ // dedupe? The common case (an extent with no duplicates) leaves the
+ // real plans with zero operations and debt tied at the floor (0.0);
+ // those must stay silent or this line fires for every scanned extent.
+ // Only when a covering with actual dedupe/copy ops was built and still
+ // lost (its debt is necessarily >= 0 here, since a negative-debt plan
+ // would have displaced the floor) do we emit a line. A `plan: null`
+ // line is then exactly one beneficial-looking dedupe the floor gave up,
+ // carrying the ref-cost-vs-physical-freed breakdown that names why:
+ // refs_added/refs_created are the debt the plan adds, physical_freed the
+ // credit it earns, and a compressed dst freed wholesale earns little.
+ const bool null_won =
+ (!plan_a || winner_it->get() != plan_a.get()) &&
+ (!plan_b || winner_it->get() != plan_b.get());
+ if (null_won) {
+ const BeesPlan *declined = nullptr;
+ for (const BeesPlan *cand : {
+ static_cast<const BeesPlan *>(plan_a.get()),
+ static_cast<const BeesPlan *>(plan_b.get()),
+ }) {
+ if (!cand) {
+ continue;
+ }
+ // A real plan with no operations means no duplicate was
+ // found (or none survived the gates): the no-op common
+ // case. Skip it so only genuine floor declines log.
+ if (cand->cost().m_plan_ops == 0) {
+ continue;
+ }
+ if (!declined || cand->cost().m_space_debt < declined->cost().m_space_debt) {
+ declined = cand;
+ }
+ }
+ if (declined) {
+ BEESCOUNT(plan_null_declined);
+ const auto &c = declined->cost();
+ BEESLOGINFO("plan: null "
+ << pretty(c.m_bytes_freed) << " declined "
+ << c.m_plan_ops << "ops {"
+ << to_hex(m_start.bytenr()) << "}"
+ << " freed " << pretty(c.m_physical_freed)
+ << " refs_added " << c.m_refs_added
+ << " rc " << c.m_refs_created
+ << " ed " << c.m_extents_delta
+ << " debt +" << fixed << setprecision(1)
+ << c.m_space_debt);
+ }
+ }
plan = scan_next_build_extent_plan(m_ctx, **winner_it,
*m_filter_cache, m_rewrite_policy);