Skip to content

Commit

Permalink
etcdserver/corrupt: document data corrupt checking in checkHashKV
Browse files Browse the repository at this point in the history
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho committed Nov 20, 2017
1 parent 1ce3a41 commit 08434d0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions etcdserver/corrupt.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ func (s *EtcdServer) checkHashKV() error {

for _, resp := range resps {
id := resp.Header.MemberId

// leader expects follower's latest revision less than or equal to leader's
if resp.Header.Revision > rev2 {
plog.Warningf(
"revision %d from member %v, expected at most %d",
Expand All @@ -96,6 +98,8 @@ func (s *EtcdServer) checkHashKV() error {
rev2)
mismatch(id)
}

// leader expects follower's latest compact revision less than or equal to leader's
if resp.CompactRevision > crev2 {
plog.Warningf(
"compact revision %d from member %v, expected at most %d",
Expand All @@ -105,6 +109,8 @@ func (s *EtcdServer) checkHashKV() error {
)
mismatch(id)
}

// follower's compact revision is leader's old one, then hashes must match
if resp.CompactRevision == crev && resp.Hash != h {
plog.Warningf(
"hash %d at revision %d from member %v, expected hash %d",
Expand Down

0 comments on commit 08434d0

Please sign in to comment.