diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-06-24 23:06:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-24 23:06:13 -0700 |
| commit | dc59ccd110a321db7d0b0480631aa95a3d9ba7e6 (patch) | |
| tree | 4b76d281c34d47da18d9e05923b1cbf8eb26ef28 | |
| parent | 9c517d2b358da00c6d8fe638eaa6e8551c65aa8d (diff) | |
| parent | f1ea906c13177fc719797f5ea9bf5b870a32f500 (diff) | |
| download | seaweedfs-dc59ccd110a321db7d0b0480631aa95a3d9ba7e6.tar.xz seaweedfs-dc59ccd110a321db7d0b0480631aa95a3d9ba7e6.zip | |
Merge pull request #3228 from shichanglin5/fix_volumeNotFound
When the connection with the leader is disconnected, the vidMap shoul…
| -rw-r--r-- | weed/wdclient/masterclient.go | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go index a6f7e49a4..def4a9a71 100644 --- a/weed/wdclient/masterclient.go +++ b/weed/wdclient/masterclient.go @@ -128,7 +128,6 @@ func (mc *MasterClient) tryAllMasters() { } mc.currentMaster = "" - mc.vidMap = newVidMap("") } } @@ -156,9 +155,25 @@ func (mc *MasterClient) tryConnectToMaster(master pb.ServerAddress) (nextHintedL stats.MasterClientConnectCounter.WithLabelValues(stats.FailedToSend).Inc() return err } - glog.V(1).Infof("%s.%s masterClient Connected to %v", mc.FilerGroup, mc.clientType, master) + + resp, err := stream.Recv() + if err != nil { + glog.V(0).Infof("%s.%s masterClient failed to receive from %s: %v", mc.FilerGroup, mc.clientType, master, err) + stats.MasterClientConnectCounter.WithLabelValues(stats.FailedToReceive).Inc() + return err + } + + // check if it is the leader to determine whether to reset the vidMap + if resp.VolumeLocation != nil && resp.VolumeLocation.Leader != "" { + glog.V(0).Infof("redirected to leader %v", resp.VolumeLocation.Leader) + nextHintedLeader = pb.ServerAddress(resp.VolumeLocation.Leader) + stats.MasterClientConnectCounter.WithLabelValues(stats.RedirectedToleader).Inc() + return nil + } + mc.currentMaster = master + mc.vidMap = newVidMap("") for { resp, err := stream.Recv() |
