소스 검색

mvcc: force commit and hash should be atomic for getting hash

Xiang Li 10 년 전
부모
커밋
1437388f77
1개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 2
      mvcc/kvstore.go

+ 1 - 2
mvcc/kvstore.go

@@ -323,10 +323,9 @@ func (s *store) Compact(rev int64) (<-chan struct{}, error) {
 }
 }
 
 
 func (s *store) Hash() (uint32, int64, error) {
 func (s *store) Hash() (uint32, int64, error) {
-	s.b.ForceCommit()
-
 	s.mu.Lock()
 	s.mu.Lock()
 	defer s.mu.Unlock()
 	defer s.mu.Unlock()
+	s.b.ForceCommit()
 
 
 	// ignore hash consistent index field for now.
 	// ignore hash consistent index field for now.
 	// consistent index might be changed due to v2 internal sync, which
 	// consistent index might be changed due to v2 internal sync, which