@@ -290,8 +290,6 @@ func (h *AppendableHistory) appendFailed(request EtcdRequest, start, end time.Du
290
290
}
291
291
isRead := request .IsRead ()
292
292
if ! isRead {
293
- // Failed writes can still be persisted, setting -1 for now as don't know when request has took effect.
294
- op .Return = - 1
295
293
// Operations of single client needs to be sequential.
296
294
// As we don't know return time of failed operations, all new writes need to be done with new stream id.
297
295
h .streamID = h .idProvider .NewStreamID ()
@@ -300,7 +298,7 @@ func (h *AppendableHistory) appendFailed(request EtcdRequest, start, end time.Du
300
298
}
301
299
302
300
func (h * AppendableHistory ) append (op porcupine.Operation ) {
303
- if op .Return != - 1 && op . Call >= op .Return {
301
+ if op .Call >= op .Return {
304
302
panic (fmt .Sprintf ("Invalid operation, call(%d) >= return(%d)" , op .Call , op .Return ))
305
303
}
306
304
if len (h .operations ) > 0 {
@@ -488,36 +486,10 @@ func (h History) Len() int {
488
486
489
487
func (h History ) Operations () []porcupine.Operation {
490
488
operations := make ([]porcupine.Operation , 0 , len (h .operations ))
491
- maxTime := h .lastObservedTime ()
492
- for _ , op := range h .operations {
493
- // Failed requests don't have a known return time.
494
- if op .Return == - 1 {
495
- // Simulate Infinity by using last observed time.
496
- op .Return = maxTime + time .Second .Nanoseconds ()
497
- }
498
- operations = append (operations , op )
499
- }
489
+ operations = append (operations , h .operations ... )
500
490
return operations
501
491
}
502
492
503
- func (h History ) lastObservedTime () int64 {
504
- var maxTime int64
505
- for _ , op := range h .operations {
506
- if op .Return == - 1 {
507
- // Collect call time from failed operations
508
- if op .Call > maxTime {
509
- maxTime = op .Call
510
- }
511
- } else {
512
- // Collect return time from successful operations
513
- if op .Return > maxTime {
514
- maxTime = op .Return
515
- }
516
- }
517
- }
518
- return maxTime
519
- }
520
-
521
493
func (h History ) MaxRevision () int64 {
522
494
var maxRevision int64
523
495
for _ , op := range h .operations {
0 commit comments