@@ -205,11 +205,6 @@ func validateReliable(lg *zap.Logger, replay *model.EtcdReplay, report report.Cl
205
205
gotEvents = append (gotEvents , event .PersistedEvent )
206
206
}
207
207
}
208
- // TODO(https://github.com/etcd-io/etcd/issues/18089): Remove when bug is fixed
209
- detected , newWantEvents := checkIssue18089 (lg , report .ClientID , wantEvents , gotEvents , replay )
210
- if detected {
211
- wantEvents = newWantEvents
212
- }
213
208
if diff := cmp .Diff (wantEvents , gotEvents , cmpopts .IgnoreFields (model.PersistedEvent {}, "IsCreate" )); diff != "" {
214
209
lg .Error ("Broke watch guarantee" , zap .String ("guarantee" , "reliable" ), zap .Int ("client" , report .ClientID ), zap .String ("diff" , diff ))
215
210
err = errBrokeReliable
@@ -223,22 +218,18 @@ func validateResumable(lg *zap.Logger, replay *model.EtcdReplay, report report.C
223
218
if watch .Request .Revision == 0 {
224
219
continue
225
220
}
226
- wantEvents := replay .EventsForWatch (watch .Request )
221
+ events := replay .EventsForWatch (watch .Request )
227
222
index := 0
228
- for index < len (wantEvents ) && (wantEvents [index ].Revision < watch .Request .Revision || ! wantEvents [index ].Match (watch .Request )) {
223
+ for index < len (events ) && (events [index ].Revision < watch .Request .Revision || ! events [index ].Match (watch .Request )) {
229
224
index ++
230
225
}
231
- if index == len (wantEvents ) {
226
+ if index == len (events ) {
232
227
continue
233
228
}
234
- gotFirstEvent := firstWatchEvent (watch )
229
+ firstEvent := firstWatchEvent (watch )
235
230
// If watch is resumable, first event it gets should the first event that happened after the requested revision.
236
- if gotFirstEvent != nil && wantEvents [index ] != gotFirstEvent .PersistedEvent {
237
- // TODO(https://github.com/etcd-io/etcd/issues/18089): Remove when bug is fixed
238
- if detected , _ := checkIssue18089 (lg , report .ClientID , wantEvents , []model.PersistedEvent {gotFirstEvent .PersistedEvent }, replay ); detected {
239
- continue
240
- }
241
- lg .Error ("Broke watch guarantee" , zap .String ("guarantee" , "resumable" ), zap .Int ("client" , report .ClientID ), zap .Any ("request" , watch .Request ), zap .Any ("got-event" , * gotFirstEvent ), zap .Any ("want-event" , wantEvents [index ]))
231
+ if firstEvent != nil && events [index ] != firstEvent .PersistedEvent {
232
+ lg .Error ("Broke watch guarantee" , zap .String ("guarantee" , "resumable" ), zap .Int ("client" , report .ClientID ), zap .Any ("request" , watch .Request ), zap .Any ("got-event" , * firstEvent ), zap .Any ("want-event" , events [index ]))
242
233
err = errBrokeResumable
243
234
}
244
235
}
@@ -341,41 +332,3 @@ func firstWatchEvent(op model.WatchOperation) *model.WatchEvent {
341
332
}
342
333
return nil
343
334
}
344
-
345
- func checkIssue18089 (lg * zap.Logger , clientID int , want , got []model.PersistedEvent , replay * model.EtcdReplay ) (bool , []model.PersistedEvent ) {
346
- type keyRevision struct {
347
- Key string
348
- Revision int64
349
- }
350
- gotKeyRevision := map [keyRevision ]struct {}{}
351
- for _ , event := range got {
352
- gotKeyRevision [keyRevision {
353
- Key : event .Key ,
354
- Revision : event .Revision ,
355
- }] = struct {}{}
356
- }
357
- newWant := []model.PersistedEvent {}
358
- issueDetected := false
359
- for _ , event := range want {
360
- _ , found := gotKeyRevision [keyRevision {
361
- Key : event .Key ,
362
- Revision : event .Revision ,
363
- }]
364
- if ! found && event .Type == model .DeleteOperation && matchingCompaction (event .Revision , replay ) {
365
- issueDetected = true
366
- lg .Info ("Detected issue 18089 still present, missing delete watch event for a compacted revision" , zap .Int ("client" , clientID ), zap .Any ("missing-event" , event ))
367
- continue
368
- }
369
- newWant = append (newWant , event )
370
- }
371
- return issueDetected , newWant
372
- }
373
-
374
- func matchingCompaction (revision int64 , replay * model.EtcdReplay ) bool {
375
- for _ , req := range replay .Requests {
376
- if req .Type == model .Compact && req .Compact .Revision == revision {
377
- return true
378
- }
379
- }
380
- return false
381
- }
0 commit comments