clientv3: remove excessive watch cancel logging (#12187)

release-3.5
Jingyi Hu 2020-07-30 05:58:53 +08:00 committed by GitHub
parent 6c81b20ec8
commit cc564110bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 8 deletions

View File

@ -180,6 +180,8 @@ type watchGrpcStream struct {
resumec chan struct{} resumec chan struct{}
// closeErr is the error that closed the watch stream // closeErr is the error that closed the watch stream
closeErr error closeErr error
lg *zap.Logger
} }
// watchStreamRequest is a union of the supported watch request operation types // watchStreamRequest is a union of the supported watch request operation types
@ -278,6 +280,7 @@ func (w *watcher) newWatcherGrpcStream(inctx context.Context) *watchGrpcStream {
errc: make(chan error, 1), errc: make(chan error, 1),
closingc: make(chan *watcherStream), closingc: make(chan *watcherStream),
resumec: make(chan struct{}), resumec: make(chan struct{}),
lg: w.lg,
} }
go wgs.run() go wgs.run()
return wgs return wgs
@ -555,12 +558,12 @@ func (w *watchGrpcStream) run() {
if len(w.resuming) == 1 { if len(w.resuming) == 1 {
// head of resume queue, can register a new watcher // head of resume queue, can register a new watcher
if err := wc.Send(ws.initReq.toPB()); err != nil { if err := wc.Send(ws.initReq.toPB()); err != nil {
lg.Warningf("error when sending request: %v", err) w.lg.Debug("error when sending request", zap.Error(err))
} }
} }
case *progressRequest: case *progressRequest:
if err := wc.Send(wreq.toPB()); err != nil { if err := wc.Send(wreq.toPB()); err != nil {
lg.Warningf("error when sending request: %v", err) w.lg.Debug("error when sending request", zap.Error(err))
} }
} }
@ -586,7 +589,7 @@ func (w *watchGrpcStream) run() {
if ws := w.nextResume(); ws != nil { if ws := w.nextResume(); ws != nil {
if err := wc.Send(ws.initReq.toPB()); err != nil { if err := wc.Send(ws.initReq.toPB()); err != nil {
lg.Warningf("error when sending request: %v", err) w.lg.Debug("error when sending request", zap.Error(err))
} }
} }
@ -632,9 +635,9 @@ func (w *watchGrpcStream) run() {
}, },
} }
req := &pb.WatchRequest{RequestUnion: cr} req := &pb.WatchRequest{RequestUnion: cr}
lg.Info("sending watch cancel request for failed dispatch", zap.Int64("watch-id", pbresp.WatchId)) w.lg.Debug("sending watch cancel request for failed dispatch", zap.Int64("watch-id", pbresp.WatchId))
if err := wc.Send(req); err != nil { if err := wc.Send(req); err != nil {
lg.Warning("failed to send watch cancel request", zap.Int64("watch-id", pbresp.WatchId), zap.Error(err)) w.lg.Debug("failed to send watch cancel request", zap.Int64("watch-id", pbresp.WatchId), zap.Error(err))
} }
} }
@ -649,7 +652,7 @@ func (w *watchGrpcStream) run() {
} }
if ws := w.nextResume(); ws != nil { if ws := w.nextResume(); ws != nil {
if err := wc.Send(ws.initReq.toPB()); err != nil { if err := wc.Send(ws.initReq.toPB()); err != nil {
lg.Warningf("error when sending request: %v", err) w.lg.Debug("error when sending request", zap.Error(err))
} }
} }
cancelSet = make(map[int64]struct{}) cancelSet = make(map[int64]struct{})
@ -674,9 +677,9 @@ func (w *watchGrpcStream) run() {
}, },
} }
req := &pb.WatchRequest{RequestUnion: cr} req := &pb.WatchRequest{RequestUnion: cr}
lg.Info("sending watch cancel request for closed watcher", zap.Int64("watch-id", ws.id)) w.lg.Debug("sending watch cancel request for closed watcher", zap.Int64("watch-id", ws.id))
if err := wc.Send(req); err != nil { if err := wc.Send(req); err != nil {
lg.Warning("failed to send watch cancel request", zap.Int64("watch-id", ws.id), zap.Error(err)) w.lg.Debug("failed to send watch cancel request", zap.Int64("watch-id", ws.id), zap.Error(err))
} }
} }
} }