* `plan_cover_none_hole`: The coverage search produced no plan because the fixed hole operations alone exceeded `hole-max` or `total-max`.
* `plan_cover_none_limit`: The coverage search produced no plan because every covering exceeded the operation limits (all paths pruned during the walk).
* `plan_dedupe_bytes`: Total bytes matched (deduped) across executed dst plans.
+ * `plan_dst_abort`: A dst plan was abandoned during execution by an error other than a missing file (I/O error, read-only dst, invalid dedupe request). Any pairs it already executed stay done; the dst is not handed to verification.
* `plan_dst_executed`: One dst plan was executed (data materialized to a tempfile if needed, then deduped) and its extent handed to the verification tracker.
* `plan_empty`: The winning plan had no dst plans, so execution was a no-op (the do-nothing outcome).
* `plan_execute`: A non-empty winning plan was executed.
* `plan_force_rewrite`: The forced FullRewrite floor won selection for a force-marked start extent (the whole extent is rewritten regardless of dedupe benefit).
* `plan_force_rewrite_unrealizable`: A force-marked start extent could not be rewritten and was left as-is, because no covering fit within the rewrite op limits (`copy-max`, `total-max`, ...). force-rewrite is best-effort: the extent falls back to the do-nothing outcome instead of aborting the scan.
+ * `plan_ref_enoent`: A dst ref was skipped during execution because its file no longer exists. Expected filesystem churn.
* `plan_reject_compressed_copy`: A composed plan was rejected because it would copy part of a compressed dst (which fragments compression). Not counted for force-marked extents, whose filter has lifted the prohibition.
* `plan_reject_compressed_dedupe`: A composed plan was rejected because it piled more than `compressed-dedupe-max` dedupe ops onto a compressed dst.
* `plan_reject_copy_max`: A composed plan was rejected because its copy operation count exceeded `copy-max`.
for (const auto &ref : *raw_refs_sp) {
BEESTRACE("ref = " << ref);
if (!ref.extent_offset().has_value() || !ref.ref_bytes().has_value()) {
- catch_all([&]() { ref.extent_data_fetch(layer); });
+ // A ref that no longer exists is skipped. Any other
+ // error aborts this dst plan (scan_next_execute).
+ try {
+ ref.extent_data_fetch(layer);
+ } catch (const system_error &e) {
+ if (e.code().value() != ENOENT) {
+ throw;
+ }
+ BEESCOUNT(plan_ref_enoent);
+ BEESLOGDEBUG("scan_next skip dst ref " << ref << ": " << e.what());
+ continue;
+ }
}
const auto extent_offset = ref.extent_offset();
const auto ref_bytes_val = ref.ref_bytes();
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);
+ bool ok = false;
+ try {
+ ok = ctx->dedup(pair);
+ } catch (const system_error &e) {
+ // The file is gone: nothing left to replace. Every
+ // other errno aborts this dst plan.
+ if (e.code().value() != ENOENT) {
+ throw;
+ }
+ BEESCOUNT(plan_ref_enoent);
+ BEESLOGDEBUG(what << " skip " << pair << ": " << e.what());
+ continue;
}
+ if (ok) {
+ continue;
+ }
+ // A read-only dst can't be replaced; abort.
+ if (ctx->is_root_ro(pair.second.fid().root())) {
+ THROW_ERROR(runtime_error, what << " dst is read-only: " << pair);
+ }
+ // DATA_DIFFERS. We can't tell whether the dst changed
+ // under us or the plan was wrong: the refs come from the
+ // commit root and lag the live data. Live changes are
+ // expected, so keep going; verification finds the ref if
+ // it survives.
}
}
}
BEESCOUNT(plan_execute);
- // Execute each dst plan.
+ // Execute each dst plan. An error aborts only the dst plan it
+ // occurs in; the pairs it already ran stay done and are not
+ // verified. Dead restarts the planner.
for (const auto &dst_plan : plan.m_dst_plans) {
- catch_all([&]() {
+ try {
BEESTRACE("execute dst plan " << dst_plan.m_dst);
scan_next_execute_dst_plan(ctx, dst_plan, planner_timer);
- });
+ } catch (const Borrower::Dead &) {
+ throw;
+ } catch (const exception &e) {
+ BEESCOUNT(plan_dst_abort);
+ BEESLOGDEBUG("scan_next abort dst plan " << dst_plan.m_dst << ": " << e.what());
+ }
}
}