Repository navigation
Fix backup handling when quick-check matches - #2062
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let link_outcome = links::process_links( | ||
| context, | ||
| source, |
There was a problem hiding this comment.
Restore backups when links short-circuit the copy path
The call to context.backup_existing_entry was removed from copy_file and reintroduced only inside execute_transfer. When links::process_links handles the operation (hard-linking, reference linking, or metadata reuse) the function returns early before execute_transfer runs, so no backup is created even when --backup is enabled. Previously the backup was executed before link processing, so updating a destination to a link or metadata-only change would move the original file aside; after this change those updates overwrite or remove the existing path without any backup. Consider restoring the backup invocation before the early-return link flow so all mutating operations honour the backup flag.
Useful? React with 👍 / 👎.
Translate zsync librcksum's bithash mechanism into oc-rsync without touching the wire. Establish the bit-array shape and the BITHASHBITS=3 sizing rationale, name the exact insertion points in the existing index, fix the bit-mixing function on the 32-bit packed rolling sum, restate the no-missed-match property invariant, and list every layer the change must keep byte-identical to upstream 3.0.9 / 3.1.3 / 3.4.1. Bench scaffolding is cfg-gated and never reaches a CLI flag. Implementation is tracked in #2060/#2061; tests in #2062; bench in #2063.
* feat(match): add zsync-inspired bithash prefilter to MatchIndex Translate zsync's librcksum bithash gate into oc-rsync's existing DeltaSignatureIndex. The bithash is an oversized one-sided bit array sized to roughly 8x the rsum-bucket count and probed after the 1 KB tag_table check but before the FxHashMap walk. At the design saturation density (1/8) it rejects ~7/8 of post-tag misses for purely receiver-side CPU savings. The prefilter is in-memory only: no signature payload, NDX framing, capability negotiation, multiplex frame, golden-byte fixture, or interop matrix is touched. Sizing follows docs/design/zsync-bithash.md sections 1 and 2; insertion and probe sites match section 3 exactly. Wires into populate_index alongside tag_table and lookup, and into DeltaSignatureIndex::rebuild via clear() to recycle across the INC_RECURSE per-segment rebuild path. The probe goes into both find_match_bytes and find_match_slices; check_block_match_slices is intentionally not gated since it bypasses the hash table. Property tests pin the no-false-negative contract end-to-end (every inserted basis block is still found) and at the BitHash level (contains is true for every previously inserted rsum, including across clear/reinsert cycles). Closes #2060 Closes #2061 Closes #2062 * fix(deps): regenerate Cargo.lock for proptest dev-dep
Translate zsync librcksum's bithash mechanism into oc-rsync without touching the wire. Establish the bit-array shape and the BITHASHBITS=3 sizing rationale, name the exact insertion points in the existing index, fix the bit-mixing function on the 32-bit packed rolling sum, restate the no-missed-match property invariant, and list every layer the change must keep byte-identical to upstream 3.0.9 / 3.1.3 / 3.4.1. Bench scaffolding is cfg-gated and never reaches a CLI flag. Implementation is tracked in #2060/#2061; tests in #2062; bench in #2063.
* feat(match): add zsync-inspired bithash prefilter to MatchIndex Translate zsync's librcksum bithash gate into oc-rsync's existing DeltaSignatureIndex. The bithash is an oversized one-sided bit array sized to roughly 8x the rsum-bucket count and probed after the 1 KB tag_table check but before the FxHashMap walk. At the design saturation density (1/8) it rejects ~7/8 of post-tag misses for purely receiver-side CPU savings. The prefilter is in-memory only: no signature payload, NDX framing, capability negotiation, multiplex frame, golden-byte fixture, or interop matrix is touched. Sizing follows docs/design/zsync-bithash.md sections 1 and 2; insertion and probe sites match section 3 exactly. Wires into populate_index alongside tag_table and lookup, and into DeltaSignatureIndex::rebuild via clear() to recycle across the INC_RECURSE per-segment rebuild path. The probe goes into both find_match_bytes and find_match_slices; check_block_match_slices is intentionally not gated since it bypasses the hash table. Property tests pin the no-false-negative contract end-to-end (every inserted basis block is still found) and at the BitHash level (contains is true for every previously inserted rsum, including across clear/reinsert cycles). Closes #2060 Closes #2061 Closes #2062 * fix(deps): regenerate Cargo.lock for proptest dev-dep
Translate zsync librcksum's bithash mechanism into oc-rsync without touching the wire. Establish the bit-array shape and the BITHASHBITS=3 sizing rationale, name the exact insertion points in the existing index, fix the bit-mixing function on the 32-bit packed rolling sum, restate the no-missed-match property invariant, and list every layer the change must keep byte-identical to upstream 3.0.9 / 3.1.3 / 3.4.1. Bench scaffolding is cfg-gated and never reaches a CLI flag. Implementation is tracked in #2060/#2061; tests in #2062; bench in #2063.
* feat(match): add zsync-inspired bithash prefilter to MatchIndex Translate zsync's librcksum bithash gate into oc-rsync's existing DeltaSignatureIndex. The bithash is an oversized one-sided bit array sized to roughly 8x the rsum-bucket count and probed after the 1 KB tag_table check but before the FxHashMap walk. At the design saturation density (1/8) it rejects ~7/8 of post-tag misses for purely receiver-side CPU savings. The prefilter is in-memory only: no signature payload, NDX framing, capability negotiation, multiplex frame, golden-byte fixture, or interop matrix is touched. Sizing follows docs/design/zsync-bithash.md sections 1 and 2; insertion and probe sites match section 3 exactly. Wires into populate_index alongside tag_table and lookup, and into DeltaSignatureIndex::rebuild via clear() to recycle across the INC_RECURSE per-segment rebuild path. The probe goes into both find_match_bytes and find_match_slices; check_block_match_slices is intentionally not gated since it bypasses the hash table. Property tests pin the no-false-negative contract end-to-end (every inserted basis block is still found) and at the BitHash level (contains is true for every previously inserted rsum, including across clear/reinsert cycles). Closes #2060 Closes #2061 Closes #2062 * fix(deps): regenerate Cargo.lock for proptest dev-dep
Summary
--backupruns so identical metadata no longer suppresses necessary overwritesTesting
cargo test -p oc-rsync-cli -- frontend::tests::backup_tests::backup_flag_creates_default_suffix_backups --exactcargo test -p oc-rsync-cli -- frontend::tests::backup_tests::backup_suffix_flag_overrides_default_suffix --exactcargo test -p oc-rsync-cli -- frontend::tests::backup_tests::backup_dir_flag_places_backups_in_relative_directory --exact[Codex Task](