Repository navigation
Fix local delta copy when identical timestamps - #2066
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".
| if !checksum && !size_only && modify_window.is_zero() && src == dst { | ||
| return files_checksum_match(source_path, destination_path, checksum_algorithm) | ||
| .unwrap_or(false); |
There was a problem hiding this comment.
Recomputing checksums for every unchanged file
The new branch hashes both source and destination whenever size-only and checksum flags are off but the mtimes match exactly. With modify_window defaulting to zero this condition is true for every unchanged file, meaning a follow-up sync now reads the entire contents of every file just to decide whether to skip. Upstream rsync relies on the quick-check (size + mtime) specifically to avoid that cost, so this change turns the common “no changes” run into an O(total file size) scan instead of O(number of entries), which is a large performance regression. Consider limiting the content comparison to explicit --checksum mode or another opt-in path that can tolerate the extra I/O.
Useful? React with 👍 / 👎.
* feat(match): add zsync-inspired seq-match extend-run
Coalesces consecutive matched basis blocks at the DeltaScript layer into
a single fat `DeltaToken::Copy { len = run * block_length }`, mirroring
zsync's `next_match` shortcut from `librcksum/rsum.c:262`. The wire
layer (`script_to_wire_delta`) expands fat Copy tokens back into one
DeltaOp per basis block, so the wire byte stream stays byte-identical
to the no-coalesce baseline (closes #2065).
Adds `DeltaSignatureIndex::extend_run(start_block_index, target,
max_blocks)` as the public helper and pins the post-coalesce token
stream with a golden-byte regression test in
`crates/match/tests/seq_match_golden.rs` (closes #2066). Updates
shifted-insertion and sparse-match fixtures to expand fat Copy runs
before asserting per-block contiguity.
Wire-compat invariants from `docs/design/zsync-seq-match.md`:
- One write_int(-(block_index + 1)) per basis block on the wire.
- CPRES_ZLIB dictionary sync still feeds one block per match call.
- `apply_delta` and `compute_file_checksum` already honour `len`,
no semantic changes downstream.
* fix(match): pad extend_run test data to multiple of DEFAULT_BLOCK_SIZE
* fix(test): assert copied bytes instead of token count for repeated blocks
The seq-match extend_run helper coalesces consecutive matching blocks
into a single COPY token, so the prior token-count assertion no longer
holds. Asserting that all input bytes are covered by COPY tokens (and
zero literal bytes) preserves the test's intent without depending on
the internal coalescing strategy.
* fix(test): size synthetic basis to exact multiple of DEFAULT_BLOCK_SIZE
Both seq_match_emits_single_fat_copy_for_full_basis_run and
seq_match_matched_bytes_match_baseline assume every basis block is
full-length so that extend_run can walk the whole basis in a single
fat-copy and matched bytes equal block_count * block_length. With
65 536-byte input and 700-byte blocks, the trailing 536-byte partial
block defeated those invariants. Sizing to 700 * 94 = 65 800 bytes
keeps the basis well under the < 700^2 byte threshold (so the layout
still picks 700) and removes the partial trailing block.
* feat(match): add zsync-inspired seq-match extend-run
Coalesces consecutive matched basis blocks at the DeltaScript layer into
a single fat `DeltaToken::Copy { len = run * block_length }`, mirroring
zsync's `next_match` shortcut from `librcksum/rsum.c:262`. The wire
layer (`script_to_wire_delta`) expands fat Copy tokens back into one
DeltaOp per basis block, so the wire byte stream stays byte-identical
to the no-coalesce baseline (closes #2065).
Adds `DeltaSignatureIndex::extend_run(start_block_index, target,
max_blocks)` as the public helper and pins the post-coalesce token
stream with a golden-byte regression test in
`crates/match/tests/seq_match_golden.rs` (closes #2066). Updates
shifted-insertion and sparse-match fixtures to expand fat Copy runs
before asserting per-block contiguity.
Wire-compat invariants from `docs/design/zsync-seq-match.md`:
- One write_int(-(block_index + 1)) per basis block on the wire.
- CPRES_ZLIB dictionary sync still feeds one block per match call.
- `apply_delta` and `compute_file_checksum` already honour `len`,
no semantic changes downstream.
* fix(match): pad extend_run test data to multiple of DEFAULT_BLOCK_SIZE
* fix(test): assert copied bytes instead of token count for repeated blocks
The seq-match extend_run helper coalesces consecutive matching blocks
into a single COPY token, so the prior token-count assertion no longer
holds. Asserting that all input bytes are covered by COPY tokens (and
zero literal bytes) preserves the test's intent without depending on
the internal coalescing strategy.
* fix(test): size synthetic basis to exact multiple of DEFAULT_BLOCK_SIZE
Both seq_match_emits_single_fat_copy_for_full_basis_run and
seq_match_matched_bytes_match_baseline assume every basis block is
full-length so that extend_run can walk the whole basis in a single
fat-copy and matched bytes equal block_count * block_length. With
65 536-byte input and 700-byte blocks, the trailing 536-byte partial
block defeated those invariants. Sizing to 700 * 94 = 65 800 bytes
keeps the basis well under the < 700^2 byte threshold (so the layout
still picks 700) and removes the partial trailing block.
* feat(match): add zsync-inspired seq-match extend-run
Coalesces consecutive matched basis blocks at the DeltaScript layer into
a single fat `DeltaToken::Copy { len = run * block_length }`, mirroring
zsync's `next_match` shortcut from `librcksum/rsum.c:262`. The wire
layer (`script_to_wire_delta`) expands fat Copy tokens back into one
DeltaOp per basis block, so the wire byte stream stays byte-identical
to the no-coalesce baseline (closes #2065).
Adds `DeltaSignatureIndex::extend_run(start_block_index, target,
max_blocks)` as the public helper and pins the post-coalesce token
stream with a golden-byte regression test in
`crates/match/tests/seq_match_golden.rs` (closes #2066). Updates
shifted-insertion and sparse-match fixtures to expand fat Copy runs
before asserting per-block contiguity.
Wire-compat invariants from `docs/design/zsync-seq-match.md`:
- One write_int(-(block_index + 1)) per basis block on the wire.
- CPRES_ZLIB dictionary sync still feeds one block per match call.
- `apply_delta` and `compute_file_checksum` already honour `len`,
no semantic changes downstream.
* fix(match): pad extend_run test data to multiple of DEFAULT_BLOCK_SIZE
* fix(test): assert copied bytes instead of token count for repeated blocks
The seq-match extend_run helper coalesces consecutive matching blocks
into a single COPY token, so the prior token-count assertion no longer
holds. Asserting that all input bytes are covered by COPY tokens (and
zero literal bytes) preserves the test's intent without depending on
the internal coalescing strategy.
* fix(test): size synthetic basis to exact multiple of DEFAULT_BLOCK_SIZE
Both seq_match_emits_single_fat_copy_for_full_basis_run and
seq_match_matched_bytes_match_baseline assume every basis block is
full-length so that extend_run can walk the whole basis in a single
fat-copy and matched bytes equal block_count * block_length. With
65 536-byte input and 700-byte blocks, the trailing 536-byte partial
block defeated those invariants. Sizing to 700 * 94 = 65 800 bytes
keeps the basis well under the < 700^2 byte threshold (so the layout
still picks 700) and removes the partial trailing block.
Summary
Testing
[Codex Task](