mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-13 23:39:33 +01:00
shell: fail tier download when no replica is listed
Also point the final-replica delete error at volume.fix.replication. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e19993cdb3
commit
afd115c16a
2 files changed
+12
-1
No files matched your search
@@ -159,6 +159,9 @@ func downloadAndReplicateFromRemoteTier(grpcDialOption grpc.DialOption, writer i
|
||||
remote, local, copies := collectVolumeTierDownloadLocations(topoInfo, vid, collection)
|
||||
listed := len(remote) + len(local)
|
||||
if len(remote) == 0 {
|
||||
if len(local) == 0 {
|
||||
return fmt.Errorf("volume %d is not listed on any volume server", vid)
|
||||
}
|
||||
fmt.Fprintf(writer, "volume %d is already on local disk\n", vid)
|
||||
return nil
|
||||
}
|
||||
@@ -215,7 +218,7 @@ func downloadAndReplicateFromRemoteTier(grpcDialOption grpc.DialOption, writer i
|
||||
last := pending[0]
|
||||
fmt.Fprintf(writer, "delete remote-backed replica of volume %d on %s with its remote object\n", vid, last.server)
|
||||
if err = deleteVolume(context.Background(), grpcDialOption, vid, last.server, false, false, false); err != nil {
|
||||
return fmt.Errorf("delete volume %d with its remote object on %s: %v", vid, last.server, err)
|
||||
return fmt.Errorf("delete volume %d with its remote object on %s: %v; if the delete was applied, run volume.fix.replication to restore the replica", vid, last.server, err)
|
||||
}
|
||||
if err = replicateTierDownloadedVolume(grpcDialOption, writer, vid, source, last); err != nil {
|
||||
return fmt.Errorf("%v; run volume.fix.replication to restore the replica", err)
|
||||
|
||||
@@ -357,3 +357,11 @@ func TestTierDownloadKeepsRemoteObjectWhileReplicasAreUnlisted(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestTierDownloadFailsWhenNoReplicaIsListed(t *testing.T) {
|
||||
c := newTierDownloadCluster(t, tierReplicaRemote)
|
||||
c.hide(0, c.servers[0])
|
||||
if err := c.run(t); err == nil {
|
||||
t.Fatalf("tier download should fail when no replica is listed")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user