Przeglądaj źródła

storage: ensure that desired compaction is persisted

It needs to persist the desired compaction, so it won't forget the compaction
if it crashes later.
Yicheng Qin 11 lat temu
rodzic
commit
6d97dcaf3f
1 zmienionych plików z 2 dodań i 0 usunięć
  1. 2 0
      storage/kvstore.go

+ 2 - 0
storage/kvstore.go

@@ -171,6 +171,8 @@ func (s *store) Compact(rev int64) error {
 	tx.Lock()
 	tx.UnsafePut(metaBucketName, scheduledCompactKeyName, rbytes)
 	tx.Unlock()
+	// ensure that desired compaction is persisted
+	s.b.ForceCommit()
 
 	keep := s.kvindex.Compact(rev)