feat(native): skip unchanged subtrees in intermediate sync rounds

Intermediate cephmig round snapshots skip a subdirectory whose inode,
inode version and ceph.dir.rctime equal those in the base snapshot. The
index carries the subtree's entries over from the base and marks them
carried; carried entries never serve as base for a block delta.
Snapdiff, copy, pruning and verification leave skipped subtrees out.

Application snapshots and finalize always scan everything, so a change
missed because of delayed rctime propagation or a lagging client clock
costs extra work but cannot reach the final state. The config option
full_scan disables the shortcut; the journal reports skipped_subtrees.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-12-03 20:19:31 +01:00
1 parent b7d2a0687e
commit 83e15bccb2
9 files changed
+394 -12

No files matched your search

+10
View File
@@ -70,6 +70,12 @@ def populate(root):
os.setxattr(root + "/d", "ceph.quota.max_bytes", b"33554432")
os.setxattr(root + "/d", "ceph.quota.max_files", b"1000")
os.setxattr(root, "ceph.quota.max_bytes", b"268435456")
# A subtree no round changes; sync rounds skip it by its rctime.
os.makedirs(root + "/static/deep/deeper")
pathlib.Path(root + "/static/deep/deeper/file").write_bytes(b"static" * 1000)
os.link(root + "/static/deep/deeper/file", root + "/static/alias")
os.setxattr(root + "/static/deep", "user.static", b"kept")
os.symlink("deep/deeper/file", root + "/static/link")
def edit_large(root, offset, data):
@@ -267,6 +273,10 @@ elif action in ("verify", "final"):
assert compare_times(a, b, atime=True) > 10
assert snapshot("source", "metadata", "ls", "cephfs", name, snap["name"]) == snapshot(
"target", "metadata", "ls", "cephfs", name, snap["name"])
owned = [x for x in s["snapshots"] if x["owned"]]
# Intermediate rounds skip the untouched subtree; finalize never skips.
assert all(x["transfer"].get("skipped_subtrees", 0) >= 1 for x in owned if not x.get("final")), owned
assert all(x["transfer"].get("skipped_subtrees", 0) == 0 for x in owned if x.get("final")), owned
h2 = next(x for x in s["snapshots"] if x["name"] == "history-2")["transfer"]
assert h2["mode"] == "snapdiff" and h2["blockdiff_files"] > 0, h2
assert h2["bytes_copied"] < 64 << 20, h2