Browse Source

Merge pull request #6279 from xiang90/fix_hash

mvcc: force commit and hash should be atomic for getting hash
Xiang Li 9 years ago
parent
commit
0be190df4d
1 changed files with 1 additions and 2 deletions
  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