File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
staging/src/k8s.io/apiserver/pkg/storage/etcd3 Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,15 @@ func (wc *watchChan) sync() error {
191
191
return nil
192
192
}
193
193
194
+ // logWatchChannelErr checks whether the error is about mvcc revision compaction which is regarded as warning
195
+ func logWatchChannelErr (err error ) {
196
+ if ! strings .Contains (err .Error (), "mvcc: required revision has been compacted" ) {
197
+ klog .Errorf ("watch chan error: %v" , err )
198
+ } else {
199
+ klog .Warningf ("watch chan error: %v" , err )
200
+ }
201
+ }
202
+
194
203
// startWatching does:
195
204
// - get current objects if initialRev=0; set initialRev to current rev
196
205
// - watch on given key and send events to process.
@@ -211,14 +220,14 @@ func (wc *watchChan) startWatching(watchClosedCh chan struct{}) {
211
220
if wres .Err () != nil {
212
221
err := wres .Err ()
213
222
// If there is an error on server (e.g. compaction), the channel will return it before closed.
214
- klog . Errorf ( "watch chan error: %v" , err )
223
+ logWatchChannelErr ( err )
215
224
wc .sendError (err )
216
225
return
217
226
}
218
227
for _ , e := range wres .Events {
219
228
parsedEvent , err := parseEvent (e )
220
229
if err != nil {
221
- klog . Errorf ( "watch chan error: %v" , err )
230
+ logWatchChannelErr ( err )
222
231
wc .sendError (err )
223
232
return
224
233
}
You can’t perform that action at this time.
0 commit comments