Просмотр исходного кода

Merge pull request #10975 from lzhfromustc/currentRev

Add critical section to protect s.currentRev
Jingyi Hu 6 лет назад
Родитель
Сommit
88d998be4c
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      mvcc/kvstore.go

+ 1 - 0
mvcc/kvstore.go

@@ -176,6 +176,7 @@ func (s *store) compactBarrier(ctx context.Context, ch chan struct{}) {
 }
 
 func (s *store) Hash() (hash uint32, revision int64, err error) {
+	// TODO: hash and revision could be inconsistent, one possible fix is to add s.revMu.RLock() at the beginning of function, which is costly
 	start := time.Now()
 
 	s.b.ForceCommit()