diff options
Diffstat (limited to 'weed/wdclient')
| -rw-r--r-- | weed/wdclient/exclusive_locks/exclusive_locker.go | 4 | ||||
| -rw-r--r-- | weed/wdclient/masterclient.go | 52 | ||||
| -rw-r--r-- | weed/wdclient/vid_map.go | 16 |
3 files changed, 36 insertions, 36 deletions
diff --git a/weed/wdclient/exclusive_locks/exclusive_locker.go b/weed/wdclient/exclusive_locks/exclusive_locker.go index 175718cd2..b8c3faf15 100644 --- a/weed/wdclient/exclusive_locks/exclusive_locker.go +++ b/weed/wdclient/exclusive_locks/exclusive_locker.go @@ -5,7 +5,7 @@ import ( "sync/atomic" "time" - "github.com/seaweedfs/seaweedfs/weed/glog" + "github.com/seaweedfs/seaweedfs/weed/util/log" "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" "github.com/seaweedfs/seaweedfs/weed/wdclient" ) @@ -104,7 +104,7 @@ func (l *ExclusiveLocker) RequestLock(clientName string) { } return err }); err != nil { - glog.Errorf("failed to renew lock: %v", err) + log.Errorf("failed to renew lock: %v", err) l.isLocked.Store(false) return } else { diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go index da46a440b..784d496f6 100644 --- a/weed/wdclient/masterclient.go +++ b/weed/wdclient/masterclient.go @@ -12,7 +12,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/util" "google.golang.org/grpc" - "github.com/seaweedfs/seaweedfs/weed/glog" + "github.com/seaweedfs/seaweedfs/weed/util/log" "github.com/seaweedfs/seaweedfs/weed/pb" "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" ) @@ -117,7 +117,7 @@ func (mc *MasterClient) WaitUntilConnected(ctx context.Context) { for { select { case <-ctx.Done(): - glog.V(0).Infof("Connection wait stopped: %v", ctx.Err()) + log.V(3).Infof("Connection wait stopped: %v", ctx.Err()) return default: if mc.getCurrentMaster() != "" { @@ -130,11 +130,11 @@ func (mc *MasterClient) WaitUntilConnected(ctx context.Context) { } func (mc *MasterClient) KeepConnectedToMaster(ctx context.Context) { - glog.V(1).Infof("%s.%s masterClient bootstraps with masters %v", mc.FilerGroup, mc.clientType, mc.masters) + log.V(2).Infof("%s.%s masterClient bootstraps with masters %v", mc.FilerGroup, mc.clientType, mc.masters) for { select { case <-ctx.Done(): - glog.V(0).Infof("Connection to masters stopped: %v", ctx.Err()) + log.V(3).Infof("Connection to masters stopped: %v", ctx.Err()) return default: mc.tryAllMasters(ctx) @@ -158,14 +158,14 @@ func (mc *MasterClient) FindLeaderFromOtherPeers(myMasterAddress pb.ServerAddres leader = resp.Leader return nil }); grpcErr != nil { - glog.V(0).Infof("connect to %s: %v", master, grpcErr) + log.V(3).Infof("connect to %s: %v", master, grpcErr) } if leader != "" { - glog.V(0).Infof("existing leader is %s", leader) + log.V(3).Infof("existing leader is %s", leader) return } } - glog.V(0).Infof("No existing leader found!") + log.V(3).Infof("No existing leader found!") return } @@ -177,7 +177,7 @@ func (mc *MasterClient) tryAllMasters(ctx context.Context) { for nextHintedLeader != "" { select { case <-ctx.Done(): - glog.V(0).Infof("Connection attempt to all masters stopped: %v", ctx.Err()) + log.V(3).Infof("Connection attempt to all masters stopped: %v", ctx.Err()) return default: nextHintedLeader = mc.tryConnectToMaster(ctx, nextHintedLeader) @@ -188,7 +188,7 @@ func (mc *MasterClient) tryAllMasters(ctx context.Context) { } func (mc *MasterClient) tryConnectToMaster(ctx context.Context, master pb.ServerAddress) (nextHintedLeader pb.ServerAddress) { - glog.V(1).Infof("%s.%s masterClient Connecting to master %v", mc.FilerGroup, mc.clientType, master) + log.V(2).Infof("%s.%s masterClient Connecting to master %v", mc.FilerGroup, mc.clientType, master) stats.MasterClientConnectCounter.WithLabelValues("total").Inc() gprcErr := pb.WithMasterClient(true, master, mc.grpcDialOption, false, func(client master_pb.SeaweedClient) error { ctx, cancel := context.WithCancel(ctx) @@ -196,7 +196,7 @@ func (mc *MasterClient) tryConnectToMaster(ctx context.Context, master pb.Server stream, err := client.KeepConnected(ctx) if err != nil { - glog.V(1).Infof("%s.%s masterClient failed to keep connected to %s: %v", mc.FilerGroup, mc.clientType, master, err) + log.V(2).Infof("%s.%s masterClient failed to keep connected to %s: %v", mc.FilerGroup, mc.clientType, master, err) stats.MasterClientConnectCounter.WithLabelValues(stats.FailedToKeepConnected).Inc() return err } @@ -209,15 +209,15 @@ func (mc *MasterClient) tryConnectToMaster(ctx context.Context, master pb.Server ClientAddress: string(mc.clientHost), Version: util.Version(), }); err != nil { - glog.V(0).Infof("%s.%s masterClient failed to send to %s: %v", mc.FilerGroup, mc.clientType, master, err) + log.V(3).Infof("%s.%s masterClient failed to send to %s: %v", mc.FilerGroup, mc.clientType, master, err) stats.MasterClientConnectCounter.WithLabelValues(stats.FailedToSend).Inc() return err } - glog.V(1).Infof("%s.%s masterClient Connected to %v", mc.FilerGroup, mc.clientType, master) + log.V(2).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) + log.V(3).Infof("%s.%s masterClient failed to receive from %s: %v", mc.FilerGroup, mc.clientType, master, err) stats.MasterClientConnectCounter.WithLabelValues(stats.FailedToReceive).Inc() return err } @@ -225,7 +225,7 @@ func (mc *MasterClient) tryConnectToMaster(ctx context.Context, master pb.Server // check if it is the leader to determine whether to reset the vidMap if resp.VolumeLocation != nil { if resp.VolumeLocation.Leader != "" && string(master) != resp.VolumeLocation.Leader { - glog.V(0).Infof("master %v redirected to leader %v", master, resp.VolumeLocation.Leader) + log.V(3).Infof("master %v redirected to leader %v", master, resp.VolumeLocation.Leader) nextHintedLeader = pb.ServerAddress(resp.VolumeLocation.Leader) stats.MasterClientConnectCounter.WithLabelValues(stats.RedirectedToLeader).Inc() return nil @@ -240,7 +240,7 @@ func (mc *MasterClient) tryConnectToMaster(ctx context.Context, master pb.Server for { 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) + log.V(3).Infof("%s.%s masterClient failed to receive from %s: %v", mc.FilerGroup, mc.clientType, master, err) stats.MasterClientConnectCounter.WithLabelValues(stats.FailedToReceive).Inc() return err } @@ -248,7 +248,7 @@ func (mc *MasterClient) tryConnectToMaster(ctx context.Context, master pb.Server if resp.VolumeLocation != nil { // maybe the leader is changed if resp.VolumeLocation.Leader != "" && string(mc.GetMaster(ctx)) != resp.VolumeLocation.Leader { - glog.V(0).Infof("currentMaster %v redirected to leader %v", mc.GetMaster(ctx), resp.VolumeLocation.Leader) + log.V(3).Infof("currentMaster %v redirected to leader %v", mc.GetMaster(ctx), resp.VolumeLocation.Leader) nextHintedLeader = pb.ServerAddress(resp.VolumeLocation.Leader) stats.MasterClientConnectCounter.WithLabelValues(stats.RedirectedToLeader).Inc() return nil @@ -262,9 +262,9 @@ func (mc *MasterClient) tryConnectToMaster(ctx context.Context, master pb.Server if mc.OnPeerUpdate != nil { if update.FilerGroup == mc.FilerGroup { if update.IsAdd { - glog.V(0).Infof("+ %s@%s noticed %s.%s %s\n", mc.clientType, mc.clientHost, update.FilerGroup, update.NodeType, update.Address) + log.V(3).Infof("+ %s@%s noticed %s.%s %s\n", mc.clientType, mc.clientHost, update.FilerGroup, update.NodeType, update.Address) } else { - glog.V(0).Infof("- %s@%s noticed %s.%s %s\n", mc.clientType, mc.clientHost, update.FilerGroup, update.NodeType, update.Address) + log.V(3).Infof("- %s@%s noticed %s.%s %s\n", mc.clientType, mc.clientHost, update.FilerGroup, update.NodeType, update.Address) } stats.MasterClientConnectCounter.WithLabelValues(stats.OnPeerUpdate).Inc() mc.OnPeerUpdate(update, time.Now()) @@ -273,21 +273,21 @@ func (mc *MasterClient) tryConnectToMaster(ctx context.Context, master pb.Server mc.OnPeerUpdateLock.RUnlock() } if err := ctx.Err(); err != nil { - glog.V(0).Infof("Connection attempt to master stopped: %v", err) + log.V(3).Infof("Connection attempt to master stopped: %v", err) return err } } }) if gprcErr != nil { stats.MasterClientConnectCounter.WithLabelValues(stats.Failed).Inc() - glog.V(1).Infof("%s.%s masterClient failed to connect with master %v: %v", mc.FilerGroup, mc.clientType, master, gprcErr) + log.V(2).Infof("%s.%s masterClient failed to connect with master %v: %v", mc.FilerGroup, mc.clientType, master, gprcErr) } return } func (mc *MasterClient) updateVidMap(resp *master_pb.KeepConnectedResponse) { if resp.VolumeLocation.IsEmptyUrl() { - glog.V(0).Infof("updateVidMap ignore short heartbeat: %+v", resp) + log.V(3).Infof("updateVidMap ignore short heartbeat: %+v", resp) return } // process new volume location @@ -298,22 +298,22 @@ func (mc *MasterClient) updateVidMap(resp *master_pb.KeepConnectedResponse) { GrpcPort: int(resp.VolumeLocation.GrpcPort), } for _, newVid := range resp.VolumeLocation.NewVids { - glog.V(2).Infof("%s.%s: %s masterClient adds volume %d", mc.FilerGroup, mc.clientType, loc.Url, newVid) + log.V(1).Infof("%s.%s: %s masterClient adds volume %d", mc.FilerGroup, mc.clientType, loc.Url, newVid) mc.addLocation(newVid, loc) } for _, deletedVid := range resp.VolumeLocation.DeletedVids { - glog.V(2).Infof("%s.%s: %s masterClient removes volume %d", mc.FilerGroup, mc.clientType, loc.Url, deletedVid) + log.V(1).Infof("%s.%s: %s masterClient removes volume %d", mc.FilerGroup, mc.clientType, loc.Url, deletedVid) mc.deleteLocation(deletedVid, loc) } for _, newEcVid := range resp.VolumeLocation.NewEcVids { - glog.V(2).Infof("%s.%s: %s masterClient adds ec volume %d", mc.FilerGroup, mc.clientType, loc.Url, newEcVid) + log.V(1).Infof("%s.%s: %s masterClient adds ec volume %d", mc.FilerGroup, mc.clientType, loc.Url, newEcVid) mc.addEcLocation(newEcVid, loc) } for _, deletedEcVid := range resp.VolumeLocation.DeletedEcVids { - glog.V(2).Infof("%s.%s: %s masterClient removes ec volume %d", mc.FilerGroup, mc.clientType, loc.Url, deletedEcVid) + log.V(1).Infof("%s.%s: %s masterClient removes ec volume %d", mc.FilerGroup, mc.clientType, loc.Url, deletedEcVid) mc.deleteEcLocation(deletedEcVid, loc) } - glog.V(1).Infof("updateVidMap(%s) %s.%s: %s volume add: %d, del: %d, add ec: %d del ec: %d", + log.V(2).Infof("updateVidMap(%s) %s.%s: %s volume add: %d, del: %d, add ec: %d del ec: %d", resp.VolumeLocation.DataCenter, mc.FilerGroup, mc.clientType, loc.Url, len(resp.VolumeLocation.NewVids), len(resp.VolumeLocation.DeletedVids), len(resp.VolumeLocation.NewEcVids), len(resp.VolumeLocation.DeletedEcVids)) diff --git a/weed/wdclient/vid_map.go b/weed/wdclient/vid_map.go index 7a2a5bb92..966c199eb 100644 --- a/weed/wdclient/vid_map.go +++ b/weed/wdclient/vid_map.go @@ -10,7 +10,7 @@ import ( "sync" "sync/atomic" - "github.com/seaweedfs/seaweedfs/weed/glog" + "github.com/seaweedfs/seaweedfs/weed/util/log" ) const ( @@ -72,7 +72,7 @@ func (vc *vidMap) isSameDataCenter(loc *Location) bool { func (vc *vidMap) LookupVolumeServerUrl(vid string) (serverUrls []string, err error) { id, err := strconv.Atoi(vid) if err != nil { - glog.V(1).Infof("Unknown volume id %s", vid) + log.V(2).Infof("Unknown volume id %s", vid) return nil, err } @@ -117,7 +117,7 @@ func (vc *vidMap) LookupFileId(fileId string) (fullUrls []string, err error) { func (vc *vidMap) GetVidLocations(vid string) (locations []Location, err error) { id, err := strconv.Atoi(vid) if err != nil { - glog.V(1).Infof("Unknown volume id %s", vid) + log.V(2).Infof("Unknown volume id %s", vid) return nil, fmt.Errorf("Unknown volume id %s", vid) } foundLocations, found := vc.GetLocations(uint32(id)) @@ -128,7 +128,7 @@ func (vc *vidMap) GetVidLocations(vid string) (locations []Location, err error) } func (vc *vidMap) GetLocations(vid uint32) (locations []Location, found bool) { - // glog.V(4).Infof("~ lookup volume id %d: %+v ec:%+v", vid, vc.vid2Locations, vc.ecVid2Locations) + // log.V(-1).Infof("~ lookup volume id %d: %+v ec:%+v", vid, vc.vid2Locations, vc.ecVid2Locations) locations, found = vc.getLocations(vid) if found && len(locations) > 0 { return locations, found @@ -170,7 +170,7 @@ func (vc *vidMap) addLocation(vid uint32, location Location) { vc.Lock() defer vc.Unlock() - glog.V(4).Infof("+ volume id %d: %+v", vid, location) + log.V(-1).Infof("+ volume id %d: %+v", vid, location) locations, found := vc.vid2Locations[vid] if !found { @@ -192,7 +192,7 @@ func (vc *vidMap) addEcLocation(vid uint32, location Location) { vc.Lock() defer vc.Unlock() - glog.V(4).Infof("+ ec volume id %d: %+v", vid, location) + log.V(-1).Infof("+ ec volume id %d: %+v", vid, location) locations, found := vc.ecVid2Locations[vid] if !found { @@ -218,7 +218,7 @@ func (vc *vidMap) deleteLocation(vid uint32, location Location) { vc.Lock() defer vc.Unlock() - glog.V(4).Infof("- volume id %d: %+v", vid, location) + log.V(-1).Infof("- volume id %d: %+v", vid, location) locations, found := vc.vid2Locations[vid] if !found { @@ -241,7 +241,7 @@ func (vc *vidMap) deleteEcLocation(vid uint32, location Location) { vc.Lock() defer vc.Unlock() - glog.V(4).Infof("- ec volume id %d: %+v", vid, location) + log.V(-1).Infof("- ec volume id %d: %+v", vid, location) locations, found := vc.ecVid2Locations[vid] if !found { |
