aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaehyung Lim <ehooizlo@gmail.com>2024-06-12 14:22:57 +0900
committerGitHub <noreply@github.com>2024-06-11 22:22:57 -0700
commit4744889973536c8bc72de3c5d91650ea53193745 (patch)
tree6dcfa891a10ff9d45015e3712bfdea324c0c96b4
parent018d2d4012c041463f648c45a5459e5271b05eb0 (diff)
downloadseaweedfs-4744889973536c8bc72de3c5d91650ea53193745.tar.xz
seaweedfs-4744889973536c8bc72de3c5d91650ea53193745.zip
fix issue: sometimes volume.fsck report 'volume not found' (#5537)
* fix issue: sometimes volume.fsck report 'volume not found' when a volume server has multiple disk types * rename variable * adjust counters --------- Co-authored-by: chrislu <chris.lu@gmail.com>
-rw-r--r--weed/shell/command_volume_fsck.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/weed/shell/command_volume_fsck.go b/weed/shell/command_volume_fsck.go
index d85a9e13f..1d27fae1d 100644
--- a/weed/shell/command_volume_fsck.go
+++ b/weed/shell/command_volume_fsck.go
@@ -651,9 +651,12 @@ func (c *commandVolumeFsck) collectVolumeIds() (volumeIdToServer map[string]map[
}
eachDataNode(topologyInfo, func(dc string, rack RackId, t *master_pb.DataNodeInfo) {
+ var volumeCount, ecShardCount int
+ dataNodeId := t.GetId()
for _, diskInfo := range t.DiskInfos {
- dataNodeId := t.GetId()
- volumeIdToServer[dataNodeId] = make(map[uint32]VInfo)
+ if _, ok := volumeIdToServer[dataNodeId]; !ok {
+ volumeIdToServer[dataNodeId] = make(map[uint32]VInfo)
+ }
for _, vi := range diskInfo.VolumeInfos {
volumeIdToServer[dataNodeId][vi.Id] = VInfo{
server: pb.NewServerAddressFromDataNode(t),
@@ -661,6 +664,7 @@ func (c *commandVolumeFsck) collectVolumeIds() (volumeIdToServer map[string]map[
isEcVolume: false,
isReadOnly: vi.ReadOnly,
}
+ volumeCount += 1
}
for _, ecShardInfo := range diskInfo.EcShardInfos {
volumeIdToServer[dataNodeId][ecShardInfo.Id] = VInfo{
@@ -669,10 +673,11 @@ func (c *commandVolumeFsck) collectVolumeIds() (volumeIdToServer map[string]map[
isEcVolume: true,
isReadOnly: true,
}
+ ecShardCount += 1
}
- if *c.verbose {
- fmt.Fprintf(c.writer, "dn %+v collected %d volumes and locations.\n", dataNodeId, len(volumeIdToServer[dataNodeId]))
- }
+ }
+ if *c.verbose {
+ fmt.Fprintf(c.writer, "dn %+v collected %d volumes and %d ec shards.\n", dataNodeId, volumeCount, ecShardCount)
}
})
return