Pārlūkot izejas kodu

storage: avoid one extra round of wait

It could exit early if it knows that there is no more keys.
Yicheng Qin 10 gadi atpakaļ
vecāks
revīzija
5ae2eb4731
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      storage/kvstore_compaction.go

+ 1 - 1
storage/kvstore_compaction.go

@@ -31,7 +31,7 @@ func (s *store) scheduleCompaction(compactMainRev int64, keep map[revision]struc
 			}
 			}
 		}
 		}
 
 
-		if len(keys) == 0 {
+		if len(keys) < int(batchsize) {
 			rbytes := make([]byte, 8+1+8)
 			rbytes := make([]byte, 8+1+8)
 			revToBytes(revision{main: compactMainRev}, rbytes)
 			revToBytes(revision{main: compactMainRev}, rbytes)
 			tx.UnsafePut(metaBucketName, finishedCompactKeyName, rbytes)
 			tx.UnsafePut(metaBucketName, finishedCompactKeyName, rbytes)