Browse Source

storage: reject to compact on future rev

Compaction on future rev is unreasonable.
Yicheng Qin 10 years ago
parent
commit
353f10ca2b
1 changed files with 3 additions and 0 deletions
  1. 3 0
      storage/kvstore.go

+ 3 - 0
storage/kvstore.go

@@ -158,6 +158,9 @@ func (s *store) Compact(rev int64) error {
 	if rev <= s.compactMainRev {
 	if rev <= s.compactMainRev {
 		return ErrCompacted
 		return ErrCompacted
 	}
 	}
+	if rev > s.currentRev.main {
+		return ErrFutureRev
+	}
 
 
 	s.compactMainRev = rev
 	s.compactMainRev = rev