소스 검색

mvcc: add a TODO in (*store).Hash, to warn against potential data race of currentRev and suggest feasible fix

Ziheng Liu 6 년 전
부모
커밋
077dd74827
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      mvcc/kvstore.go

+ 1 - 0
mvcc/kvstore.go

@@ -165,6 +165,7 @@ func (s *store) compactBarrier(ctx context.Context, ch chan struct{}) {
 }
 }
 
 
 func (s *store) Hash() (hash uint32, revision int64, err error) {
 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()
 	start := time.Now()
 
 
 	s.b.ForceCommit()
 	s.b.ForceCommit()