} else {
BEESCOUNT(dedup_miss);
BEESLOGINFO("NO Dedup! " << brp);
+ // Dump the live trace stack now, while the
+ // caller's planner state (plan tree, materialized
+ // src tree, current pair) is still in scope.
+ // Misses are rare, so an unconditional dump per
+ // miss is cheap; callers that swallow the false
+ // return (no throw, no unwind dump) still get a
+ // full trace this way.
+ BeesTracer::trace_now();
}
lock.reset();
continue;
}
+ BEESTRACE("sweep_join dst_ref " << di << " of " << dst_refs.size()
+ << ": " << dst_ref);
+
uint64_t cursor = dst_ref.begin();
while (cursor < dst_ref.end()) {
+ BEESTRACE("sweep_join cursor " << to_hex(cursor)
+ << " in [" << to_hex(dst_ref.begin())
+ << ".." << to_hex(dst_ref.end()) << ")");
bool covered = false;
bool open_failed = false;
uint64_t best_overlap_end = cursor;
const vector<BeesRangePair> &pairs, const string &what)
{
BEESNOTE("scan_next dedupe " << what << " " << pairs.size() << " pairs");
+ size_t index = 0;
for (const auto &pair : pairs) {
+ // One trace frame per pair so a "NO Dedup!" trace dump (or a
+ // mid-loop throw) identifies which pair of the batch failed
+ // and how far the batch had progressed.
+ BEESTRACE(what << " pair " << index << " of " << pairs.size()
+ << ": " << pair);
+ ++index;
const auto ok = ctx->dedup(pair);
if (!ok) {
THROW_ERROR(runtime_error, what << " failed for " << pair);
BEESTRACE("scan_next dst " << to_hex(dst.bytenr())
<< " plan " << BeesExtentTreeDump(dst_plan.m_plan_tree));
+ // Planner accounting for the same dump: what the planner thought this
+ // plan would do. A "NO Dedup!" trace can then be compared against
+ // the op counts and byte totals the cost model predicted.
+ BEESTRACE("scan_next dst " << to_hex(dst.bytenr())
+ << " cost dedupe_ops " << dst_plan.m_cost.m_dedupe_ops
+ << " copy_ops " << dst_plan.m_cost.m_copy_ops
+ << " hole_ops " << dst_plan.m_cost.m_hole_ops
+ << " matched " << pretty(dst_plan.m_cost.m_matched_bytes)
+ << " copy " << pretty(dst_plan.m_cost.m_copy_bytes));
+
auto &layer = Borrower::current().layer();
// Materialize: replace PreCopyExtent with PostCopyExtent.
auto src_tree = scan_next_materialize_plan_tree(