feat!: remove the rsync backend

The native libcephfs backend is the only transfer path. The rsync
transport, the mounted-filesystem access and its helpers (mount check,
path resolution below a mount, mount claim, quota and hardlink repair
through the mount) are removed, together with the rsync lab test and
the client image that only added rsync.

The claim and release tests now exercise the native claim through a
local test file system with real flock locks.

BREAKING CHANGE: "backend": "rsync" and the endpoint field "mount" are
rejected. "backend" is optional and only accepts "native"; jobs created
with "native" resume without it. Journals of rsync jobs cannot be
resumed. Builds without the build tag ceph only support doctor and
status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-12-03 22:03:22 +01:00
1 parent f0ea1fd7cd
commit 330a3ec12c
31 files changed
+263 -1522

No files matched your search

-137
View File
@@ -1,148 +1,11 @@
package migration
import (
"context"
"encoding/binary"
"io"
"os"
"os/exec"
"path/filepath"
"testing"
)
func mustWrite(t *testing.T, path string) {
t.Helper()
if err := os.WriteFile(path, []byte("identical contents"), 0640); err != nil {
t.Fatal(err)
}
}
func TestHardlinkTopologyHandlesSplitAndRejoin(t *testing.T) {
if _, err := exec.LookPath("rsync"); err != nil {
t.Skip("rsync is not installed")
}
ctx := context.Background()
src, dst, scratch := t.TempDir(), t.TempDir(), t.TempDir()
if err := os.Mkdir(filepath.Join(src, "d"), 0700); err != nil {
t.Fatal(err)
}
a, b := filepath.Join(src, "a"), filepath.Join(src, "d", "b")
mustWrite(t, a)
if err := os.Link(a, b); err != nil {
t.Fatal(err)
}
r := Rsync{Exec: Process{Stderr: io.Discard}, Log: io.Discard}
if err := r.Copy(ctx, src, dst); err != nil {
t.Fatal(err)
}
if err := hardlinkTopology(ctx, src, dst, scratch, false); err != nil {
t.Fatal(err)
}
// Break one source link without changing bytes, mode or mtime. Rsync -H
// alone can leave an extra target link in this exact case.
old, err := os.Stat(b)
if err != nil {
t.Fatal(err)
}
if err = os.Remove(b); err != nil {
t.Fatal(err)
}
mustWrite(t, b)
if err = os.Chtimes(b, old.ModTime(), old.ModTime()); err != nil {
t.Fatal(err)
}
if err = hardlinkTopology(ctx, src, dst, scratch, false); err == nil {
t.Fatal("extra destination hardlink was missed")
}
if err = hardlinkTopology(ctx, src, dst, scratch, true); err != nil {
t.Fatal(err)
}
if err = r.Copy(ctx, src, dst); err != nil {
t.Fatal(err)
}
if err = hardlinkTopology(ctx, src, dst, scratch, false); err != nil {
t.Fatal(err)
}
x, _ := os.Stat(filepath.Join(dst, "a"))
y, _ := os.Stat(filepath.Join(dst, "d", "b"))
if os.SameFile(x, y) {
t.Fatal("split source files remained linked")
}
if err = os.Remove(b); err != nil {
t.Fatal(err)
}
if err = os.Link(a, b); err != nil {
t.Fatal(err)
}
if err = hardlinkTopology(ctx, src, dst, scratch, false); err == nil {
t.Fatal("missing target hardlink was missed")
}
if err = hardlinkTopology(ctx, src, dst, scratch, true); err != nil {
t.Fatal(err)
}
if err = r.Copy(ctx, src, dst); err != nil {
t.Fatal(err)
}
if err = hardlinkTopology(ctx, src, dst, scratch, false); err != nil {
t.Fatal(err)
}
entries, err := os.ReadDir(scratch)
if err != nil || len(entries) != 0 {
t.Fatal("scratch indexes were not removed")
}
}
func TestHardlinkRepairDoesNotFollowTargetSymlinkDirectories(t *testing.T) {
src, dst, outside, scratch := t.TempDir(), t.TempDir(), t.TempDir(), t.TempDir()
if err := os.Mkdir(filepath.Join(src, "d"), 0700); err != nil {
t.Fatal(err)
}
mustWrite(t, filepath.Join(src, "d", "a"))
mustWrite(t, filepath.Join(src, "d", "b"))
mustWrite(t, filepath.Join(outside, "a"))
if err := os.Link(filepath.Join(outside, "a"), filepath.Join(outside, "b")); err != nil {
t.Fatal(err)
}
if err := os.Symlink(outside, filepath.Join(dst, "d")); err != nil {
t.Fatal(err)
}
if err := hardlinkTopology(context.Background(), src, dst, scratch, true); err != nil {
t.Fatal(err)
}
a, err := os.Stat(filepath.Join(outside, "a"))
if err != nil {
t.Fatal(err)
}
b, err := os.Stat(filepath.Join(outside, "b"))
if err != nil || !os.SameFile(a, b) {
t.Fatal("repair touched files outside the target tree")
}
}
func TestHardlinkDiskIndexSurvivesBatchBoundaries(t *testing.T) {
x, err := openLinkIndex(filepath.Join(t.TempDir(), "index"))
if err != nil {