mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
mvcc: expose 'backend.IgnoreKey'
This commit is contained in:
parent
18739e766a
commit
4e1d3f0f52
@ -322,19 +322,23 @@ func (s *store) Compact(rev int64) (<-chan struct{}, error) {
|
|||||||
return ch, nil
|
return ch, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DefaultIgnores is a map of keys to ignore in hash checking.
|
||||||
|
var DefaultIgnores map[backend.IgnoreKey]struct{}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
DefaultIgnores = map[backend.IgnoreKey]struct{}{
|
||||||
|
// consistent index might be changed due to v2 internal sync, which
|
||||||
|
// is not controllable by the user.
|
||||||
|
{Bucket: string(metaBucketName), Key: string(consistentIndexKeyName)}: {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *store) Hash() (uint32, int64, error) {
|
func (s *store) Hash() (uint32, int64, error) {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
defer s.mu.Unlock()
|
defer s.mu.Unlock()
|
||||||
s.b.ForceCommit()
|
s.b.ForceCommit()
|
||||||
|
|
||||||
// ignore hash consistent index field for now.
|
h, err := s.b.Hash(DefaultIgnores)
|
||||||
// consistent index might be changed due to v2 internal sync, which
|
|
||||||
// is not controllable by the user.
|
|
||||||
ignores := make(map[backend.IgnoreKey]struct{})
|
|
||||||
bk := backend.IgnoreKey{Bucket: string(metaBucketName), Key: string(consistentIndexKeyName)}
|
|
||||||
ignores[bk] = struct{}{}
|
|
||||||
|
|
||||||
h, err := s.b.Hash(ignores)
|
|
||||||
rev := s.currentRev.main
|
rev := s.currentRev.main
|
||||||
return h, rev, err
|
return h, rev, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user