fix!: remove skipping of unchanged subtrees
Intermediate rounds skipped a directory when its inode version and its ceph.dir.rctime matched the previous round. In the 10,000-file lab test a round snapshot taken seconds after changes skipped tree/ with about 250 changed files in its subdirectories: the inode version of tree/ changes only with its own entries, and Ceph had not yet propagated the rctime of the grandchildren. The target snapshot of that round was incomplete, and its verification skipped the same subtrees; only finalize closed the gap. Every round now scans all metadata again. Base index entries that the old version marked carried are never trusted, so such files are copied in full in the next round. The smallfiles verification now checks only snapshots that sync did not remove. BREAKING CHANGE: the configuration field "full_scan" and the transfer statistic "skipped_subtrees" are removed; a configuration with "full_scan" is rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82c64f9908
commit
6dcb7b676f
16 files changed
+117
-448
No files matched your search
+2
-2
@@ -84,8 +84,8 @@ effective throughput and a fixed upper bound for the write stop will be
|
||||
determined later. The local environment verifies functionality but does not
|
||||
reproduce this amount of data. The native copier uses bounded workers and
|
||||
buffers, a persistent index on local disk and optional bandwidth limiting.
|
||||
Intermediate rounds skip unchanged subtrees; the final round still scans all
|
||||
metadata. Evidence for memory, index size,
|
||||
Every round, the final one included, scans all metadata. Evidence for
|
||||
memory, index size,
|
||||
runtime and the final write stop is missing.
|
||||
|
||||
1. Check source, target, permissions, capacity and required metadata.
|
||||
|
||||
+28
-51
@@ -48,8 +48,8 @@ limits concurrent file copies and verification checks (default 8, at most 64),
|
||||
`bandwidth_kib` limits the total payload bytes written per second. Both values
|
||||
may be changed when resuming.
|
||||
The `transfer` statistics in the journal report the mode, the base
|
||||
snapshot, visited and copied files, bytes written and read for verification,
|
||||
skipped subtrees and the duration of the round in seconds. `bytes_copied` counts payload writes without skipped zero
|
||||
snapshot, visited and copied files, bytes written and read for verification
|
||||
and the duration of the round in seconds. `bytes_copied` counts payload writes without skipped zero
|
||||
ranges; it does not measure the total network traffic including protocol and
|
||||
verification.
|
||||
|
||||
@@ -82,42 +82,25 @@ snapshots and then a new source snapshot. Further changes are caught up by
|
||||
running `sync` again. CephMig uses snapdiff and the Ceph inode version, so it
|
||||
also detects data changes with the same size and mtime.
|
||||
|
||||
### Skipping unchanged subtrees
|
||||
### Metadata scan
|
||||
|
||||
Reading all metadata of a large subvolume in every round is the main cost of
|
||||
a round: in the [one-million-file test](million-local.md), even an unchanged
|
||||
finalization took 1 h 20 min and 19.3 million MDS requests. Snapdiff cannot
|
||||
replace this scan; in the lab it reported every directory and missed pure
|
||||
chmod, xattr changes and writes through a hardlink alias.
|
||||
Every round reads the metadata of all entries of its snapshot. This is the
|
||||
main cost of a round: in the [one-million-file test](million-local.md), even
|
||||
an unchanged finalization took 1 h 20 min and 19.3 million MDS requests.
|
||||
Snapdiff cannot replace this scan; in the lab it reported every directory and
|
||||
missed pure chmod, xattr changes and writes through a hardlink alias.
|
||||
|
||||
Intermediate `sync` rounds therefore skip a subdirectory when, compared with
|
||||
the base snapshot of the previous round, it has
|
||||
|
||||
- the same inode and the same inode version, which changes at once with
|
||||
every entry added or removed and every change of its own metadata, and
|
||||
- the same `ceph.dir.rctime`, the newest ctime in the whole subtree.
|
||||
|
||||
The index takes over the entries of a skipped subtree from the previous base
|
||||
and marks them `carried`. Snapdiff, copy, pruning and verification all leave
|
||||
the subtree out. The journal reports the number per round as
|
||||
`skipped_subtrees`.
|
||||
|
||||
The rctime is not exact. Ceph propagates it to the parent directories with a
|
||||
delay; in the lab, a change made milliseconds before a snapshot was not yet
|
||||
visible in that snapshot's rctime. A client whose clock lags behind can also
|
||||
stamp a change with a ctime older than the newest one in the subtree. An
|
||||
intermediate round can therefore miss content changes deep inside a subtree.
|
||||
The following design limits the effect to extra work:
|
||||
|
||||
- `finalize` always scans and verifies everything; it never skips.
|
||||
- A carried entry describes an older round than the base snapshot, so it never
|
||||
serves as base for a block delta: a changed carried file is copied in full.
|
||||
- Snapshots discovered at the source (application snapshots) are always
|
||||
transferred with a full scan. Only the `cephmig-*` round snapshots, which
|
||||
are deleted later, can be incomplete.
|
||||
|
||||
`"full_scan": true` in the configuration disables the shortcut for all
|
||||
rounds. It may be changed when resuming.
|
||||
An earlier version skipped a subdirectory in intermediate rounds when its
|
||||
inode version and its `ceph.dir.rctime` matched the previous round. It was
|
||||
removed because it missed changes. In the 10,000-file test on 2026-12-03, a
|
||||
round snapshot taken seconds after changes skipped the directory `tree/`
|
||||
with about 250 changed files in its subdirectories: the inode version of
|
||||
`tree/` changes only with its own entries, and Ceph had not yet propagated
|
||||
the rctime of the grandchildren to it. That target snapshot was incomplete,
|
||||
and its verification did not notice, because it skipped the same subtrees;
|
||||
only `finalize`, which always scanned everything, closed the gap. Base index
|
||||
entries that this version marked `carried` are never trusted; such files are
|
||||
copied in full in the next round.
|
||||
|
||||
`finalize` relies solely on the operator's explicit confirmation of the write
|
||||
stop; it does not stop or lock any application itself. All writers must stay
|
||||
@@ -149,8 +132,7 @@ next time.
|
||||
|
||||
The diagram shows one migration with the native backend: an intermediate
|
||||
`sync` round, `finalize` and `cleanup`. Application snapshots discovered at
|
||||
the source are transferred like a round, but always with a full scan and
|
||||
without being deleted.
|
||||
the source are transferred like a round, but are never deleted.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
@@ -173,15 +155,10 @@ sequenceDiagram
|
||||
M->>I: open base R(n-1), create pending index
|
||||
M->>S: snapdiff R(n-1) to R(n)
|
||||
|
||||
loop every directory, from the root down
|
||||
M->>S: stat dir, ceph.dir.rctime in R(n) and R(n-1)
|
||||
alt same inode, inode version and rctime (sync rounds only)
|
||||
M->>I: carry subtree entries, marked carried
|
||||
else changed
|
||||
M->>I: record path inventory
|
||||
M->>T: mkdir, copy changed files (blockdiff or full), symlinks, FIFOs
|
||||
M->>T: xattrs and quotas, then setattr and ctime stamp
|
||||
end
|
||||
loop every entry, from the root down
|
||||
M->>I: record path inventory
|
||||
M->>T: mkdir, copy changed files (blockdiff or full), symlinks, FIFOs
|
||||
M->>T: xattrs and quotas, then setattr and ctime stamp
|
||||
end
|
||||
|
||||
M->>T: hardlink aliases, prune surplus entries
|
||||
@@ -201,7 +178,7 @@ sequenceDiagram
|
||||
Note over Op,S: all writers stopped
|
||||
Op->>M: finalize --writers-stopped
|
||||
M->>S: create final snapshot F
|
||||
Note over M,T: same round, but a full scan: no subtree is skipped
|
||||
Note over M,T: same steps as a sync round
|
||||
M->>J: mark F done, R(n) removed
|
||||
M->>S: remove snapshot R(n)
|
||||
M->>T: remove snapshot R(n)
|
||||
@@ -425,9 +402,9 @@ files and short verification ranges. Unchanged owner, mode and timestamps do
|
||||
not trigger another `setattr` call; a target stat read just before is reused
|
||||
for the metadata check. Path and hardlink mappings live on local disk.
|
||||
Snapdiff and blockdiff avoid repeated full transfers and full reads of
|
||||
unchanged file contents. Intermediate rounds skip unchanged subtrees, but
|
||||
`finalize` still scans all metadata, including the full topology and quota
|
||||
check, so the write stop scales with the total number of entries. Renamed
|
||||
unchanged file contents. Every round, `finalize` included, still scans all
|
||||
metadata, including the full topology and quota check, so the write stop
|
||||
scales with the total number of entries. Renamed
|
||||
files may be copied again in full. Single transactions of the native index are not yet optimized
|
||||
for 200 million paths.
|
||||
|
||||
|
||||
@@ -87,10 +87,10 @@ Consequences for cephmig:
|
||||
- With `CEPH_SNAPDIFF_CTIME`, snapdiff2 should report the changes v1 missed
|
||||
in the lab (chmod, xattr changes, writes through a hardlink alias,
|
||||
overwrites with a reset mtime), because all of them change the ctime.
|
||||
- It compares the two snapshots in the MDS, so unlike the rctime shortcut it
|
||||
depends neither on delayed rctime propagation nor on client clocks. It
|
||||
could therefore replace the rctime check in intermediate rounds and, after
|
||||
a lab proof, possibly shorten `finalize`.
|
||||
- It compares the two snapshots in the MDS, so unlike the removed rctime
|
||||
shortcut (see [metadata scan](migration.md#metadata-scan)) it depends
|
||||
neither on delayed rctime propagation nor on client clocks. After a lab
|
||||
proof, it could shorten rounds and possibly `finalize`.
|
||||
- Open: v1 reported every directory, including unchanged ones. The sources
|
||||
do not say whether snapdiff2 behaves differently; without that, it cannot
|
||||
be used to skip subtrees.
|
||||
@@ -128,10 +128,8 @@ state is reconstructed fully and natively. There is no fallback to another
|
||||
transfer method.
|
||||
|
||||
Snapdiff cannot replace the metadata scan (see
|
||||
[skipping unchanged subtrees](migration.md#skipping-unchanged-subtrees)).
|
||||
Intermediate rounds skip subtrees whose recursive ctime did not change;
|
||||
application snapshots and the final round still scan all metadata and check
|
||||
the full hardlink topology.
|
||||
[metadata scan](migration.md#metadata-scan)). Every round scans all metadata
|
||||
and checks the full hardlink topology.
|
||||
Data verification reads all bytes for the first state and only the copied
|
||||
ranges for confirmed later states. Unchanged ranges are taken from the
|
||||
previously verified base. The target must belong exclusively to the
|
||||
|
||||
@@ -70,8 +70,8 @@ Everything the migration promises, without relying on earlier rounds:
|
||||
- the custom metadata of the final snapshot and of the subvolume as it was
|
||||
at `finalize` (the journal holds the values)
|
||||
|
||||
The journal, the native base index and the `carried` markers are not used:
|
||||
the point is an independent check.
|
||||
The journal and the native base index are not used: the point is an
|
||||
independent check.
|
||||
|
||||
## Preconditions and behaviour
|
||||
|
||||
|
||||
Reference in new issue
Block a user