mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-07 14:57:48 +02:00
pb: return empty server address for malformed grpc addresses
GrpcAddressToServerAddress used to return the unparseable input on a hostAndPort failure, so a malformed raft address (e.g. "host:abc") flowed into admin dashboard master maps unchanged. Return an empty string instead, skip empty conversions at the two raft-cluster merge sites, and drop the now-stale comment about the fatal exit the earlier commit removed.
This commit is contained in:
1 parent
0ae7874ed9
commit
0d6024e2e0
3 files changed
+10
-4
No files matched your search
@@ -293,14 +293,17 @@ func (s *AdminServer) getMasterNodesStatus() []MasterNode {
|
||||
}
|
||||
raftCallSucceeded = true
|
||||
for _, server := range resp.ClusterServers {
|
||||
// pb.GrpcAddressToServerAddress calls glog.Fatalf on a parse
|
||||
// error, so pre-validate the raft address with net.SplitHostPort
|
||||
// and skip malformed entries instead of taking the process down.
|
||||
// Skip malformed raft addresses instead of letting an
|
||||
// unconvertible value into masterMap.
|
||||
if _, _, splitErr := net.SplitHostPort(server.Address); splitErr != nil {
|
||||
glog.Warningf("skip master with invalid raft address %q: %v", server.Address, splitErr)
|
||||
continue
|
||||
}
|
||||
httpAddress := pb.GrpcAddressToServerAddress(server.Address)
|
||||
if httpAddress == "" {
|
||||
glog.Warningf("skip master with invalid raft address %q", server.Address)
|
||||
continue
|
||||
}
|
||||
masterMap[httpAddress] = MasterNode{
|
||||
Address: httpAddress,
|
||||
IsLeader: server.IsLeader,
|
||||
|
||||
Reference in new issue
Block a user