diff --git a/README.md b/README.md index 003b675..57254b3 100644 --- a/README.md +++ b/README.md @@ -1,99 +1,106 @@ -# CephMig: CephFS-Subvolumes zwischen Ceph-Clustern migrieren +# CephMig: migrate CephFS subvolumes between Ceph clusters -Ein Go-Werkzeug, das ein CephFS-Subvolume samt Snapshots, POSIX-ACLs, xattrs, -Quotas und Zeitstempeln von einem Ceph-Cluster in einen anderen kopiert, -während die Anwendung weiterläuft. +A Go tool that copies a CephFS subvolume, including its snapshots, POSIX ACLs, +xattrs, quotas and timestamps, from one Ceph cluster to another while the +application keeps running. -## Beschreibung +## Description -**Warum?** Ein Subvolume soll mit kurzem Schreibstopp in einen neuen Cluster -umziehen. Die Zielgröße liegt bei bis zu 200 TB und mehr als 200 Millionen -Dateien. Ein einfaches Kopieren reicht dafür nicht: Snapshots, Hardlinks und -Ceph-Metadaten müssen erhalten bleiben, und ein abgebrochener Lauf muss sich -fortsetzen lassen. +**Why?** A subvolume has to move to a new cluster with only a short write +stop. The target size is up to 200 TB and more than 200 million files. A +plain copy is not enough: snapshots, hardlinks and Ceph metadata must be +preserved, and an interrupted run must be resumable. -**Wie?** CephMig arbeitet in Runden. Jede Runde überträgt einen konsistenten -Quellsnapshot, prüft das Ziel und legt dort einen gleichnamigen Snapshot an. -Ein Journal auf lokalem Datenträger hält jeden Schritt fest. Für den letzten -Abgleich werden alle Schreiber kurz angehalten. +**How?** CephMig works in rounds. Each round transfers a consistent source +snapshot, verifies the target and creates a snapshot of the same name there. +A journal on local disk records every step. For the last round, all writers +are stopped briefly. -Es gibt zwei Backends: +There are two backends: -- **native** (empfohlen): Der Kopierer spricht direkt über libcephfs mit - beiden Clustern. Er braucht weder rsync noch einen Kernel- oder FUSE-Mount. - Nach der Erstübertragung nutzt er Snapdiff und, wo möglich, Blockdiff. -- **rsync**: Er kopiert zwischen zwei gemounteten CephFS-Dateisystemen. +- **native** (recommended): the copier talks to both clusters directly + through libcephfs. It needs neither rsync nor a kernel or FUSE mount. + After the initial transfer it uses snapdiff and, where possible, blockdiff. +- **rsync**: copies between two mounted CephFS file systems. -**Status:** Prototyp. Die Funktionen sind im lokalen Labor geprüft. -Lastnachweise für die Zielgröße und die produktive Umschaltung fehlen noch. +**Status:** prototype. The features are verified in the local lab. Load +tests at the target size and a production cutover are still missing. -> **Dokumentierte Abweichungen:** Native Snapshot-IDs und Snapshot-Erstellungszeiten -> werden am Ziel neu vergeben. mtime, atime, ctime und Erstellungszeit (btime) -> der Dateien übernimmt das native Backend von der Quelle; die ctime nie -> kleiner als die mtime. Die ursprünglichen Snapshot-Erstellungszeiten stehen -> im Journal. +> **Documented deviations:** native snapshot IDs and snapshot creation times +> are assigned anew at the target. The native backend takes mtime, atime, +> ctime and birth time (btime) of every file from the source; the ctime is +> never lower than the mtime. The original snapshot creation times are kept +> in the journal. > Details: [docs/migration.md](docs/migration.md). ## Installation -Voraussetzungen: +Requirements: -- Linux, Go ab 1.25 und GNU Make -- für das native Backend und die Laborumgebung: Docker Engine mit Docker - Compose sowie `/dev/fuse` auf dem Docker-Host -- für die Laborumgebung: bis zu 12 GiB RAM für Container und etwa 8 GiB - Speicherplatz für die zwei OSDs, dazu Platz für die Images +- Linux, Go 1.25 or later and GNU Make +- for the native backend and the lab: Docker Engine with Docker Compose and + `/dev/fuse` on the Docker host +- for the lab: up to 12 GiB RAM for the containers and about 8 GiB of disk + space for the two OSDs, plus space for the images -Quellcode holen und bauen: +Get the source and build it: ```sh git clone ssh://git@git.zb-server.de:30022/Sebi/CephfsMig.git cd CephfsMig -make doctor # prüft Go, Docker und Docker Compose -make build # erzeugt bin/cephmig (nur rsync-Backend) -make check # go vet, Go-Tests und Syntaxprüfung der Testskripte +make doctor # checks Go, Docker and Docker Compose +make build # builds bin/cephmig (rsync backend only) +make check # go vet, Go tests and a syntax check of the test scripts ``` -Das native Backend braucht CGO und die libcephfs-Header. Es wird deshalb in -einem Container gebaut. Dabei laufen auch die Go-Tests mit Race Detector: +The native backend needs CGO and the libcephfs headers, so it is built in a +container. The build also runs the Go tests with the race detector: ```sh -make dev-native-build # erzeugt das Image cephmig-native:dev +make dev-native-build # builds the image cephmig-native:dev ``` -## Verwendung +## Usage ```text cephmig doctor cephmig inspect --config FILE cephmig sync --config FILE --state FILE cephmig finalize --config FILE --state FILE --writers-stopped +cephmig cleanup --config FILE --state FILE cephmig status --state FILE ``` -| Kommando | Wirkung | -|------------|-------------------------------------------------------------------------| -| `inspect` | prüft Quelle und Ziel, ohne etwas zu ändern | -| `sync` | überträgt den aktuellen Stand; beliebig oft wiederholbar | -| `finalize` | letzter Abgleich nach dem Schreibstopp, danach bereit zur Umschaltung | -| `status` | gibt das Journal aus | +| Command | Effect | +|------------|----------------------------------------------------------------------| +| `inspect` | checks source and target without changing anything | +| `sync` | transfers the current state; can be repeated any number of times | +| `finalize` | last round after the write stop, then ready for cutover | +| `cleanup` | deletes the snapshots cephmig created, at source and target | +| `status` | prints the journal | -Alle Ergebnisse erscheinen als JSON auf der Standardausgabe. Die State-Datei -muss außerhalb der CephFS-Mounts liegen. +All results are written to standard output as JSON. The state file must be +outside the CephFS mounts. -Ablauf einer Migration: +Steps of a migration: -1. Mit `inspect` Quelle, Ziel, Berechtigungen und Kapazität prüfen. -2. Mit `sync` bei laufender Anwendung initial kopieren. -3. `sync` wiederholen, um Änderungen nachzuziehen. -4. Alle schreibenden Anwendungen anhalten, dann `finalize --writers-stopped`. -5. Clients auf das Ziel umstellen und Anwendungen freigeben. +1. Check source, target, permissions and capacity with `inspect`. +2. Make the initial copy with `sync` while the application keeps running. +3. Repeat `sync` to catch up with changes. +4. Stop all writing applications, then run `finalize --writers-stopped`. +5. Switch the clients to the target and release the applications. +6. Once the cutover is checked, remove the migration snapshots with `cleanup`. -Ein Dateisystemsnapshot macht eine Datenbank nicht anwendungskonsistent. -Der Schreibstopp muss alle Clients umfassen. +A file system snapshot does not make a database application-consistent. The +write stop must cover all clients. -Die Konfiguration ist eine JSON-Datei, hier -[dev/migration.example.json](dev/migration.example.json) aus dem Labor: +Each round creates a snapshot `cephmig--` at source and target; +`sync` deletes the older ones as soon as a newer round is complete. Users of +the subvolume therefore see at most one such snapshot during the migration, +and none after `cleanup`. Application snapshots are never deleted. + +The configuration is a JSON file, here +[dev/migration.example.json](dev/migration.example.json) from the lab: ```json { @@ -118,75 +125,75 @@ Die Konfiguration ist eine JSON-Datei, hier } ``` -Optional sind außerdem `user` (Ceph-Client-Identität, z. B. `client.migration`) -und `workers` (0 bis 64; 0 wählt den Standard). `mount` ist nur für das -rsync-Backend nötig: dort der Mount des Dateisystem-Wurzelverzeichnisses. +Optional fields are `user` (Ceph client identity, e.g. `client.migration`) +and `workers` (0 to 64; 0 selects the default). `mount` is only needed for +the rsync backend: the mount of the file system root. -## Beispiele +## Examples -Die Laborumgebung startet zwei unabhängige Ceph-Cluster (Ceph 21.2.0) in -Docker und führt die Migration darin aus: +The lab starts two independent Ceph clusters (Ceph 21.2.0) in Docker and runs +the migration between them: ```sh -make dev-up # Cluster starten -make dev-status # Zustand beider Cluster -make dev-smoke # Smoke-Test: Snapshot, ACLs, xattrs, Hardlinks, Quotas -make dev-native-test # nativer Funktionstest +make dev-up # start the clusters +make dev-status # state of both clusters +make dev-smoke # smoke test: snapshot, ACLs, xattrs, hardlinks, quotas +make dev-native-test # native functional test docker compose -f dev/compose.yaml exec native cephmig-native inspect \ --config /lab/migration.example.json -make dev-down # stoppen; die Daten bleiben erhalten +make dev-down # stop; the data is kept ``` -Weitere Tests: +More tests: -| Ziel | Inhalt | -|----------------------------|--------------------------------------------------------------| -| `make dev-migration-test` | Migration mit dem rsync-Backend | -| `make dev-smallfiles-test` | 10.000 kleine Dateien (`FILES=2000` begrenzt die Anzahl) | -| `make dev-million-start` | eine Million Dateien mit vier Snapshot-Ständen | -| `make dev-restart-check` | Neustart des Labors; FSIDs und Daten bleiben erhalten | +| Target | Content | +|----------------------------|-----------------------------------------------------------| +| `make dev-migration-test` | migration with the rsync backend | +| `make dev-smallfiles-test` | 10,000 small files (`FILES=2000` limits the number) | +| `make dev-million-start` | one million files with four snapshot states | +| `make dev-restart-check` | restart of the lab; FSIDs and data are preserved | -Ergebnisse dokumentierter Läufe: [docs/smallfiles-local.md](docs/smallfiles-local.md) -und [docs/million-local.md](docs/million-local.md). +Results of documented runs: [docs/smallfiles-local.md](docs/smallfiles-local.md) +and [docs/million-local.md](docs/million-local.md). -## Projektstruktur +## Project structure ```text . ├── cmd/ -│ ├── cephmig/ Kommandozeilenprogramm -│ └── nativeprobe/ Diagnosewerkzeug für die libcephfs-Anbindung +│ ├── cephmig/ command-line program +│ └── nativeprobe/ diagnostic tool for the libcephfs binding ├── internal/ -│ ├── migration/ Migrationsablauf, Journal, rsync- und native Übertragung -│ ├── storage/ Dateisystem-Schnittstelle des nativen Kopierers -│ └── cephfsnative/ CGO-Anbindung an libcephfs (Build-Tag ceph) -├── dev/ Laborumgebung: Compose-Dateien, Dockerfiles, Testskripte -├── docs/ Ausführliche Dokumentation und Messergebnisse -└── Makefile Build-, Prüf- und Laborziele +│ ├── migration/ migration workflow, journal, rsync and native transfer +│ ├── storage/ file system interface of the native copier +│ └── cephfsnative/ CGO binding to libcephfs (build tag ceph) +├── dev/ lab: Compose files, Dockerfiles, test scripts +├── docs/ detailed documentation and measurements +└── Makefile build, check and lab targets ``` -## Dokumentation +## Documentation -- [docs/migration.md](docs/migration.md): Kommandos, Grenzen und Nachweise -- [docs/lab.md](docs/lab.md): Laborumgebung im Detail, Ceph-Version, bekannte Warnungen -- [docs/raw-transfer.md](docs/raw-transfer.md): direkter RADOS-Import und Grenzen der nativen Implementierung -- API-Dokumentation der Go-Pakete: `go doc -all ./internal/migration` +- [docs/migration.md](docs/migration.md): commands, limits and evidence +- [docs/lab.md](docs/lab.md): the lab in detail, Ceph version, known warnings +- [docs/raw-transfer.md](docs/raw-transfer.md): direct RADOS import and limits of the native implementation +- API documentation of the Go packages: `go doc -all ./internal/migration` -## Mitwirken +## Contributing -- Go-Code folgt [Effective Go](https://go.dev/doc/effective_go) und ist mit - `gofmt` formatiert. Exportierte Bezeichner haben Doc-Kommentare. -- Vor jedem Commit `make check` ausführen. -- Commit-Nachrichten folgen [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/), - zum Beispiel `feat(migration): add bandwidth limit` oder - `fix(native): retry on EEXIST`. Inkompatible Änderungen werden mit `!` - und einem `BREAKING CHANGE:`-Footer gekennzeichnet. +- Go code follows [Effective Go](https://go.dev/doc/effective_go) and is + formatted with `gofmt`. Exported identifiers have doc comments. +- Run `make check` before every commit. +- Commit messages follow [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/), + for example `feat(migration): add bandwidth limit` or + `fix(native): retry on EEXIST`. Breaking changes are marked with `!` and a + `BREAKING CHANGE:` footer. -## Lizenz +## License -Bisher ist keine Lizenz festgelegt. Ohne Lizenz gilt: alle Rechte vorbehalten. +No license has been chosen yet. Without a license, all rights are reserved. -## Kontakt +## Contact -Sebastian Unterschütz. Fragen und Fehlermeldungen bitte als Issue im -Repository [Sebi/CephfsMig](https://git.zb-server.de/Sebi/CephfsMig). +Sebastian Unterschütz. Please report questions and bugs as issues in the +repository [Sebi/CephfsMig](https://git.zb-server.de/Sebi/CephfsMig). diff --git a/docs/lab.md b/docs/lab.md index 10bb217..1b10961 100644 --- a/docs/lab.md +++ b/docs/lab.md @@ -1,108 +1,110 @@ -# Lokale Laborumgebung +# Local lab -Diese Seite beschreibt die Docker-Compose-Umgebung unter `dev/` mit zwei -unabhängigen Ceph-Clustern. Einstieg und Kurzüberblick: [README](../README.md). +This page describes the Docker Compose environment under `dev/` with two +independent Ceph clusters. Introduction and overview: [README](../README.md). -## Aufbau und Dienste +## Layout and services -Der Dienst `native` läuft ohne privilegierten Modus, ohne `/dev/fuse` und ohne -CephFS-Mounts. Der separate privilegierte `client` dient als unabhängiger -Anwendungsclient und für den rsync-Vergleichstest. +The service `native` runs without privileged mode, without `/dev/fuse` and +without CephFS mounts. The separate privileged `client` serves as an +independent application client and for the rsync comparison test. -`make dev-smallfiles-test` prüft standardmäßig 10.000 Dateien mit jeweils -128 Byte Inhalt, zusätzlich Hardlinks und Symlinks. Die Hälfte der Dateien -liegt in einem großen Verzeichnis, die andere verteilt auf 50 Unterverzeichnisse. -Der Test misst Erstübertragung, Änderungsabgleich und finalen Abgleich einschließlich -Prüfung. Ein separater Anwendungsclient vergleicht danach alle Inhalte, Metadaten -und Snapshot-Stände. Berichte liegen unter `/tmp/cephmig-smallfiles-report`; -erfolgreiche Testdaten und Snapshots werden entfernt. Die Dateianzahl lässt sich -beispielsweise mit `FILES=2000 make dev-smallfiles-test` begrenzen. -Ein dokumentierter lokaler Lauf einschließlich Vorher-/Nachher-Zählern für -MDS-Anfragen steht in [docs/smallfiles-local.md](smallfiles-local.md). -Der getrennte Test mit einer Million Dateien und vier Snapshot-Ständen wird -mit `make dev-million-start` gestartet; Speicherbedarf, Status und Bereinigung -stehen in [docs/million-local.md](million-local.md). -VCS-Stamping ist im Build deaktiviert, damit auch ein -Quellverzeichnis ohne nutzbare Git-Metadaten gebaut werden kann. +`make dev-smallfiles-test` checks 10,000 files of 128 bytes each by default, +plus hardlinks and symlinks. Half of the files are in one large directory, +the other half spread over 50 subdirectories. The test measures the initial +transfer, the catch-up round and the final round including verification. A +separate application client then compares all contents, metadata and +snapshot states. Reports are written to `/tmp/cephmig-smallfiles-report`; +test data and snapshots of a successful run are removed. The number of files +can be limited, for example with `FILES=2000 make dev-smallfiles-test`. +A documented local run including before/after counters of MDS requests is in +[docs/smallfiles-local.md](smallfiles-local.md). +The separate test with one million files and four snapshot states is started +with `make dev-million-start`; disk requirements, status and cleanup are +described in [docs/million-local.md](million-local.md). +VCS stamping is disabled in the build, so that a source directory without +usable Git metadata can also be built. -Der Smoke-Test erstellt einen Subvolume-Snapshot, verändert danach die Quelle -und kopiert den unveränderten Snapshot zum Ziel. Er prüft Inhalte, Dateirechte, -POSIX-ACLs, ein Benutzer-xattr, Hardlinks, Symlinks, Quota-Operationen und die -Isolation der beiden Cluster. `make dev-restart-check` startet das Labor neu -und prüft, dass FSIDs und Daten beider Subvolumes erhalten bleiben. -Die Sparse-Testdatei wird auf ihren Inhalt geprüft; die physische Platzbelegung -ist keine Zusicherung dieses Tests. +The smoke test creates a subvolume snapshot, then changes the source and +copies the unchanged snapshot to the target. It checks contents, file modes, +POSIX ACLs, a user xattr, hardlinks, symlinks, quota operations and the +isolation of the two clusters. `make dev-restart-check` restarts the lab and +checks that the FSIDs and the data of both subvolumes are preserved. The +sparse test file is checked for its content; physical space usage is not +asserted by this test. -`source` und `target` sind unabhängige Ceph-Cluster mit unterschiedlichen FSIDs -und Schlüsseln. Jeder enthält MON, MGR, OSD und MDS sowie das Dateisystem -`cephfs`, die Subvolume-Gruppe `migration` und das Subvolume `demo`. -Der Client mountet diese Subvolumes unter `/mnt/source` und `/mnt/target`. -Für die von der Ceph-API gelieferten Snapshotpfade ist das Quelldateisystem -zusätzlich unter `/mnt/source-fs` und das Ziel unter `/mnt/target-fs` gemountet; -Subvolume-Snapshots liegen außerhalb -des aktuellen Daten-UUID-Verzeichnisses. -Es werden keine Host-Geräte formatiert und keine Ports am Host veröffentlicht. -Die OSD-Daten liegen in Docker-Volumes. Die Replikationszahl 1 und die -Administratorschlüssel im Testclient dienen ausschließlich dem lokalen Labor. -Der Client ergänzt das feste Ceph-Basisimage um die festgeschriebene -rsync-Paketversion. Das Journal kann unter `/state` in einem eigenen -Docker-Volume dauerhaft gespeichert werden. +`source` and `target` are independent Ceph clusters with different FSIDs and +keys. Each contains a MON, MGR, OSD and MDS as well as the file system +`cephfs`, the subvolume group `migration` and the subvolume `demo`. The +client mounts these subvolumes at `/mnt/source` and `/mnt/target`. For the +snapshot paths returned by the Ceph API, the source file system is also +mounted at `/mnt/source-fs` and the target at `/mnt/target-fs`; subvolume +snapshots live outside the current data UUID directory. +No host devices are formatted and no ports are published on the host. The +OSD data lives in Docker volumes. The replication factor 1 and the +administrator keys in the test client are for the local lab only. The client +extends the pinned Ceph base image with a pinned rsync package version. The +journal can be stored permanently under `/state` in a dedicated Docker +volume. ```sh -# Status und Logs +# Status and logs docker compose -f dev/compose.yaml logs --tail 100 source target client -# Ceph CLI gegen den Quellcluster +# Ceph CLI against the source cluster docker compose -f dev/compose.yaml exec source ceph fs subvolume info cephfs demo --group_name migration -# Stoppen; die Daten bleiben für den nächsten Start erhalten +# Stop; the data is kept for the next start make dev-down ``` -Für einen vollständig frischen Testlauf löscht -`docker compose -f dev/compose.yaml down --volumes` **alle Labordaten**. -Das Basisimage lässt sich mit `CEPH_IMAGE=quay.io/ceph/ceph:` ändern. -Die Dockerfiles enthalten Paket- und SDK-Pins für Ceph 21.2.0 / EL10; bei einem -Versionswechsel müssen diese passend angepasst werden. -Die Baseline ist Ceph Umbrella 21.2.0 gemäß der -[offiziellen Releaseübersicht](https://docs.ceph.com/en/latest/releases/), -geprüft am 05.11.2026. -Das veröffentlichte Containerimage trägt intern den Versionszusatz `dev`; -für die Reproduzierbarkeit ist zusätzlich der Image-Digest festgeschrieben. -Der Bootstrap legt die Pools mit expliziten PG-Zahlen an, da das Standardkommando -`fs volume create` in diesem Image mit `EINVAL` scheiterte. +For a completely fresh test run, +`docker compose -f dev/compose.yaml down --volumes` deletes **all lab data**. +The base image can be changed with `CEPH_IMAGE=quay.io/ceph/ceph:`. +The Dockerfiles contain package and SDK pins for Ceph 21.2.0 / EL10; they +must be adjusted when the version changes. The Go toolchain of the native +image comes from a pinned `golang` image. +The baseline is Ceph Umbrella 21.2.0 according to the +[official release overview](https://docs.ceph.com/en/latest/releases/), +checked on 2026-11-05. +The published container image internally carries the version suffix `dev`; +for reproducibility, the image digest is pinned as well. +The bootstrap creates the pools with explicit PG counts, because the default +command `fs volume create` failed with `EINVAL` in this image. -`ceph health detail` kann im Labor `POOL_NO_REDUNDANCY` (ein OSD) und -`MON_DISK_LOW` (weniger als 30 % freier Platz im Host-Dateisystem) melden. -Diese Meldungen werden nicht unterdrückt. Container-Healthchecks prüfen die -Nutzbarkeit des Subvolumes; sie ersetzen keine Produktions-Healthchecks. +`ceph health detail` can report `POOL_NO_REDUNDANCY` (one OSD) and +`MON_DISK_LOW` (less than 30 % free space in the host file system) in the +lab. These messages are not suppressed. Container health checks verify that +the subvolume is usable; they do not replace production health checks. -## Zielgröße und Grenzen +## Target size and limits -Zielgröße: bis zu 200 TB und mehr als 200 Millionen Dateien, einschließlich -vorhandener Snapshots, POSIX-ACLs, xattrs und Quotas. Pro Node stehen zwei -25-Gbit/s-Verbindungen zur Verfügung; effektiver Durchsatz und eine feste -Obergrenze für den Schreibstopp werden später bestimmt. Die lokale Umgebung prüft -Funktionen, bildet diese Datenmenge jedoch nicht ab. Der native Kopierer verwendet -begrenzte Worker und Puffer, einen dauerhaften Index auf lokalem Datenträger und -optionale Bandbreitendrosselung. Vollständige Metadatenscans bleiben erforderlich. -Ein Nachweis für Speicher, Indexgröße, Laufzeit und finalen Schreibstopp fehlt. +Target size: up to 200 TB and more than 200 million files, including existing +snapshots, POSIX ACLs, xattrs and quotas. Each node has two 25 Gbit/s links; +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. +Full metadata scans remain necessary. Evidence for memory, index size, +runtime and the final write stop is missing. -1. Quelle, Ziel, Berechtigungen, Kapazität und benötigte Metadaten prüfen. -2. Konsistenten Quellsnapshot erstellen und initial bei laufender Anwendung kopieren. -3. Änderungen mit weiteren Snapshots und Abgleichen nachziehen. -4. Alle schreibenden Anwendungen anhalten, offene Schreibvorgänge abschließen, - letzten Snapshot übertragen und Daten sowie Metadaten verifizieren. -5. Clients auf das Ziel ummounten und Anwendungen freigeben. +1. Check source, target, permissions, capacity and required metadata. +2. Create a consistent source snapshot and make the initial copy while the + application keeps running. +3. Catch up with changes through further snapshots and rounds. +4. Stop all writing applications, complete pending writes, transfer the last + snapshot and verify data and metadata. +5. Remount the clients on the target and release the applications. +6. Remove the migration snapshots with `cephmig cleanup`. -Ein Dateisystemsnapshot allein stellt keine Anwendungskonsistenz für Datenbanken -her. Der finale Schreibstopp muss alle Clients umfassen. Ein Umhängen eines -Mounts übernimmt keine bereits offenen Dateideskriptoren. Nach ersten -Schreibzugriffen am Ziel benötigt ein Rückwechsel einen erneuten Abgleich. -Die derzeit implementierte Datenübertragung ist im Labormodus prüfbar; -produktive Umschaltung und Lastnachweise für die Zielgröße sind noch offen. +A file system snapshot alone does not make databases application-consistent. +The final write stop must cover all clients. Moving a mount does not carry +over file descriptors that are already open. After the first writes to the +target, switching back requires another round. +The data transfer implemented so far can be verified in lab mode; a +production cutover and load tests at the target size are still open. -Die Umgebung folgt dem -[manuellen Ceph-Bootstrap](https://docs.ceph.com/en/latest/install/manual-deployment/). -Die Einordnung des direkten RADOS-Objektimports und die Grenzen der nativen -Implementierung stehen in [docs/raw-transfer.md](raw-transfer.md). +The environment follows the +[manual Ceph bootstrap](https://docs.ceph.com/en/latest/install/manual-deployment/). +The assessment of a direct RADOS object import and the limits of the native +implementation are in [docs/raw-transfer.md](raw-transfer.md). diff --git a/docs/migration.md b/docs/migration.md index 2211109..652c261 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -1,58 +1,57 @@ -# Migrationsprototyp +# Migration prototype -Die Prüfung eines direkten RADOS-Objekttransfers und die native Alternative -über libcephfs sind in [raw-transfer.md](raw-transfer.md) dokumentiert. +The evaluation of a direct RADOS object transfer and the native alternative +through libcephfs are documented in [raw-transfer.md](raw-transfer.md). -## Snapshot-Identität: dokumentierte Abweichung +## Snapshot identity: documented deviation -Native Snapshot-IDs und Ceph-Geburtszeitpunkte werden am Ziel neu vergeben. -Wie vereinbart blockiert diese Abweichung die Migration nicht. `inspect`, -die Übertragungsausgabe und das persistente Journal enthalten einen Hinweis; -ursprüngliche und neue Erstellungszeiten stehen bei jedem übertragenen Snapshot. -Eine Anwendung, die native IDs direkt speichert, muss die neuen Werte beachten. +Native snapshot IDs and Ceph birth times are assigned anew at the target. As +agreed, this deviation does not block the migration. `inspect`, the transfer +output and the persistent journal contain a note; the original and the new +creation times are recorded for every transferred snapshot. An application +that stores native IDs directly must account for the new values. -Die unterstützte `ceph_mksnap`-Schnittstelle nimmt Namen, Modus und -benutzerdefinierte Metadaten entgegen, aber keine gewünschte native ID oder -Geburtszeit. `ceph.snap.btime` ist im Client ausdrücklich schreibgeschützt. -Auch CephFS-Mirroring erzeugt im Ziel einen neuen Snapshot und hält die -Quell-ID als separate Metadaten fest. +The supported `ceph_mksnap` interface accepts a name, a mode and custom +metadata, but no desired native ID or birth time. `ceph.snap.btime` is +explicitly read-only in the client. CephFS mirroring also creates a new +snapshot at the target and records the source ID as separate metadata. -Quellen: +Sources: -- [libcephfs-Schnittstelle](https://github.com/ceph/ceph/blob/main/src/include/cephfs/libcephfs.h) -- [Client: virtuelle Snapshot-Attribute](https://github.com/ceph/ceph/blob/main/src/client/Client.cc) -- [Mirror: Anlegen eines Zielsnapshots](https://github.com/ceph/ceph/blob/main/src/tools/cephfs_mirror/PeerReplayer.cc) +- [libcephfs interface](https://github.com/ceph/ceph/blob/main/src/include/cephfs/libcephfs.h) +- [Client: virtual snapshot attributes](https://github.com/ceph/ceph/blob/main/src/client/Client.cc) +- [Mirror: creating a target snapshot](https://github.com/ceph/ceph/blob/main/src/tools/cephfs_mirror/PeerReplayer.cc) -Im lokalen Ceph-21.2.0-Labor wurden bei einem gleichnamigen Snapshot -Quell-ID 6 und Ziel-ID 2 sowie unterschiedliche Geburtszeiten gemessen. -Ein Schreibversuch mit dem bereits vorhandenen Wert von `ceph.snap.btime` -am eigenen Testsnapshot wurde mit `EROFS` abgewiesen. +In the local Ceph 21.2.0 lab, a snapshot of the same name had source ID 6 and +target ID 2 and different birth times. An attempt to write the existing value +of `ceph.snap.btime` on our own test snapshot was rejected with `EROFS`. -Mit den geprüften Schnittstellen lässt sich die native Snapshot-Identität nicht -vorgeben. Diese Einschränkung ist akzeptiert; sie wird ausdrücklich vermerkt. -Lastnachweise und eine automatisierte produktive Client-Umschaltung fehlen noch. +The examined interfaces do not allow the native snapshot identity to be set. +This limitation is accepted and explicitly recorded. Load tests and an +automated production client cutover are still missing. -## Kommandos +## Commands -Das native Backend benötigt Linux, Ceph CLI, libcephfs und einen mit CGO und -`-tags ceph` gebauten Kopierer. Es benötigt keine Betriebssystem-Mounts und -keinen privilegierten Container. Zum Erhalten fremder UID/GID und geschützter -xattrs sind entsprechende Client-/Prozessrechte nötig; das Labor verwendet root. -Der optionale Referenzpfad `backend: rsync` benötigt zusätzlich rsync und am -Dateisystem-Root gemountete Quell-/Zieldateisysteme. -Die Subvolumes müssen schon existieren. Für einen neuen Job müssen Datenbaum, -Snapshots und benutzerdefinierte Metadaten des Ziels leer sein. -Keine Anwendung darf ins Ziel schreiben. +The native backend needs Linux, the Ceph CLI, libcephfs and a copier built +with CGO and `-tags ceph`. It needs no operating system mounts and no +privileged container. Preserving foreign UID/GID and protected xattrs requires +the corresponding client and process privileges; the lab uses root. The +optional reference path `backend: rsync` additionally needs rsync and source +and target file systems mounted at the file system root. +The subvolumes must already exist. For a new job, the data tree, snapshots and +custom metadata of the target must be empty. No application may write to the +target. -Die Konfiguration in `dev/migration.example.json` wählt `backend: native` und -gilt im Labordienst `native`. `mount` wird dort nicht verwendet und kann fehlen. -`workers` begrenzt gleichzeitige Dateikopien (Standard 8, maximal 64), -`bandwidth_kib` begrenzt die Summe geschriebener Nutzdatenbytes pro Sekunde. -Beide Werte dürfen bei Wiederaufnahme geändert werden. -Die nativen `transfer`-Statistiken im Journal nennen Modus, Basis-Snapshot, -besuchte/kopierte Dateien sowie geschriebene und zur Prüfung gelesene Bytes. -`bytes_copied` zählt Nutzdaten-Schreibzugriffe ohne ausgesparte Nullbereiche; -es misst nicht das gesamte Netzwerkaufkommen einschließlich Protokoll und Prüfung. +The configuration in `dev/migration.example.json` selects `backend: native` +and applies to the lab service `native`. `mount` is not used there and may be +omitted. `workers` limits concurrent file copies (default 8, at most 64), +`bandwidth_kib` limits the total payload bytes written per second. Both values +may be changed when resuming. +The native `transfer` statistics in the journal report the mode, the base +snapshot, visited and copied files, and bytes written and read for +verification. `bytes_copied` counts payload writes without skipped zero +ranges; it does not measure the total network traffic including protocol and +verification. ```sh make dev-native-build @@ -61,194 +60,212 @@ docker compose -f dev/compose.yaml exec native \ cephmig-native inspect --config /lab/migration.example.json ``` -Der lesende Preflight vergleicht CLI-FSID und die über den Client gelesene -`ceph.cluster_fsid`, prüft Pfade und Subvolume-Status und meldet die aktuelle -Datenmenge sowie Snapshotnamen. Die Datenmenge ist **keine** Kapazitätsprognose -für alle historischen Snapshots. +The read-only preflight compares the FSID from the CLI with the +`ceph.cluster_fsid` read through the client, checks paths and subvolume state +and reports the current data size and snapshot names. The data size is **not** +a capacity forecast for all historical snapshots. -Das Backend hat folgende Übertragungskommandos: +The backend has the following transfer commands: ```sh cephmig sync --config /absolute/config.json --state /local-state/job.json cephmig status --state /local-state/job.json -# Alle Quellwriter einschließlich weiterer Clients stoppen und flushen. +# Stop and flush all source writers, including other clients. cephmig finalize --config /absolute/config.json \ --state /local-state/job.json --writers-stopped +# After the cutover has been checked: +cephmig cleanup --config /absolute/config.json --state /local-state/job.json ``` -`sync` verarbeitet bekannte, noch nicht abgeschlossene Stände, neu entdeckte -Anwendungssnapshots und danach einen neuen Quellsnapshot. Weitere Änderungen -werden durch erneutes `sync` nachgezogen. Das native Backend verwendet Snapdiff -und die Ceph-Inode-Version; dadurch werden auch Datenänderungen gleicher Größe -und gleicher mtime erkannt. Der rsync-Pfad verwendet Prüfsummen. +`sync` processes known, unfinished states, newly discovered application +snapshots and then a new source snapshot. Further changes are caught up by +running `sync` again. The native backend uses snapdiff and the Ceph inode +version, so it also detects data changes with the same size and mtime. The +rsync path uses checksums. -`finalize` bestätigt den Schreibstopp ausschließlich über die ausdrückliche -Operatorangabe; es stoppt oder sperrt selbst keine Anwendung. Alle Writer -müssen bis zur abgeschlossenen Umschaltung gestoppt bleiben. Der Job endet -bei `ready-for-cutover`. Remounts, Neustarts der Anwendungen und eine -Rückmigration nach Schreibzugriffen am Ziel sind nicht automatisiert. +`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 +stopped until the cutover is complete. The job ends in `ready-for-cutover`. +Remounts, application restarts and a migration back after writes to the +target are not automated. -## Übertragene Daten +### Migration snapshots -- Snapshotnamen und Inhalte; bestehende Snapshots werden chronologisch übertragen. -- Numerische UID/GID, Modus, POSIX-ACLs einschließlich Default-ACLs. -- Zeitstempel je Datei, Verzeichnis und Symlink: +Each round creates a snapshot `cephmig--` at source and target. +Only the newest one is needed, as base for the next round. As soon as a round +is complete, `sync` deletes the older round snapshots on both sides. Users of +the subvolume therefore see at most one migration snapshot at a time. - | Zeitstempel | native | rsync | +`cleanup` deletes the remaining round snapshot, including the final one, +after the job is `ready-for-cutover`. Afterwards the subvolumes hold only the +snapshots of the application. Since the final snapshot is the immutable +reference of the last round, run `cleanup` only after the cutover has been +checked. `cleanup` is idempotent. + +Application snapshots are never deleted. The journal marks a snapshot as +`removed` before deleting it, so an interrupted run completes the deletion +next time. + +## Transferred data + +- Snapshot names and contents; existing snapshots are transferred in + chronological order. +- Numeric UID/GID, mode, POSIX ACLs including default ACLs. +- Timestamps of every file, directory and symlink: + + | Timestamp | native | rsync | | --- | --- | --- | - | mtime (letzte Änderung) | ja | ja | - | btime (Erstellung) | ja | nein | - | atime (letzter Zugriff) | ja | nein | - | ctime (letzte Statusänderung) | ja¹ | nein | + | mtime (last modification) | yes | yes | + | btime (creation) | yes | no | + | atime (last access) | yes | no | + | ctime (last status change) | yes¹ | no | - ¹ Nanosekundengenau, aber nie kleiner als die mtime: Ist an der Quelle die - mtime neuer als die ctime (mtime in die Zukunft gesetzt), erhält das Ziel + ¹ To the nanosecond, but never lower than the mtime: if the source mtime is + newer than its ctime (mtime set into the future), the target gets ctime = mtime. - Keine Dateisystemschnittstelle setzt die ctime direkt; Ceph 21.2.0 ignoriert - `CEPH_SETATTR_CTIME`. Der MDS übernimmt als ctime aber den Zeitstempel, den - der Client mit jeder Anfrage schickt, und libcephfs liest ihn aus - `clock_gettime(CLOCK_REALTIME)`. Das native Backend ersetzt `clock_gettime` - im eigenen Prozess (Symbol-Interposition, nur im aufrufenden Thread und nur - für die Dauer eines libcephfs-Aufrufs; die Go-Laufzeit liest die Uhr über - den vDSO und ist nicht betroffen): + No file system interface sets the ctime directly; Ceph 21.2.0 ignores + `CEPH_SETATTR_CTIME`. The MDS does, however, take the ctime from the time + stamp the client sends with each request, and libcephfs reads that stamp + from `clock_gettime(CLOCK_REALTIME)`. The native backend replaces + `clock_gettime` in its own process (symbol interposition, only in the + calling thread and only for the duration of one libcephfs call; the Go + runtime reads the clock through the vDSO and is not affected): - - Jeder ändernde Aufruf läuft mit dem Zeitstempel 1970-01-01T00:00:01Z. - - Als letzte Änderung eines Eintrags legt das Backend das xattr - `user.cephmig.ctime` an und entfernt es wieder, mit der Quell-ctime als - Zeitstempel. Der MDS setzt dabei ctime = max(Zeitstempel, mtime), auch - rückwärts. Setattr und Cap-Flushes bewegen die ctime dagegen nur vorwärts. - - Verzeichnisse werden nach allen Änderungen ihrer Kinder gestempelt, - Hardlinks nach dem Verlinken und nach dem Entfernen überzähliger Namen. - - Der Client, der schreibt, cacht für Verzeichnisse teils eine abweichende - ctime. Die Prüfung vor der Veröffentlichung liest das Ziel deshalb über - einen eigenen, frisch verbundenen Client. + - Every modifying call runs with the time stamp 1970-01-01T00:00:01Z. + - As the last change to an entry, the backend creates and removes the xattr + `user.cephmig.ctime`, stamped with the source ctime. The MDS then sets + ctime = max(stamp, mtime), also backwards. Setattr and cap flushes, in + contrast, only move the ctime forward. + - Directories are stamped after all changes to their children, hardlinks + after linking and after removing surplus names. + - The writing client sometimes caches a different ctime for directories. + The verification before publication therefore reads the target through a + separate, freshly connected client. - Das Verhalten ist im Labor gemessen, nicht von Ceph zugesichert; die - Prüfung meldet jede Abweichung. Die atime im Ziel ändert sich danach durch - normale Lesezugriffe der Anwendung. rsync kann unter Linux keine btime - übertragen; atime wird nicht übernommen, weil die Prüfsummenprüfung über - den Mount die atime im Ziel verändern kann. -- Benutzer-xattrs und weitere portable xattrs; einschließlich leerer Werte und Löschungen. -- Hardlinks innerhalb des Subvolumes, Symlinks und FIFOs. -- Sparse-Dateiinhalte; der native Pfad überspringt Nullbereiche bzw. verwendet Hole-Punching. - Die physische Platzbelegung wird nicht zugesichert. -- Verzeichnisquotas `ceph.quota.max_bytes` und `ceph.quota.max_files`, auch am Datenroot. -- Benutzerdefinierte Subvolume- und Snapshot-Metadaten über die Manager-API. -- Ursprüngliche und neue Snapshot-Erstellungszeiten im Journal. + This behaviour was measured in the lab and is not guaranteed by Ceph; the + verification reports every deviation. The atime at the target subsequently + changes through normal reads of the application. rsync cannot transfer the + btime on Linux; the atime is not transferred because the checksum + verification through the mount can change the target atime. +- User xattrs and other portable xattrs, including empty values and removals. +- Hardlinks within the subvolume, symlinks and FIFOs. +- Sparse file contents; the native path skips zero ranges or punches holes. + The physical space usage is not guaranteed. +- Directory quotas `ceph.quota.max_bytes` and `ceph.quota.max_files`, also at + the data root. +- Custom subvolume and snapshot metadata through the manager API. +- Original and new snapshot creation times in the journal. -Softlinks bleiben als Linktext erhalten, auch wenn das Ziel nicht existiert. -Der native Pfad erhält auch Hardlinks auf Symlinks und FIFOs; bei Symlinks -verknüpft er die Inode über die öffentliche Low-Level-Schnittstelle, damit der -Link selbst und nicht sein Referent verknüpft wird. -Absolute Links werden nicht umgeschrieben; bei der Umschaltung muss der -Anwendungs-Mountpfad dazu passen. Hardlinks über die Grenze des übertragenen -Subvolumes hinaus werden nicht als gemeinsame Verknüpfung migriert. +Symlinks are kept as link text, even if their target does not exist. The +native path also preserves hardlinks to symlinks and FIFOs; for symlinks it +links the inode through the public low-level interface, so that the link +itself and not its referent is linked. +Absolute links are not rewritten; at cutover, the application's mount path +must match them. Hardlinks across the boundary of the transferred subvolume +are not migrated as a shared link. -Clusterinterne Layout-, Pool- und andere `ceph.*`-Attribute werden nicht -blind kopiert; Quotas werden gesondert übertragen. Pool-/Layout-Mappings, -Subvolumegruppenquotas, Pinning, Authorisierungen, Snapshot-Zeitpläne, aktive -Clone-Jobs und weitere Ceph-Verwaltungszustände sind nicht implementiert. -Die Migration übernimmt die von der Subvolume-API aufgelisteten Snapshots mit -ihrem gesamten Verzeichnisbaum. CephFS unterstützt allgemein Verzeichnissnapshots; -eigene Snapshots unterhalb eines verwalteten Subvolumes verweigert der MDS jedoch. -Im Ceph-21.2.0-Labor war ein Snapshot eines normalen Verzeichnisses erfolgreich, -derselbe Versuch in einem Subvolume-Unterordner scheiterte mit `EPERM`. -In Unterordnern sichtbare, geerbte Snapshot-Ansichten sind Bestandteil des -übergeordneten Subvolume-Snapshots. Die frühere Warnung zu separaten -Unterverzeichnissnapshots war für dieses verwaltete Subvolume-Modell zu pauschal. -Siehe [MDS-Prüfung der Subvolume-Grenze](https://github.com/ceph/ceph/blob/main/src/mds/Server.cc). -Beim rsync-Backend bleiben ctime und atime nicht erhalten; bei beiden Backends -werden originale Inode-Nummern und native Snapshot-IDs neu vergeben. -Verschlüsselte, normalisierte, nicht case-sensitive oder mit Earmark versehene -Subvolumes werden abgelehnt. +Cluster-internal layout, pool and other `ceph.*` attributes are not copied +blindly; quotas are transferred separately. Pool and layout mappings, +subvolume group quotas, pinning, authorizations, snapshot schedules, active +clone jobs and other Ceph management state are not implemented. +The migration transfers the snapshots listed by the subvolume API with their +entire directory tree. CephFS supports directory snapshots in general, but +the MDS refuses separate snapshots below a managed subvolume. In the Ceph +21.2.0 lab, a snapshot of a plain directory succeeded, while the same attempt +in a subvolume subdirectory failed with `EPERM`. Inherited snapshot views +visible in subdirectories are part of the parent subvolume snapshot. The +earlier warning about separate subdirectory snapshots was too broad for this +managed subvolume model. +See [MDS check of the subvolume boundary](https://github.com/ceph/ceph/blob/main/src/mds/Server.cc). +With the rsync backend, ctime and atime are not preserved; with both +backends, original inode numbers and native snapshot IDs are assigned anew. +Encrypted, normalized, case-insensitive or earmarked subvolumes are rejected. -## Wiederaufnahme und Verifikation +## Resumption and verification -Der Job speichert ein atomar ersetztes, mit fsync gesichertes JSON-Journal -mit Modus 0600. Es enthält Konfiguration, Cluster-FSIDs, die konkreten -Subvolume-Datenpfade und Snapshot-Intent-/Abschlussinformationen. Eine -Neuanlage desselben Subvolumenamens mit anderer Daten-UUID wird abgewiesen. +The job keeps a JSON journal with mode 0600 that is replaced atomically and +secured with fsync. It contains the configuration, the cluster FSIDs, the +concrete subvolume data paths and per-snapshot intent and completion records. +Recreating the same subvolume name with a different data UUID is rejected. -Eine lokale flock-Sperre verhindert parallele Zugriffe auf dasselbe Journal. -Ein persistenter Claim unter `/.cephmig/claims/` mit -exklusiver Datei-/CephFS-Sperre schützt das Ziel auch bei verschiedenen lokalen -Journalpfaden. Ein fehlendes oder unvollständiges Journal wird nicht durch -automatische Übernahme vorhandener Zieldaten ersetzt. +A local flock lock prevents concurrent access to the same journal. A +persistent claim under `/.cephmig/claims/` with an +exclusive file/CephFS lock protects the target even across different local +journal paths. A missing or incomplete journal is never replaced by +automatically adopting existing target data. -Jeder Snapshotstand wird kopiert, einschließlich Quotas verifiziert und erst -danach am Ziel als Snapshot angelegt. Ein bereits angelegter, aber noch nicht -im Journal bestätigter Zielsnapshot wird bei Wiederaufnahme erneut gegen die -unveränderliche Quelle geprüft. Ersatz oder Verlust bereits abgeschlossener -Snapshots wird anhand der gespeicherten Identität erkannt. +Each snapshot state is copied, verified including quotas, and only then +created as a snapshot at the target. A target snapshot that was created but +not yet confirmed in the journal is verified again against the immutable +source on resumption. Replacement or loss of already completed snapshots is +detected from the stored identity; snapshots the journal marks as `removed` +are exempt. -Der native Datenpfad verwendet einen lokalen bbolt-Index mit Quell-Inode, -Inode-Version, Größe und Ziel-Inode pro Pfad. Er enthält keine Dateiinhalte. -Die bestätigte Basis wird vor jeder Zieländerung im JSON-Journal ungültig -gemacht und erst nach erfolgreicher Verifikation und einem fsync des Index -erneut bestätigt. Cluster, Daten-UUID-Pfade und Snapshotname müssen passen. -Nach einem Abbruch wird der offene Stand vollständig nativ rekonstruiert; -ein nur teilweise ausgeführter Blockdiff darf nicht als Basis gelten. -Ein bereits publizierter, unbestätigter Zielsnapshot wird erneut geprüft. -Nach SIGKILL kann die Freigabe alter Ceph-Clientsitzungen den Wiederanlauf verzögern. +The native data path uses a local bbolt index with source inode, inode +version, size and target inode per path. It contains no file contents. The +confirmed base is invalidated in the JSON journal before any change to the +target and confirmed again only after successful verification and an fsync of +the index. Clusters, data UUID paths and snapshot name must match. After an +interruption, the open state is reconstructed fully and natively; a partially +applied blockdiff must not count as a base. An already published but +unconfirmed target snapshot is verified again. After SIGKILL, the release of +old Ceph client sessions can delay the restart. -Der Index enthält außerdem das vollständige Pfadinventar des unveränderlichen -Quellsnapshots: Dateien, Verzeichnisse, Hardlink-Aliase und Spezialdateien. -Erst nach vollständiger Erfassung wird es als vollständig markiert. Aufräumen -und Überhangprüfung gleichen Zielpfade mit diesem lokalen Inventar ab und -vermeiden dadurch erneute `stat`-Abfragen für jeden Quellpfad. Unvollständige -oder beschädigte Inventare führen zum Abbruch. Bereits identische Inode-Zeilen -werden bei der Verifikation nicht erneut in den Index geschrieben. +The index also contains the complete path inventory of the immutable source +snapshot: files, directories, hardlink aliases and special files. It is +marked complete only after it has been fully recorded. Pruning and the check +for surplus target paths compare target paths with this local inventory and +thus avoid another `stat` call for every source path. Incomplete or damaged +inventories abort the run. Identical inode rows are not written to the index +again during verification. -Unveränderliche Pfade unter `.snap` werden bei `stat` und `readdirplus` mit -`AT_STATX_DONT_SYNC` gelesen, wie in Cephs eigenem Mirror. Dadurch werden -Metadatensperren nicht allein für eine erneute Synchronisation bereits -unveränderlicher Snapshot-Inodes angefordert. Live-Zielpfade behalten ihre -normale Synchronisationssemantik. Details und Messergebnisse stehen in -[smallfiles-local.md](smallfiles-local.md). +Immutable paths under `.snap` are read with `AT_STATX_DONT_SYNC` for `stat` +and `readdirplus`, as in Ceph's own mirror. This avoids requesting metadata +locks just to resynchronize snapshot inodes that cannot change anyway. Live +target paths keep their normal synchronization semantics. Details and +measurements are in [smallfiles-local.md](smallfiles-local.md). -Bei einer vollständigen Kopie vergleicht die native Prüfung alle Dateiinhalte. -Bei Folgeständen prüft sie kopierte Dateien bzw. die von Blockdiff gemeldeten -Bereiche. Unveränderte Bytes stammen aus der zuvor verifizierten Basis. Daher -muss der Zielbaum während des gesamten Jobs ausschließlich dem Kopierer gehören. -Fremde Änderungen unveränderter Dateibereiche werden damit nicht zuverlässig -gefunden. Metadaten, Quotas und Hardlink-Topologie werden in jedem Stand geprüft. -Ein direkt nach der Prüfung angelegter Zielsnapshot wird auf Metadaten und -Links geprüft; dieselben unveränderlichen Daten werden nicht erneut gelesen. +For a full copy, the native verification compares all file contents. For +later states, it checks copied files or the ranges reported by blockdiff. +Unchanged bytes come from the previously verified base. The target tree must +therefore belong exclusively to the copier for the entire job. Foreign +changes to unchanged file ranges are not reliably detected this way. +Metadata, quotas and hardlink topology are checked in every state. A target +snapshot created right after the verification is checked for metadata and +links; the same immutable data is not read again. -Die rsync-Prüfung liest Dateiinhalte per Checksumme und vergleicht zusätzlich -die unterstützten Metadaten. Quotawerte werden separat geprüft. Wiederaufnahme -innerhalb eines Standes nutzt die vorhandenen Teilkopien, muss den Baum aber -erneut scannen; Checkpoints sind derzeit pro Snapshot, nicht pro Datei. -Bei einem im Labor reproduzierten Hardlink-`EEXIST` wird genau einmal -idempotent wiederholt; andere Fehler werden sofort zurückgegeben. +The rsync verification reads file contents by checksum and also compares the +supported metadata. Quota values are checked separately. Resuming within a +state reuses the existing partial copies, but has to scan the tree again; +checkpoints currently exist per snapshot, not per file. For a hardlink +`EEXIST` reproduced in the lab, the transfer is retried exactly once, +idempotently; other errors are returned immediately. -Zusätzlich wird die Hardlink-Topologie in beide Richtungen geprüft: alle -Quellpfade derselben Inode müssen im Ziel zusammengehören; unabhängige -Quelldateien dürfen im Ziel nicht versehentlich dieselbe Inode teilen. -Das ist nötig, weil [rsync -H](https://download.samba.org/pub/rsync/rsync.1) -überzählige bestehende Zielverknüpfungen nicht in jedem Fall auflöst. -Im rsync-Pfad werden vor dem Kopieren solche überzähligen Verknüpfungen am -exklusiven Ziel entfernt und aus dem Quellsnapshot neu aufgebaut. Der native -Pfad erzeugt vollständige Kopien atomar als neue Inodes und setzt anschließend -die Hardlink-Aliase. Alte Zielsnapshots -bleiben unverändert. Symlink-Verzeichnisse werden dabei nicht verfolgt. +In addition, the hardlink topology is verified in both directions: all source +paths of the same inode must belong together at the target, and independent +source files must not accidentally share an inode at the target. This is +needed because [rsync -H](https://download.samba.org/pub/rsync/rsync.1) does +not resolve surplus existing target links in every case. Before copying, the +rsync path removes such surplus links in the exclusive target and rebuilds +them from the source snapshot. The native path creates full copies +atomically as new inodes and then sets the hardlink aliases. Old target +snapshots stay unchanged. Symlinked directories are not followed. -Die Prüfzuordnungen liegen in einem temporären bbolt-Index neben dem Journal; -Schreibtransaktionen werden nach 4.096 Beobachtungen abgeschlossen. Der Index -wird nach jedem Prüf-/Reparaturlauf verworfen und bei Bedarf neu aufgebaut. -Er ist kein Wiederaufnahmejournal. Der native Basisindex unter -`.native/base.bolt` bleibt dagegen erhalten. Dafür muss lokal ausreichend Platz -vorhanden sein. Pfadtiefen über 128 Verzeichnisse werden derzeit abgewiesen. -Nach einem harten Prozessabbruch während eines Indexlaufs können temporäre -Indexverzeichnisse übrig bleiben; sie werden nicht als Checkpoints verwendet. +The verification mappings live in a temporary bbolt index next to the +journal; write transactions are committed after 4,096 observations. The index +is discarded after every verification or repair run and rebuilt when needed. +It is not a resumption journal. The native base index under +`.native/base.bolt`, in contrast, is kept. Sufficient local disk +space is required for it. Path depths beyond 128 directories are currently +rejected. After a hard process abort during an index run, temporary index +directories can remain; they are never used as checkpoints. -Quell- und Zielsnapshots werden nicht automatisch gelöscht. Journal und Claim -müssen für Wiederaufnahme erhalten bleiben. Ein unvollständiger Claim nach -einem Absturz während seiner allerersten Anlage wird absichtlich nicht -automatisch repariert; dafür ist eine Prüfung der ursprünglichen Job-ID nötig. +Journal and claim must be kept for resumption. An incomplete claim after a +crash during its very first creation is deliberately not repaired +automatically; that requires checking the original job ID. -## Tests und Größenordnung +## Tests and scale ```sh make check @@ -257,64 +274,62 @@ make dev-migration-test make dev-native-test ``` -Die Integrationstests erzeugen eigene Subvolumes und prüfen historische Stände, -Änderungsnachlauf, Metadaten, entfernte Dateien, Kopierfehler und einen -SIGKILL nach dem Anlegen eines Zielsnapshots, aber vor dem Journal-Commit. -Er prüft auch den gespeicherten Hinweis auf neue Snapshot-Identitäten und das -Auflösen zuvor vorhandener Hardlinks bei unveränderten Dateiinhalten. -Bei Erfolg entfernt er ausschließlich seine eigenen Fixtures; bei Fehlern -bleiben die ausgegebenen Testpfade zur Diagnose erhalten. +The integration tests create their own subvolumes and check historical +states, catching up with changes, metadata, removed files, copy errors and a +SIGKILL after a target snapshot was created but before the journal commit. +They also check the stored note about new snapshot identities, the +resolution of previously existing hardlinks with unchanged file contents, the +removal of older round snapshots during `sync` and the removal of all +migration snapshots by `cleanup`. On success they remove only their own +fixtures; on failure the reported test paths are kept for diagnosis. -Der native Test verwendet einen Kopierer ohne FUSE-Gerät, CephFS-Mounts und -rsync. Ein separater FUSE-Anwendungsclient prüft unabhängig alle Dateiinhalte -mit SHA-256 sowie Metadaten, Links und Snapshots. Er prüft eine 4-KiB-Änderung -in einer 64-MiB-Datei bei gleicher mtime, Wachstum und Nullbereiche, Linkgruppen -mit Trennung/Wiedervereinigung sowie Wechsel zwischen Verzeichnis und Symlink. -Hardlinks auf nicht auflösbare Symlinks und FIFOs werden ebenfalls unabhängig -anhand der Inodes verglichen, einschließlich späterer Trennung einer FIFO-Gruppe. -Weitere Prüfungen betreffen Abbruch während der Kopie, SIGKILL unmittelbar nach -Snapshot-Erzeugung, Wiederanlauf und idempotenten Abschluss. Währenddessen -schreibt eine Anwendung fortlaufend in ein anderes Quell-Subvolume. +The native test uses a copier without a FUSE device, CephFS mounts or rsync. +A separate FUSE application client independently checks all file contents +with SHA-256, as well as metadata, links and snapshots. It checks a 4 KiB +change in a 64 MiB file with the same mtime, growth and zero ranges, link +groups that are split and rejoined, and changes between directory and +symlink. Hardlinks to unresolvable symlinks and FIFOs are also compared +independently by inode, including a later split of a FIFO group. Further +checks cover cancellation during the copy, SIGKILL right after snapshot +creation, restart and idempotent completion. Meanwhile, an application keeps +writing to another source subvolume. -Laborergebnis vom 05.11.2026 mit Ceph 21.2.0: nativer Integrationstest und -rsync-Regression erfolgreich; Go-Tests einschließlich Race Detector und -`go vet` für den Ceph-Build erfolgreich. Der native Test schloss fünf Stände -mit `ready-for-cutover` ab und prüfte sie zusätzlich über den Anwendungsclient. -Bei der Änderung von 4 KiB in der 64-MiB-Datei wurden für diese Datei 4 KiB, -für den gesamten zweiten Stand einschließlich weiterer geänderter Dateien -4.128 Nutzdatenbytes geschrieben. Im unveränderten finalen Stand waren es -0 Nutzdatenbytes. Das ist ein Funktionsnachweis, kein Durchsatzbenchmark. +Lab result of 2026-11-05 with Ceph 21.2.0: native integration test and rsync +regression passed; Go tests including the race detector and `go vet` for the +Ceph build passed. The native test completed five states with +`ready-for-cutover` and additionally checked them through the application +client. For the 4 KiB change in the 64 MiB file, 4 KiB were written for this +file and 4,128 payload bytes for the whole second state including other +changed files. In the unchanged final state, 0 payload bytes were written. +This is a functional proof, not a throughput benchmark. -Der lesende Identitätsvergleich für bereits vorhandene Laborsnapshots lautet: +The read-only identity comparison for existing lab snapshots is: ```sh python3 /lab/snapshot-identity.py \ --config /absolute/lab-config.json --snapshot existing-snapshot ``` -Go liest Verzeichnisquotas in Batches und hält keine Liste aller Dateien. -Das gilt **nicht** als Speicherobergrenze des externen rsync-Prozesses: -große Einzelverzeichnisse und Hardlinkgruppen können dort erheblichen -Speicher benötigen. Jeder Stand verursacht vollständige Scans und -Checksum-Lesevorgänge. Geänderte große Dateien können bei neuen Snapshots -erheblichen zusätzlichen Zielplatz benötigen. +Go reads directory quotas in batches and keeps no list of all files. This +does **not** bound the memory of the external rsync process: large single +directories and hardlink groups can need considerable memory there. Every +state causes full scans and checksum reads. Changed large files can need +considerable additional target space for new snapshots. -Im nativen Pfad sind Datei-Worker, Datenpuffer und Verzeichnisiteration begrenzt; -Kopier- und Vergleichspuffer sind höchstens 4 MiB groß und werden für kleine -Dateien bzw. kurze Prüfbereiche entsprechend verkleinert. Identische Besitzer, -Rechte und mtime lösen keinen erneuten `setattr`-Aufruf aus; eine unmittelbar -zuvor gelesene Zielstatistik wird bei der Metadatenprüfung wiederverwendet. -Pfad-/Hardlink-Zuordnungen liegen auf lokalem Datenträger. Snapdiff und Blockdiff -vermeiden wiederholte Vollübertragung und vollständiges Lesen unveränderter -Dateiinhalte. Die Implementierung scannt aber weiterhin alle Metadaten, -einschließlich vollständiger Topologie- und Quotaprüfung. Umbenannte Dateien -können erneut vollständig kopiert werden. Einzeltransaktionen des nativen -Index sind noch nicht auf 200 Millionen Pfade optimiert. - -200 TB und mehr als 200 Millionen Dateien sind damit noch nicht nachgewiesen. -Für diese Freigabe fehlen insbesondere Scans vermeidende Änderungsplanung, -belastbare Speicher-/Laufzeitmessungen, ein Kapazitätsmodell für historische -Versionen sowie ein automatisierter Client-Cutover. Eine feste maximale -Schreibstopplänge wird nicht zugesichert. Native API-Aufrufe sind blockierend; -Abbruch wird zwischen Aufrufen geprüft und wartet auf bereits laufende I/O. +In the native path, file workers, data buffers and directory iteration are +bounded; copy and compare buffers are at most 4 MiB and shrink for small +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. The implementation still scans all metadata, +including the full topology and quota check. Renamed files may be copied +again in full. Single transactions of the native index are not yet optimized +for 200 million paths. +200 TB and more than 200 million files are therefore not yet proven. What is +missing for that release in particular: change planning that avoids scans, +reliable memory and runtime measurements, a capacity model for historical +versions and an automated client cutover. A fixed maximum write-stop duration +is not guaranteed. Native API calls block; cancellation is checked between +calls and waits for I/O already in progress. diff --git a/docs/million-local.md b/docs/million-local.md index 8411fd0..1c930cc 100644 --- a/docs/million-local.md +++ b/docs/million-local.md @@ -1,64 +1,64 @@ -# Lokaler Millionentest mit Snapshots +# Local one-million-file test with snapshots -## Ergebnis vom 06./07.11.2026 +## Result of 2026-11-06/07 -**PASS**, abgeschlossen am 07.11.2026 um 01:58:57 Uhr MEZ. Der Job erreichte -`ready-for-cutover`. Die unabhängige Prüfung bestätigte den aktuellen Zielstand -und vier Snapshots: insgesamt **5.000.500 reguläre Dateipfade**, zusätzlich -Symlinks, Verzeichnisse, Besitzer, Rechte, ACLs, xattrs, Quotas und Snapshot- -Benutzermetadaten. Ein anderes Subvolume blieb mit 14.640 bestätigten -Schreibvorgängen beschreibbar. +**PASS**, completed on 2026-11-07 at 01:58:57 CET. The job reached +`ready-for-cutover`. The independent check confirmed the current target state +and four snapshots: a total of **5,000,500 regular file paths**, plus +symlinks, directories, owners, modes, ACLs, xattrs, quotas and snapshot user +metadata. Another subvolume stayed writable with 14,640 confirmed writes. -| Phase einschließlich interner Prüfungen | Dauer | Geschriebene Nutzdaten | MDS-Anfragen, beide Cluster | +| Phase including internal checks | Duration | Payload written | MDS requests, both clusters | |---|---:|---:|---:| -| Erstabgleich, bestehender und neuer Snapshot | 5 h 01 min 11 s | 128.000.000 Byte | 40.451.000 | -| Änderungsabgleich | 1 h 12 min 13 s | 6.400.128 Byte | 16.875.108 | -| Finalisierung, unveränderte Quelle | 1 h 20 min 24 s | 0 Byte | 19.259.091 | +| Initial round, existing and new snapshot | 5 h 01 min 11 s | 128,000,000 bytes | 40,451,000 | +| Catch-up round | 1 h 12 min 13 s | 6,400,128 bytes | 16,875,108 | +| Finalization, unchanged source | 1 h 20 min 24 s | 0 bytes | 19,259,091 | -Die erste vollständige Kopie einschließlich abschließender Inventar- und -Metadatenarbeit dauerte rund 1 h 40 min; die erste vollständige Prüfung des -Live-Ziels danach etwa 1 h 21 min. Das gesamte Testszenario einschließlich -Datenerzeugung, Änderungen und unabhängiger Prüfung dauerte 9 h 04 min 37 s. -Maximal erfasster RSS des Go-Prozesses über die drei Phasen: 646,2 MiB. -Die Rohmesswerte stehen in [million-local.json](million-local.json). +The first full copy including the final inventory and metadata work took +about 1 h 40 min; the first full verification of the live target afterwards +about 1 h 21 min. The whole test scenario including data generation, changes +and independent verification took 9 h 04 min 37 s. Maximum sampled RSS of +the Go process across the three phases: 646.2 MiB. The raw measurements are +in [million-local.json](million-local.json). -Die vollständigen Metadatendurchläufe bleiben teuer: Selbst die Finalisierung -ohne Nutzdatenänderungen verursachte rund 19,3 Millionen MDS-Anfragen. Der -Prüfpfad ist derzeit seriell. Ceph meldete während des Laufs außerdem langsame -BlueStore-Operationen und einen hohen BlueFS-Anteil auf den kleinen Test-OSDs. -Die genauen Anteile von CPU und Datenträgerlatenz wurden nicht isoliert -profiliert. Es gab keine Prüfung der produktiven 2×25-Gbit-Verbindung. -Der Lauf belegt die geprüfte Datenkorrektheit im Labor; ein kurzer finaler -Schreibstopp für 200 Millionen Dateien ist damit noch nicht nachgewiesen. -Die Finalisierungsdauer enthält keinen Anwendungsneustart oder Client-Remount. +The full metadata passes remain expensive: even the finalization without any +payload changes caused about 19.3 million MDS requests. The verification +path is currently serial. During the run, Ceph also reported slow BlueStore +operations and a high BlueFS share on the small test OSDs. The exact shares +of CPU and disk latency were not profiled separately. The production +2×25 Gbit link was not tested. The run proves data correctness in the lab; +a short final write stop for 200 million files is not yet proven. The +finalization time does not include an application restart or client +remount. -Die automatische Bereinigung entfernte ausschließlich das Projekt -`cephmig-million` samt Testvolumes am 07.11.2026 gegen 02:03 Uhr MEZ. -Die Berichte blieben erhalten; danach waren rund 84 GiB Hostspeicher frei. +The automatic cleanup removed only the project `cephmig-million` and its +test volumes on 2026-11-07 at about 02:03 CET. The reports were kept; +afterwards about 84 GiB of host disk were free. -## Testaufbau +## Test setup -Der Test legt 1.000.000 Dateien mit je 128 Byte reproduzierbarem Inhalt an, -verteilt auf 1.000 Verzeichnisse. Dazu kommen 100 Hardlink-Namen und 100 Symlinks, -numerische Besitzer, POSIX-Zugriffs-/Default-ACLs, Benutzer-xattrs und Quotas. +The test creates 1,000,000 files of 128 bytes of reproducible content each, +spread over 1,000 directories. In addition there are 100 hardlink names and +100 symlinks, numeric owners, POSIX access and default ACLs, user xattrs and +quotas. -Ein vor der Migration angelegter Snapshot enthält den ursprünglichen Stand. -Nach dem Erstabgleich ändert der Anwendungsclient jeweils 1 % der Inhalte, -Dateinamen, Rechte/xattrs, löscht 1 % der Dateien und legt 1 % neue Dateien an. -Inhaltsänderungen behalten die ursprüngliche mtime. Danach folgen Änderungsabgleich -und Finalisierung mit gestopptem Testschreiber. Ein Schreiber in einem anderen -Subvolume läuft währenddessen weiter und bestätigt seine Schreibvorgänge mit fsync. +A snapshot taken before the migration holds the original state. After the +initial round, the application client changes 1 % each of the contents, file +names and modes/xattrs, deletes 1 % of the files and creates 1 % new files. +Content changes keep the original mtime. Then follow the catch-up round and +the finalization with the test writer stopped. Meanwhile, a writer in another +subvolume keeps running and confirms its writes with fsync. -Nach der Migration liest ein separater Python-libcephfs-Client den aktuellen -Zielstand und vier Ziel-Snapshots vollständig. Erwartete Inhalte und Metadaten -werden aus dem Testmodell berechnet. SQLite prüft auf Platte die bijektive -Zuordnung der Inodes zu Hardlink-Gruppen. Insgesamt sind 5.000.500 reguläre -Dateipfade sowie Symlinks, Verzeichnisse, ACLs, xattrs, Quotas und Snapshot- -Benutzermetadaten zu prüfen. Die Go-Migration prüft zusätzlich intern. -Ceph-interne Snapshot-IDs und ursprüngliche Erstellungszeitpunkte werden nicht -erhalten; diese bekannte Einschränkung bleibt bestehen. +After the migration, a separate Python libcephfs client reads the current +target state and four target snapshots in full. Expected contents and +metadata are computed from the test model. SQLite checks on disk that inodes +map bijectively to hardlink groups. In total, 5,000,500 regular file paths +as well as symlinks, directories, ACLs, xattrs, quotas and snapshot user +metadata are checked. The Go migration additionally verifies internally. +Ceph-internal snapshot IDs and original creation times are not preserved; +this known limitation remains. -## Start und Fortschritt +## Start and progress ```sh make dev-million-start @@ -66,35 +66,35 @@ make dev-million-status docker compose -p cephmig-million -f dev/compose.yaml -f dev/compose.million.yaml logs -f benchmark ``` -Das getrennte Compose-Projekt verwendet zwei dünn belegte 24-GiB-OSDs und -höchstens 10 GiB Container-RAM. Für den ersten Start sind 68 GiB freier -Hostspeicher vorgesehen: maximal 48 GiB OSDs plus 20 GiB Reserve. Die laufende -Prüfung stoppt weitere Schreibvorgänge bei weniger als 20 GiB Hostreserve, -3 GiB freiem Host-RAM oder 3 GiB freiem Ceph-Speicher je Cluster. -Images, bestehende Testcluster und deren Speicher kommen hinzu. Es werden keine -Kernel- oder FUSE-Mounts benötigt. Die Daemons laufen mit einem MDS-Cachelimit -von jeweils 768 MiB. Die Laufzeit hängt stark vom Datenträger und den anderen -Prozessen auf dem Host ab. +The separate Compose project uses two thinly provisioned 24 GiB OSDs and at +most 10 GiB of container RAM. The first start requires 68 GiB of free host +disk: at most 48 GiB for the OSDs plus a 20 GiB reserve. The running check +stops further writes when less than 20 GiB of host reserve, 3 GiB of free +host RAM or 3 GiB of free Ceph capacity per cluster remain. Images, existing +test clusters and their storage come on top. No kernel or FUSE mounts are +needed. The daemons run with an MDS cache limit of 768 MiB each. The runtime +depends heavily on the disk and the other processes on the host. -Der Treiber läuft als eigener Container weiter. Status, Protokolle, MDS-Zähler, -Laufzeiten und abgetasteter maximaler RSS des Go-Prozesses liegen unter -`.dev/million/main/`. Nur `result: PASS` bestätigt die vollständige Prüfung. -Erzeugung und abgeschlossene Prüfansichten haben Checkpoints; ein unterbrochener -Go-Abgleich verwendet das bestehende Migrationsjournal. Eine unterbrochene -Phase zählt nicht als verwertbare Laufzeitmessung. Die Testerzeugung läuft mit -acht Threads, der Kopierer mit acht Workern, die unabhängige Prüfung mit 16 Threads. -Queues und Datenpuffer sind begrenzt; Index und Inode-Zuordnung liegen auf Platte. +The driver keeps running as a container of its own. Status, logs, MDS +counters, durations and the sampled maximum RSS of the Go process are written +to `.dev/million/main/`. Only `result: PASS` confirms the complete check. +Generation and completed verification views have checkpoints; an interrupted +Go round uses the existing migration journal. An interrupted phase does not +count as a usable runtime measurement. Test generation runs with eight +threads, the copier with eight workers, the independent check with 16 +threads. Queues and data buffers are bounded; index and inode mapping live on +disk. -## Bereinigung +## Cleanup -Nach erfolgreicher Prüfung Messwerte nach `docs/million-local.json` sichern -und ausschließlich dieses Testprojekt entfernen. Der Befehl verweigert die -Bereinigung ohne `PASS` und erfolgreichen Container-Exit: +After a successful check, save the measurements to `docs/million-local.json` +and remove only this test project. The command refuses to clean up without +`PASS` and a successful container exit: ```sh make dev-million-finish ``` -Die Berichte auf dem Host bleiben erhalten. Das Projekt `cephmig-dev` ist separat. -Ein lokaler Lauf ist kein Leistungsnachweis für 200 TB oder 200 Millionen Dateien. -MDS-Anfragen sind keine Messung physischer Datenträger-IOPS. +The reports on the host are kept. The project `cephmig-dev` is separate. A +local run is no performance proof for 200 TB or 200 million files. MDS +requests are not a measurement of physical disk IOPS. diff --git a/docs/raw-transfer.md b/docs/raw-transfer.md index ac52969..4019726 100644 --- a/docs/raw-transfer.md +++ b/docs/raw-transfer.md @@ -1,107 +1,110 @@ -# Direkter RADOS-Transfer eines einzelnen Subvolumes +# Direct RADOS transfer of a single subvolume -Geprüft am 05.11.2026 für die Anforderung: genau ein CephFS-Subvolume zwischen -unabhängigen Clustern migrieren, während andere Subvolumes weiterlaufen. -Native Snapshot-IDs und Geburtszeitpunkte dürfen dabei abweichen. +Evaluated on 2026-11-05 against the requirement: migrate exactly one CephFS +subvolume between independent clusters while other subvolumes keep running. +Native snapshot IDs and birth times may differ. -## Ergebnis +## Result -Ein roher Import von RADOS-Daten- und Metadatenobjekten ist unter diesen -Bedingungen kein geprüfter Ersatz für den vorhandenen Transport. Der aktuelle -Code wurde deshalb nicht auf einen solchen Import umgestellt. +Under these conditions, a raw import of RADOS data and metadata objects is +not a verified replacement for the existing transport. The code was +therefore not switched to such an import. -RADOS kann Objektinhalt, xattrs und OMAP lesen und schreiben. Damit ist jedoch -noch kein separat einhängbares CephFS-Subvolume übertragen: +RADOS can read and write object contents, xattrs and OMAP. That alone does +not transfer a separately mountable CephFS subvolume: -- Der MDS-Metadatenpool enthält die Hierarchie und dateisystemweite Zustände, - etwa Journale, Inode-/Snapshot-Verwaltung und Clientsitzungen. -- Ein Subvolume hat keinen unabhängigen MDS-Metadatenpool. Ein separater - Daten-Namespace würde nur bei der Zuordnung von Datenobjekten helfen. -- Dateilayouts und Metadaten beziehen sich auf Inodes, Pools und Snapshots der - Quelle. Sie dürfen nicht unverändert in ein laufendes, anders aufgebautes - Ziel-Dateisystem importiert werden. -- Der untersuchte RADOS-Pool-Export schreibt ausdrücklich nur HEAD-Objekte. - Historische RADOS-Snapshot-Versionen sind damit nicht als vollständige - CephFS-Snapshot-Historie migriert. -- Die dokumentierte Pool-Migration beschreibt Migration zwischen Pools - innerhalb desselben Clusters. Sie ist keine Subvolume-Replikation zwischen - unabhängigen Clustern. +- The MDS metadata pool holds the hierarchy and file-system-wide state, such + as journals, inode and snapshot management and client sessions. +- A subvolume has no metadata pool of its own. A separate data namespace + would only help to map data objects. +- File layouts and metadata refer to the inodes, pools and snapshots of the + source. They must not be imported unchanged into a running target file + system with a different structure. +- The examined RADOS pool export explicitly writes only HEAD objects. + Historical RADOS snapshot versions are therefore not migrated as a complete + CephFS snapshot history. +- The documented pool migration covers migration between pools within the + same cluster. It is not subvolume replication between independent + clusters. -Die Schlussfolgerung folgt aus diesen Verwaltungs- und Konsistenzabhängigkeiten: -Ein eigener Raw-Kopierer müsste zusätzlich eine konsistente Teilmenge der -CephFS-Metadaten exportieren, auf die Zielidentitäten abbilden und mit dessen -laufendem MDS koordinieren. Ein gewöhnlicher Objektkopierer leistet das nicht. -Auch ein Objekttransfer muss die erforderlichen Nutzdaten zum Ziel bewegen. +The conclusion follows from these management and consistency dependencies: +a raw copier of its own would additionally have to export a consistent +subset of the CephFS metadata, map it to the target identities and +coordinate with the target's running MDS. An ordinary object copier does not +do that. An object transfer, too, has to move the required payload to the +target. -## Geprüfte native Alternative +## Verified native alternative -Der Go-Transport `backend: native` verwendet libcephfs ohne rsync und ohne -Kernel-/FUSE-Mount. Metadatenoperationen erfolgen über den Ziel-MDS; -Daten-I/O übernimmt der native Ceph-Client direkt gegen RADOS. Ein roher Import -des gemeinsamen MDS-Metadatenpools ist weiterhin nicht Bestandteil der Migration. +The Go transport `backend: native` uses libcephfs without rsync and without a +kernel or FUSE mount. Metadata operations go through the target MDS; data +I/O is handled by the native Ceph client directly against RADOS. A raw import +of the shared MDS metadata pool remains outside the migration. -In der tatsächlich laufenden Bibliothek des Labors wurden folgende Symbole -geprüft: +The following symbols were checked in the library actually running in the +lab: -| Schnittstelle | Vorhanden | +| Interface | Present | | --- | --- | -| ceph_open_snapdiff | ja | -| ceph_open_snapdiff2 | nein | -| ceph_readdir_snapdiff2 | nein | -| ceph_file_blockdiff_init | ja | -| ceph_file_blockdiff | ja | -| ceph_file_blockdiff_finish | ja | +| ceph_open_snapdiff | yes | +| ceph_open_snapdiff2 | no | +| ceph_readdir_snapdiff2 | no | +| ceph_file_blockdiff_init | yes | +| ceph_file_blockdiff | yes | +| ceph_file_blockdiff_finish | yes | -Die installierte Ceph-21.2.0-Konfiguration kennt -`cephfs_mirror_blockdiff_min_file_size` mit Standardwert 16 MiB. +The installed Ceph 21.2.0 configuration knows +`cephfs_mirror_blockdiff_min_file_size` with a default of 16 MiB. -Implementierter Ablauf: +Implemented workflow: -1. Initialer nativer Transfer des Snapshotstands. -2. Snapdiff zum Ermitteln geänderter Verzeichniseinträge. -3. Blockdiff für geeignete geänderte Dateien; notwendige Datenbereiche übertragen. -4. Hardlink-Zuordnungen, ACLs, xattrs, Quotas und Journal weiterhin explizit verwalten. -5. Gezielte Verifikation der Änderungen und ein finaler Abgleich beim Schreibstopp. +1. Initial native transfer of the snapshot state. +2. Snapdiff to find changed directory entries. +3. Blockdiff for suitable changed files; transfer of the required data + ranges. +4. Hardlink mappings, ACLs, xattrs, quotas and the journal are still managed + explicitly. +5. Targeted verification of the changes and a final round at the write stop. -Der Backendpfad liegt in `internal/migration/native_*.go`, die schmale CGO-Anbindung -an öffentliche Ceph-Schnittstellen in `internal/cephfsnative`. Aktivierung: -`go build -tags ceph` mit CGO, C-Compiler und passenden libcephfs-Headern. -`make dev-native-test` baut diese Abhängigkeiten im Container und prüft den -Transport zwischen den unabhängigen Laborclustern. +The backend lives in `internal/migration/native_*.go`, the thin CGO binding +to public Ceph interfaces in `internal/cephfsnative`. Activation: +`go build -tags ceph` with CGO, a C compiler and matching libcephfs headers. +`make dev-native-test` builds these dependencies in a container and checks +the transport between the independent lab clusters. -Snapdiff markiert geänderte Inodes; zusätzlich verhindert der Vergleich der -Ceph-Inode-Version, dass Datenänderungen mit gleicher Größe und mtime entgehen. -Blockdiff wird ab 16 MiB verwendet, sofern eine bestätigte Basis mit passenden -Quell-/Ziel-Inodes vorliegt. Bei nicht verfügbaren Diff-Schnittstellen wird -nativ vollständig rekonstruiert. Es gibt keinen stillen rsync-Fallback. +Snapdiff marks changed inodes; in addition, comparing the Ceph inode version +ensures that data changes with the same size and mtime are not missed. +Blockdiff is used from 16 MiB on, provided a confirmed base with matching +source and target inodes exists. If the diff interfaces are unavailable, the +state is reconstructed fully and natively. There is no silent rsync fallback. -Die Implementierung scannt derzeit trotzdem alle Metadaten und prüft die -Hardlink-Topologie jedes Standes vollständig. Snapdiff ersetzt diese Scans noch -nicht. Datenprüfung liest beim ersten Stand alle Bytes, bei bestätigten -Folgeständen nur kopierte Bereiche. Unveränderte Bereiche werden aus der zuvor -verifizierten Basis übernommen. Das Ziel muss exklusiv dem Migrationsjob gehören; -fremde Änderungen an unveränderten Bereichen werden damit nicht umfassend erkannt. -Ein Index auf lokalem Datenträger bindet die Basis an Cluster, Datenpfade und -Journal. Vor jeder Änderung wird ihre Gültigkeit im Journal entzogen. Ein Abbruch -erzwingt im nächsten Prozess eine vollständige Rekonstruktion des offenen Standes. +The implementation nevertheless still scans all metadata and checks the full +hardlink topology of every state. Snapdiff does not yet replace these scans. +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 +migration job; foreign changes to unchanged ranges are not fully detected +this way. +An index on local disk binds the base to clusters, data paths and journal. +Before every change its validity is withdrawn in the journal. An +interruption forces a full reconstruction of the open state in the next +process. -Ein Laufzeit- oder Durchsatznachweis für 200 TB / 200 Millionen Dateien fehlt. -Auch nach einem Abbruch kann die vollständige Rekonstruktion entsprechend lange -dauern. Die Zahl der durch die Anwendung geänderten Bytes ist keine feste -Obergrenze für die vom OSD gemeldeten geänderten Bereiche. +Evidence of runtime or throughput for 200 TB / 200 million files is missing. +After an interruption, too, the full reconstruction can take correspondingly +long. The number of bytes changed by the application is not a fixed upper +bound for the changed ranges reported by the OSD. -Das fertige cephfs-mirror verwendet native Replikation, unterstützt laut -Dokumentation aber keine Erhaltung gemeinsamer Hardlink-Inodes. Es würde -Hardlink-Dateien als getrennte Dateien synchronisieren. Deshalb wäre ein -ungeprüfter Wechsel auf cephfs-mirror kein Ersatz für die vereinbarten -Link-Anforderungen. +The ready-made cephfs-mirror uses native replication but, according to its +documentation, does not preserve shared hardlink inodes. It would synchronize +hardlinked files as separate files. An unverified switch to cephfs-mirror +would therefore not satisfy the agreed link requirements. -## Primärquellen - -- [MDS-Metadatenpool und Journale](https://docs.ceph.com/en/latest/cephfs/mds-journaling/) -- [CephFS-Architektur und direkter RADOS-Datenzugriff](https://docs.ceph.com/en/latest/cephfs/index.html) -- [PoolDump: Export nur des HEAD-Zustands](https://github.com/ceph/ceph/blob/main/src/tools/rados/PoolDump.cc) -- [Pool-Migration innerhalb desselben Clusters](https://docs.ceph.com/en/latest/dev/pool-migration-design/) -- [libcephfs: Snapdiff und Blockdiff](https://github.com/ceph/ceph/blob/main/src/include/cephfs/libcephfs.h) -- [CephFS-Mirroring: Blockdiff und Hardlink-Grenzen](https://docs.ceph.com/en/latest/cephfs/cephfs-mirroring/) +## Primary sources +- [MDS metadata pool and journals](https://docs.ceph.com/en/latest/cephfs/mds-journaling/) +- [CephFS architecture and direct RADOS data access](https://docs.ceph.com/en/latest/cephfs/index.html) +- [PoolDump: export of the HEAD state only](https://github.com/ceph/ceph/blob/main/src/tools/rados/PoolDump.cc) +- [Pool migration within the same cluster](https://docs.ceph.com/en/latest/dev/pool-migration-design/) +- [libcephfs: snapdiff and blockdiff](https://github.com/ceph/ceph/blob/main/src/include/cephfs/libcephfs.h) +- [CephFS mirroring: blockdiff and hardlink limits](https://docs.ceph.com/en/latest/cephfs/cephfs-mirroring/) diff --git a/docs/smallfiles-local.md b/docs/smallfiles-local.md index 3c3120f..845943c 100644 --- a/docs/smallfiles-local.md +++ b/docs/smallfiles-local.md @@ -1,53 +1,53 @@ -# Lokaler Test mit vielen kleinen Dateien +# Local test with many small files -Gemessen am 05./06.11.2026 mit Ceph 21.2.0. Zwei unabhängige Laborcluster, je ein MON/MGR/MDS und ein dateibasierter 4-GiB-BlueStore-OSD auf demselben Host; vier Kopier-Worker. +Measured on 2026-11-05/06 with Ceph 21.2.0. Two independent lab clusters, each with one MON/MGR/MDS and one file-backed 4 GiB BlueStore OSD on the same host; four copy workers. -Jede Datei enthält 128 Byte deterministische, nicht ausschließlich nullwertige Daten. Eine Hälfte liegt in einem großen Verzeichnis, die andere verteilt auf 50 Verzeichnisse. Zusätzlich: 100 Hardlink-Namen und 100 Symlinks. Änderungen: jeweils 1 % Inhalt, Löschungen, Umbenennungen, neue Dateien, Modus/xattr-Änderungen und xattr-Löschungen. Die 2.000-Dateien-Läufe enthalten außerdem numerische Besitzer und Zugriffs-/Default-ACLs. +Each file contains 128 bytes of deterministic data that is not all zeros. Half of the files are in one large directory, the other half spread over 50 directories. In addition: 100 hardlink names and 100 symlinks. Changes: 1 % each of contents, deletions, renames, new files, mode/xattr changes and xattr removals. The 2,000-file runs also contain numeric owners and access/default ACLs. -## Vergleich mit 2.000 Dateien +## Comparison with 2,000 files -| Phase | Vorher | Nachher | MDS-Anfragen vorher | MDS-Anfragen nachher | +| Phase | Before | After | MDS requests before | MDS requests after | |---|---:|---:|---:|---:| -| Erstlauf, zwei Stände | 490.2 s | 55.2 s | 115.132 | 87.437 | -| Änderungsabgleich | 52.2 s | 21.2 s | 52.677 | 38.911 | -| Finaler Abgleich | 30.1 s | 24.1 s | 59.350 | 41.074 | +| Initial run, two states | 490.2 s | 55.2 s | 115,132 | 87,437 | +| Catch-up round | 52.2 s | 21.2 s | 52,677 | 38,911 | +| Final round | 30.1 s | 24.1 s | 59,350 | 41,074 | -Im finalen Lauf: 30.8 % weniger MDS-Anfragen, 20.0 % kürzere Laufzeit. In beiden Varianten wurden dabei 0 Nutzdatenbytes geschrieben. Der Änderungsabgleich schrieb in beiden Varianten 12.928 Byte für 101 Dateien. +In the final run: 30.8 % fewer MDS requests, 20.0 % shorter runtime. Both variants wrote 0 payload bytes there. The catch-up round wrote 12,928 bytes for 101 files in both variants. -Gemessener maximaler Prozess-RSS über die Phasen: vorher 93.7 MiB, nachher 76.4 MiB. Ceph-Daemons, CLI-Kinder und Anwendungsclient sind darin nicht enthalten. +Measured maximum process RSS across the phases: 93.7 MiB before, 76.4 MiB after. Ceph daemons, CLI children and the application client are not included. -Die alte Version zeigte beim Erstlauf MDS-Lesesperren-Wartezeiten. Andere Vorläufe lagen dort bei etwa 99 s. Die große Differenz des Erstlaufs ist deshalb kein allgemeines Beschleunigungsversprechen. Der über Nacht unterbrochene Vergleich sowie dessen Wiederanlauf sind nicht als Vergleichsmessung enthalten. +The old version showed MDS read lock waits in the initial run. Other earlier runs took about 99 s there. The large difference in the initial run is therefore no general promise of a speedup. The comparison interrupted overnight and its restart are not included as a comparison measurement. -## Abgeschlossener Test mit 10.000 Dateien, vor Optimierung +## Completed test with 10,000 files, before optimization -| Phase | Dauer | Geschriebene Nutzdaten | +| Phase | Duration | Payload written | |---|---:|---:| -| Erstlauf, zwei Stände | 554.4 s | 1.280.000 Byte | -| Änderungsabgleich | 459.3 s | 64.128 Byte | -| Finaler Abgleich | 84.1 s | 0 Byte | +| Initial run, two states | 554.4 s | 1,280,000 bytes | +| Catch-up round | 459.3 s | 64,128 bytes | +| Final round | 84.1 s | 0 bytes | -Der unabhängige Anwendungsclient verglich live und in vier historischen Ständen insgesamt 50.500 reguläre Dateipfade einschließlich Hardlinks, zusätzlich Symlinks und Metadaten. Alle Prüfungen waren erfolgreich. Diese zusätzliche Testprüfung dauert 600,7 s und gehört nicht zur gemessenen Dauer von `finalize`. Remount und Anwendungsneustart sind ebenfalls nicht enthalten. +The independent application client compared a total of 50,500 regular file paths including hardlinks, live and in four historical states, plus symlinks and metadata. All checks passed. This additional test check takes 600.7 s and is not part of the measured duration of `finalize`. Remount and application restart are not included either. -Der Kopierer erreichte 135.4 MiB Prozess-RSS. Journal und Index belegten am Ende 1.59 MiB. Ceph meldete vor der Bereinigung etwa 271.2 MiB zusätzliche Rohbelegung an der Quelle und 726.6 MiB am Ziel. Diese Werte enthalten auch internen Verwaltungsaufwand, Journal- und BlueFS/RocksDB-Wachstum. +The copier reached 135.4 MiB process RSS. Journal and index took 1.59 MiB at the end. Before the cleanup, Ceph reported about 271.2 MiB of additional raw usage at the source and 726.6 MiB at the target. These values also include internal overhead and journal and BlueFS/RocksDB growth. -## Umgesetzte Änderungen +## Implemented changes -- Vollständiges lokales Pfadinventar des unveränderlichen Quellsnapshots für Aufräumen und Überhangprüfung; erneute Quell-`stat`-Abfragen je Zielpfad entfallen. Unvollständige Inventare verhindern das Aufräumen. -- Keine erneuten Index-Schreibtransaktionen für identische Inode-Zeilen. -- Keine erneuten `setattr`-Aufrufe für bereits gleiche Besitzer, Rechte und mtime; Zielstatistik wird bei der Prüfung wiederverwendet. -- Datenpuffer passend zur Dateigröße bzw. Prüflänge, höchstens 4 MiB je Puffer. -- `AT_STATX_DONT_SYNC` nur für unveränderliche Snapshotpfade; Live-Zielpfade behalten normale Synchronisationssemantik. Cephs eigener [Mirror verwendet denselben Snapshot-Zugriff](https://github.com/ceph/ceph/blob/main/src/tools/cephfs_mirror/PeerReplayer.cc). +- A complete local path inventory of the immutable source snapshot for pruning and the check for surplus paths; repeated source `stat` calls per target path are gone. Incomplete inventories prevent pruning. +- No repeated index write transactions for identical inode rows. +- No repeated `setattr` calls for already identical owner, mode and mtime; the target stat is reused during verification. +- Data buffers sized to the file size or verification length, at most 4 MiB per buffer. +- `AT_STATX_DONT_SYNC` only for immutable snapshot paths; live target paths keep normal synchronization semantics. Ceph's own [mirror uses the same snapshot access](https://github.com/ceph/ceph/blob/main/src/tools/cephfs_mirror/PeerReplayer.cc). -## Grenzen und Reproduktion +## Limits and reproduction -MDS-Anfragen sind keine physisch gemessenen Datenträger-IOPS. Die Läufe sind einzelne Messungen auf einem gemeinsam genutzten Host, ohne zugesicherte Cache-Bedingungen. Es bleiben vollständige Metadatendurchläufe; für 200 Millionen Dateien ist weiterhin ein Änderungsplan nötig, der unveränderte Teilbäume überspringt. Die Ergebnisse sind keine Freigabe für diese Größenordnung. +MDS requests are not physically measured disk IOPS. The runs are single measurements on a shared host, without guaranteed cache conditions. Full metadata passes remain; 200 million files still need change planning that skips unchanged subtrees. The results are no release for that scale. ```sh make dev-smallfiles-test -# kleinerer Test mit MDS-Zählern: +# smaller test with MDS counters: FILES=2000 REPORT_DIR=/tmp/cephmig-smallfiles-report make dev-smallfiles-test ``` -Die Testprogramme bereinigen bei Erfolg ihre eigenen Subvolumes, Snapshots, Claims und lokalen Zustandsdateien. Ceph kann freigewordenen Platz verzögert zurückmelden. Rohdaten, Binär-Hashes und Details stehen in [smallfiles-local.json](smallfiles-local.json). +On success, the test programs remove their own subvolumes, snapshots, claims and local state files. Ceph may report freed space with a delay. Raw data, binary hashes and details are in [smallfiles-local.json](smallfiles-local.json). -Zusätzlich bestanden die Go-Tests mit Race Detector und `go vet` für den nativen Build sowie der vollständige native Funktionstest mit großen/Sparse-Dateien, Blockdiff, historischen Snapshots, ACLs, Quotas, Hardlinks auf Symlinks/FIFOs, Abbruch und SIGKILL-Wiederaufnahme. Die erfolgreichen Test-Fixtures wurden entfernt. +In addition, the Go tests with the race detector and `go vet` for the native build passed, as did the complete native functional test with large/sparse files, blockdiff, historical snapshots, ACLs, quotas, hardlinks to symlinks/FIFOs, cancellation and SIGKILL resume. The fixtures of the successful run were removed.