Feature: Checksum-based whole-file comparison (-c, --checksum) #183

Closed
opened 2026-07-30 18:32:55 +02:00 by TapTap · 0 comments
Owner

Corresponding rsync flags/behavior:

  • -c, --checksum — skip files based on checksum instead of size + mtime

Current FastSync behavior:
Incremental mode (--incremental) compares file size and mtime in src/shared/file.c:333-334. The delta transfer (--delta) only applies after a file is deemed changed. There is no whole-file checksum comparison.

Proposed changes:

  • CLI flag: -c, --checksum
  • Config field: bool use_checksum
  • Implementation:
    • Compute xxHash (already a dependency) of each source file during scan
    • Send checksum alongside size/mtime in STATUS_CHECK
    • Server compares checksum of existing destination file and replies STATUS_OK if it matches
    • Falls back to delta transfer if checksum differs and --delta is enabled
  • Protocol: extend STATUS_CHECK payload to include a checksum field, or add a new STATUS_CHECKSUM status

Priority: medium
Rationale: Size+mtime can miss content changes that preserve mtime or when clocks are unreliable. Checksum-based comparison is the safest skip heuristic and a common rsync workflow.

Acceptance criteria:

  • client -c /src /dst skips files whose xxHash matches the destination
  • Changed content with identical size and mtime is still transferred
  • Works together with --incremental and --delta
  • Integration test verifies checksum skip behavior
**Corresponding rsync flags/behavior:** - `-c, --checksum` — skip files based on checksum instead of size + mtime **Current FastSync behavior:** Incremental mode (`--incremental`) compares file size and mtime in `src/shared/file.c:333-334`. The delta transfer (`--delta`) only applies after a file is deemed changed. There is no whole-file checksum comparison. **Proposed changes:** - CLI flag: `-c, --checksum` - Config field: `bool use_checksum` - Implementation: - Compute xxHash (already a dependency) of each source file during scan - Send checksum alongside size/mtime in `STATUS_CHECK` - Server compares checksum of existing destination file and replies `STATUS_OK` if it matches - Falls back to delta transfer if checksum differs and `--delta` is enabled - Protocol: extend `STATUS_CHECK` payload to include a checksum field, or add a new `STATUS_CHECKSUM` status **Priority:** medium **Rationale:** Size+mtime can miss content changes that preserve mtime or when clocks are unreliable. Checksum-based comparison is the safest skip heuristic and a common rsync workflow. **Acceptance criteria:** - [ ] `client -c /src /dst` skips files whose xxHash matches the destination - [ ] Changed content with identical size and mtime is still transferred - [ ] Works together with `--incremental` and `--delta` - [ ] Integration test verifies checksum skip behavior
TapTap added the enhancementneeds-triage labels 2026-07-30 18:32:55 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#183