From 60dc450091a573e99e633b6ad9d9c80761633526 Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 6 Jan 2022 09:52:28 -0800 Subject: [PATCH] skip fixing read only volumes fix https://github.com/chrislusf/seaweedfs/issues/2562 --- weed/shell/command_volume_fsck.go | 7 +++++++ 1 file changed, 7 insertions(+) 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, } } }