etcd-tester: fix compact rev counting

This commit is contained in:
Gyu-Ho Lee 2016-08-22 22:58:44 -07:00
parent 028b954052
commit 0c37df7265

View File

@ -50,6 +50,7 @@ func (tt *tester) runLoop() {
if err != nil || tt.cleanup() != nil { if err != nil || tt.cleanup() != nil {
return return
} }
prevCompactRev = 0 // reset after clean up
continue continue
} }
// -1 so that logPrefix doesn't print out 'case' // -1 so that logPrefix doesn't print out 'case'
@ -58,7 +59,7 @@ func (tt *tester) runLoop() {
revToCompact := max(0, tt.currentRevision-10000) revToCompact := max(0, tt.currentRevision-10000)
compactN := revToCompact - prevCompactRev compactN := revToCompact - prevCompactRev
timeout := 10 * time.Second timeout := 10 * time.Second
if prevCompactRev != 0 && compactN > 0 { if compactN > 0 {
timeout += time.Duration(compactN/compactQPS) * time.Second timeout += time.Duration(compactN/compactQPS) * time.Second
} }
prevCompactRev = revToCompact prevCompactRev = revToCompact
@ -69,6 +70,7 @@ func (tt *tester) runLoop() {
if err := tt.cleanup(); err != nil { if err := tt.cleanup(); err != nil {
return return
} }
prevCompactRev = 0 // reset after clean up
} }
if round > 0 && round%500 == 0 { // every 500 rounds if round > 0 && round%500 == 0 { // every 500 rounds
if err := tt.defrag(); err != nil { if err := tt.defrag(); err != nil {