Skip to content

Commit df12f50

Browse files
refactor(treewide): decouple native backup and restore support
It turns out that the support for native backup and restore API will be a part of different Scylla releases.
1 parent aaa890c commit df12f50

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

pkg/scyllaclient/client_agent.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ func (ni *NodeInfo) SupportsSafeDescribeSchemaWithInternals() (SafeDescribeMetho
269269
return "", nil
270270
}
271271

272-
// SupportsScyllaBackupRestoreAPI returns whether node exposes /storage_service/<backup|restore> API.
273-
func (ni *NodeInfo) SupportsScyllaBackupRestoreAPI() (bool, error) {
272+
// SupportsNativeBackupAPI returns whether node exposes /storage_service/backup API.
273+
func (ni *NodeInfo) SupportsNativeBackupAPI() (bool, error) {
274274
// Detect master builds
275275
if scyllaversion.MasterVersion(ni.ScyllaVersion) {
276276
return true, nil
@@ -279,9 +279,9 @@ func (ni *NodeInfo) SupportsScyllaBackupRestoreAPI() (bool, error) {
279279
return scyllaversion.CheckConstraint(ni.ScyllaVersion, ">= 2025.2")
280280
}
281281

282-
// ScyllaBackupRestoreEndpoint returns endpoint that should be used when calling /storage_service/<backup|restore> API.
282+
// ScyllaObjectStorageEndpoint returns endpoint that should be used when calling /storage_service/<backup|restore> API.
283283
// It also validates that agent's and Scylla's configurations match.
284-
func (ni *NodeInfo) ScyllaBackupRestoreEndpoint(provider backupspec.Provider) (string, error) {
284+
func (ni *NodeInfo) ScyllaObjectStorageEndpoint(provider backupspec.Provider) (string, error) {
285285
if provider != backupspec.S3 {
286286
return "", errors.Errorf("unsupported provider %s for native Scylla backup and restore", provider)
287287
}

pkg/service/backup/service_backup_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2592,7 +2592,7 @@ func TestBackupAPIHintIntegration(t *testing.T) {
25922592
if err != nil {
25932593
t.Fatal(err)
25942594
}
2595-
support, err := ni.SupportsScyllaBackupRestoreAPI()
2595+
support, err := ni.SupportsNativeBackupAPI()
25962596
if err != nil {
25972597
t.Fatal(err)
25982598
}

pkg/service/backup/worker_scylla_upload.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ import (
1414

1515
// hostNativeBackupSupport validates that native backup API can be used for given host.
1616
func hostNativeBackupSupport(ni *scyllaclient.NodeInfo, loc backupspec.Location) error {
17-
ok, err := ni.SupportsScyllaBackupRestoreAPI()
17+
ok, err := ni.SupportsNativeBackupAPI()
1818
if err != nil {
1919
return errors.Wrap(err, "check native backup api support")
2020
}
2121
if !ok {
2222
return errors.New("native backup api is not supported")
2323
}
24-
_, err = ni.ScyllaBackupRestoreEndpoint(loc.Provider)
24+
_, err = ni.ScyllaObjectStorageEndpoint(loc.Provider)
2525
if err != nil {
2626
return errors.Wrap(err, "check scylla object storage endpoint")
2727
}
@@ -65,7 +65,7 @@ func (w *worker) nativeBackup(ctx context.Context, hi hostInfo, d snapshotDir) e
6565
"table", d.Table)
6666
if d.Progress.ScyllaTaskID == "" || !w.scyllaCanAttachToTask(ctx, hi.IP, d.Progress.ScyllaTaskID) {
6767
prefix := w.remoteSSTableDir(hi, d)
68-
endpoint, err := hi.NodeConfig.ScyllaBackupRestoreEndpoint(hi.Location.Provider)
68+
endpoint, err := hi.NodeConfig.ScyllaObjectStorageEndpoint(hi.Location.Provider)
6969
if err != nil {
7070
return errors.Wrap(err, "get Scylla object storage endpoint")
7171
}

pkg/service/restore/restore_integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ func TestRestoreTablesPreparationIntegration(t *testing.T) {
505505
if err != nil {
506506
t.Fatal(err)
507507
}
508-
nativeAPISupport, err := ni.SupportsScyllaBackupRestoreAPI()
508+
nativeBackupSupport, err := ni.SupportsNativeBackupAPI()
509509
if err != nil {
510510
t.Fatal(err)
511511
}
@@ -633,7 +633,7 @@ func TestRestoreTablesPreparationIntegration(t *testing.T) {
633633
})
634634

635635
Print("Validate state after backup")
636-
if nativeAPISupport {
636+
if nativeBackupSupport && !IsIPV6Network() {
637637
validateState(h.srcCluster, "repair", true, 10, 99, pinnedCPU)
638638
} else {
639639
validateState(h.srcCluster, "repair", true, 3, 88, pinnedCPU)

0 commit comments

Comments
 (0)