aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-01-06 09:52:28 -0800
committerchrislu <chris.lu@gmail.com>2022-01-06 09:52:28 -0800
commit60dc450091a573e99e633b6ad9d9c80761633526 (patch)
treef7ac339f8786204a4f55c4bba617dcff19f7ecbf
parent3df8f961175e082692ea8f13e15ea7ad5ea5ddf5 (diff)
downloadseaweedfs-60dc450091a573e99e633b6ad9d9c80761633526.tar.xz
seaweedfs-60dc450091a573e99e633b6ad9d9c80761633526.zip
skip fixing read only volumes
fix https://github.com/chrislusf/seaweedfs/issues/2562
-rw-r--r--weed/shell/command_volume_fsck.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/weed/shell/command_volume_fsck.go b/weed/shell/command_volume_fsck.go
index 7a7cdee56..3302542aa 100644
--- a/weed/shell/command_volume_fsck.go
+++ b/weed/shell/command_volume_fsck.go
@@ -215,6 +215,10 @@ func (c *commandVolumeFsck) findExtraChunksInVolumeServers(volumeIdToVInfo map[u
fmt.Fprintf(writer, "Skip purging for Erasure Coded volume %d.\n", volumeId)
continue
}
+ if vinfo.isReadOnly {
+ fmt.Fprintf(writer, "Skip purging for read only volume %d.\n", volumeId)
+ continue
+ }
if inUseCount == 0 {
if err := deleteVolume(c.env.option.GrpcDialOption, needle.VolumeId(volumeId), vinfo.server); err != nil {
return fmt.Errorf("delete volume %d: %v", volumeId, err)
@@ -440,6 +444,7 @@ type VInfo struct {
server pb.ServerAddress
collection string
isEcVolume bool
+ isReadOnly bool
}
func (c *commandVolumeFsck) collectVolumeIds(commandEnv *CommandEnv, verbose bool, writer io.Writer) (volumeIdToServer map[uint32]VInfo, err error) {
@@ -462,6 +467,7 @@ func (c *commandVolumeFsck) collectVolumeIds(commandEnv *CommandEnv, verbose boo
server: pb.NewServerAddressFromDataNode(t),
collection: vi.Collection,
isEcVolume: false,
+ isReadOnly: vi.ReadOnly,
}
}
for _, ecShardInfo := range diskInfo.EcShardInfos {
@@ -469,6 +475,7 @@ func (c *commandVolumeFsck) collectVolumeIds(commandEnv *CommandEnv, verbose boo
server: pb.NewServerAddressFromDataNode(t),
collection: ecShardInfo.Collection,
isEcVolume: true,
+ isReadOnly: true,
}
}
}