Browse Source

adjust log or error

pull/942/head
Chris Lu 6 years ago
parent
commit
132921ad41
  1. 2
      weed/server/master_grpc_server.go
  2. 4
      weed/storage/store.go
  3. 8
      weed/topology/topology.go
  4. 4
      weed/wdclient/masterclient.go

2
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,

4
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
}

8
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

4
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)
}
}

Loading…
Cancel
Save