Skip to content

Commit

Permalink
server/leader: use the compact revision to watch leader
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <nolouch@gmail.com>
  • Loading branch information
nolouch committed Dec 26, 2018
1 parent b473e5e commit b970b14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/integration_test/leader_watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

func (s *integrationTestSuite) TestWatcher(c *C) {
c.Parallel()
cluster, err := newTestCluster(1)
cluster, err := newTestCluster(1, func(conf *server.Config) { conf.AutoCompactionRetention = "1s" }
c.Assert(err, IsNil)
defer cluster.Destroy()

Expand Down
4 changes: 2 additions & 2 deletions server/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ func (s *Server) watchLeader(leader *pdpb.Member, revision int64) {
for wresp := range rch {
// meet compacted error, use current revision.
if wresp.CompactRevision != 0 {
log.Warnf("required revision %d has been compacted, use current revision", revision)
revision = 0
revision = wresp.CompactRevision
log.Warnf("required revision %d has been compacted, use the compact revision", revision)
break
}
if wresp.Canceled {
Expand Down

0 comments on commit b970b14

Please sign in to comment.