adjust log or error

This commit is contained in:
Chris Lu 2019-04-21 10:14:17 -07:00
parent 316bd27f75
commit 132921ad41
4 changed files with 11 additions and 7 deletions

View file

@ -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{ message := &master_pb.VolumeLocation{
Url: dn.Url(), Url: dn.Url(),
PublicUrl: dn.PublicUrl, PublicUrl: dn.PublicUrl,

View file

@ -100,7 +100,7 @@ func (s *Store) addVolume(vid needle.VolumeId, collection string, needleMapKind
location.Directory, vid, collection, replicaPlacement, ttl) location.Directory, vid, collection, replicaPlacement, ttl)
if volume, err := NewVolume(location.Directory, collection, vid, needleMapKind, replicaPlacement, ttl, preallocate); err == nil { if volume, err := NewVolume(location.Directory, collection, vid, needleMapKind, replicaPlacement, ttl, preallocate); err == nil {
location.SetVolume(vid, volume) location.SetVolume(vid, volume)
glog.V(0).Info("add volume", vid) glog.V(0).Infof("add volume %d", vid)
s.NewVolumesChan <- master_pb.VolumeShortInformationMessage{ s.NewVolumesChan <- master_pb.VolumeShortInformationMessage{
Id: uint32(vid), Id: uint32(vid),
Collection: collection, Collection: collection,
@ -207,7 +207,7 @@ func (s *Store) Write(i needle.VolumeId, n *needle.Needle) (size uint32, err err
return return
} }
glog.V(0).Infoln("volume", i, "not found!") 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 return
} }

View file

@ -2,6 +2,7 @@ package topology
import ( import (
"errors" "errors"
"fmt"
"math/rand" "math/rand"
"github.com/chrislusf/raft" "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) { 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) vid, count, datanodes, err := t.GetVolumeLayout(option.Collection, option.ReplicaPlacement, option.Ttl).PickForWrite(count, option)
if err != nil || datanodes.Length() == 0 { if err != nil {
return "", 0, nil, errors.New("No writable volumes available!") 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) fileId, count := t.Sequence.NextFileId(count)
return needle.NewFileId(*vid, fileId, rand.Uint32()).String(), count, datanodes.Head(), nil return needle.NewFileId(*vid, fileId, rand.Uint32()).String(), count, datanodes.Head(), nil

View file

@ -81,11 +81,11 @@ func (mc *MasterClient) tryAllMasters() {
PublicUrl: volumeLocation.PublicUrl, PublicUrl: volumeLocation.PublicUrl,
} }
for _, newVid := range volumeLocation.NewVids { 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) mc.addLocation(newVid, loc)
} }
for _, deletedVid := range volumeLocation.DeletedVids { 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) mc.deleteLocation(deletedVid, loc)
} }
} }