Skip to content

fix(matching): report upstream's hash_hits and false_alarms counters - #8252

Merged
oferchen merged 8 commits into
masterfrom
feat/local-vvv-parity
Oct 29, 2026
Merged

oferchen merged 8 commits into
masterfrom
feat/local-vvv-parity

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • The -vv total: line now reports upstream rsync 3.5.1's hash_hits and false_alarms, not oc-native counts. upstream defines both by its own hash_table: match.c:84-110 build_hash_table() and 214-271 hash_search(). hash_hits is one per probed offset whose bucket is non-empty. false_alarms is one per chain candidate whose weak sum matches but whose strong sum does not. oc's matcher uses a different index (tag table, bithash, compact buckets), so its counts never matched upstream's.
  • New matching::UpstreamHashTable rebuilds upstream's table with its geometry and chain order, then walks the chains at every offset upstream probes. That includes the shrinking-window offsets past the last full window (match.c:197, 362-364) and the --inplace chain pruning (match.c:233-237). Three scans feed it: the local engine, the wire sender and the consecutive-match scan. They do so only while DEBUG_GTE(DELTASUM, 1) reports the counters, so the default path does no extra work. While the counters are reported the parallel chunked scan is not selected. matches and data were already exact.
  • The oc-native counted probe (find_match_window_counted) is removed.

Oracle evidence (host, upstream 3.5.1)

total: line for -rvv --no-whole-file, shown as hash_hits / false_alarms:

fixture mode upstream oc before oc after
200k-line text, one line changed local 1165 / 0 1262 / 120 1165 / 0
same push 1165 / 0 1130 / 1129 1165 / 0
same pull 1165 / 0 1130 / 1129 1165 / 0
weak-sum collisions (300 KB) local, push, pull 89104 / 38008112 not measured equal
strong-sum collisions plus redo (--checksum-seed=1) local, push, pull 5 / 2 8 / 5 5 / 2

matches and data are equal in every cell, before and after.

Test plan

  • New gated oracle, crates/cli/tests/delta_total_line_oracle.rs. Each of three fixtures must give upstream's line in local, push and pull mode. The redo fixture is checked in under crates/cli/tests/fixtures/delta_total/.
  • Unit tests for the model, crates/matching/src/index/upstream_hash_tests.rs:
    • table size and bucket formula;
    • empty bucket;
    • strong match;
    • a weak-sum collision gives one false alarm per candidate;
    • the MAX_CHAIN_LEN cap;
    • --inplace unlinking.
  • Mutations: each of these makes the oracle fail:
    • dropping the replay probe on the wire scan's adjacent-match path;
    • dropping the local tail replay.
  • Local gates: fmt, check_rustfmt_all, workspace clippy, no-default clippy for matching, engine, transfer and cli, windows-gnu check with --tests, nextest for matching (all) and the delta-related engine, transfer and cli tests, unsafe_owner_deps, dead_code_census, no-placeholders.
  • CI.

CI: .github/workflows/_interop.yml runs the new oracle (binary(delta_total_line_oracle)) after the delta token parity oracle.

Coordination

  • Part of the local -vvv parity epic (task 453): task 313.

Pre-merge checklist

  • Conventional commit prefix on PR title matches the change category.
  • cargo fmt --all run locally.
  • CHANGELOG.md updated if user-visible.

@github-actions github-actions Bot added the bug Something isn't working label Oct 28, 2026
The -vv total: line printed oc-native probe counts: bithash positives
and their verify failures. upstream defines both by its own hash_table
(match.c:84-110 build_hash_table, 214-271 hash_search): hash_hits is one
per probed offset whose bucket is non-empty, false_alarms one per chain
candidate whose weak sum matches but whose strong sum does not. On a
200,000-line delta oc printed 1262/120 locally and 1130/1129 on the wire
against upstream's 1165/0.

UpstreamHashTable rebuilds that table and walks its chains at every
offset upstream probes, including the shrinking-window offsets past the
last full window and the --inplace chain pruning. Every sequential scan
(local engine, wire sender, consecutive-match scan) feeds it, but only
while DEBUG_GTE(DELTASUM, 1) reports the counters, and the parallel
chunked scan is not chosen then. matches and data were already exact.
Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop
failing on the master test-harness race: on EPERM for our own child, SIGKILL
the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the
child already leads its own group. The content is identical to #8253, so the
two merge without conflict.
@oferchen oferchen closed this Oct 29, 2026
@oferchen oferchen reopened this Oct 29, 2026
@oferchen oferchen closed this Oct 29, 2026
@oferchen oferchen reopened this Oct 29, 2026
@oferchen
oferchen merged commit 4534b60 into master Oct 29, 2026
69 of 145 checks passed
@oferchen
oferchen deleted the feat/local-vvv-parity branch October 29, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant