Skip to content

Fix backup handling when quick-check matches - #2062

Merged
oferchen merged 1 commit into
masterfrom
fix-backup-tests-for-oc-rsync
Nov 8, 2025
Merged

oferchen merged 1 commit into
masterfrom
fix-backup-tests-for-oc-rsync

Conversation

@oferchen

@oferchen oferchen commented Nov 8, 2025 •

Copy link
Copy Markdown
Owner

Summary

  • defer backup creation until after the copy flow determines a transfer is required
  • fall back to checksum comparison for --backup runs so identical metadata no longer suppresses necessary overwrites

Testing

  • cargo test -p oc-rsync-cli -- frontend::tests::backup_tests::backup_flag_creates_default_suffix_backups --exact
  • cargo test -p oc-rsync-cli -- frontend::tests::backup_tests::backup_suffix_flag_overrides_default_suffix --exact
  • cargo test -p oc-rsync-cli -- frontend::tests::backup_tests::backup_dir_flag_places_backups_in_relative_directory --exact

[Codex Task](

@oferchen
oferchen merged commit a3aec6a into master Nov 8, 2025
@oferchen
oferchen deleted the fix-backup-tests-for-oc-rsync branch November 8, 2025 11:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 136 to 138
let link_outcome = links::process_links(
context,
source,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

oferchen added a commit that referenced this pull request May 5, 2026
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.
oferchen added a commit that referenced this pull request May 6, 2026
* 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
oferchen added a commit that referenced this pull request May 18, 2026
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.
oferchen added a commit that referenced this pull request May 18, 2026
* 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
oferchen added a commit that referenced this pull request Aug 24, 2026
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.
oferchen added a commit that referenced this pull request Aug 24, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant