Skip to content

cephfs-mirror: sync file size when blockdiff is empty - #70923

Merged
kotreshhr merged 1 commit into
ceph:mainfrom
LiShengG:agent/cephfs-mirror-empty-blockdiff
Sep 23, 2026
Merged

kotreshhr merged 1 commit into
ceph:mainfrom
LiShengG:agent/cephfs-mirror-empty-blockdiff

Conversation

@LiShengG

@LiShengG LiShengG commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix cephfs-mirror incremental synchronization when file blockdiff succeeds
without returning changed data extents.

For size-only changes, the mirror previously skipped the datasync callback
when blocks.num_blocks was zero. As a result, copy_to_remote() was never
called, the destination file was not truncated to the current snapshot size,
and the mirror could still create the remote snapshot and advance its
checkpoint.

Invoke the callback once with an empty block list after a successful blockdiff
that produced no extents. This reaches the existing ceph_ftruncate() path
without copying file data.

The regression test pins cephfs_mirror_blockdiff_min_file_size to 16 MiB so
the cases cannot silently fall back to a full copy. It covers object-boundary,
partial-object and same-object shrink operations, along with sparse growth.

Fixes: https://tracker.ceph.com/issues/79156

Validation

  • git diff --check
  • python3 -m py_compile qa/tasks/cephfs/test_mirroring.py
  • cmake --build build --target cephfs-mirror -j 8
  • TestMirroring.test_cephfs_mirror_blockdiff_pure_truncate
    • repeated clean runs with exact type, byte-size and SHA-256 comparison
    • runtime blockdiff threshold verified as 16 MiB
    • zero-block callback observed for all three shrink cases
    • sparse growth verified with the expected EOF extent
  • TestMirroring.test_cephfs_mirror_incremental_sync_with_type_mixup

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
    • Includes unit test(s)
    • Includes integration test(s)
    • Includes bug reproducer
    • No tests

@github-actions github-actions Bot added cephfs Ceph File System tests labels Aug 8, 2026
@LiShengG
LiShengG marked this pull request as ready for review August 8, 2026 00:54
@LiShengG
LiShengG marked this pull request as draft August 8, 2026 00:58
@LiShengG
LiShengG force-pushed the agent/cephfs-mirror-empty-blockdiff branch from 5c236de to 1181105 Compare August 8, 2026 00:59
@LiShengG
LiShengG marked this pull request as ready for review August 8, 2026 01:00
@vshankar
vshankar requested a review from a team September 2, 2026 05:37
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

A size-only snapshot change can make file blockdiff complete without returning any changed data extents. SnapDiffSync then skips its callback, so copy_to_remote() never reaches the ftruncate that updates the destination file size.

Invoke the callback once with an empty block list when blockdiff succeeds without producing extents. Add regression coverage for object-boundary, partial-object and same-object shrink operations, plus sparse growth.

Fixes: https://tracker.ceph.com/issues/79156
Signed-off-by: Li Sheng <[email protected]>
@LiShengG
LiShengG force-pushed the agent/cephfs-mirror-empty-blockdiff branch from 1181105 to 41ca4fd Compare September 7, 2026 11:01
@kotreshhr kotreshhr self-assigned this Sep 9, 2026
@kotreshhr
kotreshhr self-requested a review September 9, 2026 14:06
@kotreshhr

Copy link
Copy Markdown
Contributor

jenkins retest this please

@kotreshhr

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by khiremat started 2026-09-09-16:42.

@kotreshhr

Copy link
Copy Markdown
Contributor

@kotreshhr
kotreshhr merged commit a3c066d into ceph:main Sep 23, 2026
14 checks passed
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.

2 participants