From 132921ad4183bb42cee992661be57e12c5f63981 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 21 Apr 2019 10:14:17 -0700 Subject: [PATCH] adjust log or error --- weed/server/master_grpc_server.go | 2 +- weed/storage/store.go | 4 ++-- weed/topology/topology.go | 8 ++++++-- weed/wdclient/masterclient.go | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/weed/server/master_grpc_server.go b/weed/server/master_grpc_server.go index f06f5a278..0bcde6851 100644 --- a/weed/server/master_grpc_server.go +++ b/weed/server/master_grpc_server.go @@ -72,7 +72,7 @@ func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServ } } - glog.V(1).Infof("master received heartbeat %s", heartbeat.String()) + glog.V(2).Infof("master received heartbeat %s", heartbeat.String()) message := &master_pb.VolumeLocation{ Url: dn.Url(), PublicUrl: dn.PublicUrl, diff --git a/weed/storage/store.go b/weed/storage/store.go index 2f2c70171..b870cee4e 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -100,7 +100,7 @@ func (s *Store) addVolume(vid needle.VolumeId, collection string, needleMapKind location.Directory, vid, collection, replicaPlacement, ttl) if volume, err := NewVolume(location.Directory, collection, vid, needleMapKind, replicaPlacement, ttl, preallocate); err == nil { location.SetVolume(vid, volume) - glog.V(0).Info("add volume", vid) + glog.V(0).Infof("add volume %d", vid) s.NewVolumesChan <- master_pb.VolumeShortInformationMessage{ Id: uint32(vid), Collection: collection, @@ -207,7 +207,7 @@ func (s *Store) Write(i needle.VolumeId, n *needle.Needle) (size uint32, err err return } glog.V(0).Infoln("volume", i, "not found!") - err = fmt.Errorf("Volume %d not found!", i) + err = fmt.Errorf("volume %d not found on %s:%d", i, s.Ip, s.Port) return } diff --git a/weed/topology/topology.go b/weed/topology/topology.go index 44dd1484b..902e89bd1 100644 --- a/weed/topology/topology.go +++ b/weed/topology/topology.go @@ -2,6 +2,7 @@ package topology import ( "errors" + "fmt" "math/rand" "github.com/chrislusf/raft" @@ -105,8 +106,11 @@ func (t *Topology) HasWritableVolume(option *VolumeGrowOption) bool { func (t *Topology) PickForWrite(count uint64, option *VolumeGrowOption) (string, uint64, *DataNode, error) { vid, count, datanodes, err := t.GetVolumeLayout(option.Collection, option.ReplicaPlacement, option.Ttl).PickForWrite(count, option) - if err != nil || datanodes.Length() == 0 { - return "", 0, nil, errors.New("No writable volumes available!") + if err != nil { + return "", 0, nil, fmt.Errorf("failed to find writable volumes for collectio:%s replication:%s ttl:%s error: %v", option.Collection, option.ReplicaPlacement.String(), option.Ttl.String(), err) + } + if datanodes.Length() == 0 { + return "", 0, nil, fmt.Errorf("no writable volumes available for for collectio:%s replication:%s ttl:%s", option.Collection, option.ReplicaPlacement.String(), option.Ttl.String()) } fileId, count := t.Sequence.NextFileId(count) return needle.NewFileId(*vid, fileId, rand.Uint32()).String(), count, datanodes.Head(), nil diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go index 9cdcc3235..e16356e9d 100644 --- a/weed/wdclient/masterclient.go +++ b/weed/wdclient/masterclient.go @@ -81,11 +81,11 @@ func (mc *MasterClient) tryAllMasters() { PublicUrl: volumeLocation.PublicUrl, } for _, newVid := range volumeLocation.NewVids { - glog.V(0).Infof("%s: %s adds volume %d", mc.name, loc.Url, newVid) + glog.V(1).Infof("%s: %s adds volume %d", mc.name, loc.Url, newVid) mc.addLocation(newVid, loc) } for _, deletedVid := range volumeLocation.DeletedVids { - glog.V(0).Infof("%s: %s removes volume %d", mc.name, loc.Url, deletedVid) + glog.V(1).Infof("%s: %s removes volume %d", mc.name, loc.Url, deletedVid) mc.deleteLocation(deletedVid, loc) } }