mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
server/storage: update currentRev if scheduledCompact > currentRev
Signed-off-by: Wei Fu <fuweid89@gmail.com> (cherry picked from commit 9ea234913a99670d18b66aa23915781f89713177) Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
parent
7beff57107
commit
c06b17b9ff
@ -402,6 +402,17 @@ func (s *store) restore() error {
|
||||
}
|
||||
}
|
||||
|
||||
// If the latest revision was a tombstone revision and etcd just compacted
|
||||
// it, but crashed right before persisting the FinishedCompactRevision,
|
||||
// then it would lead to revision decreasing in bbolt db file. In such
|
||||
// a scenario, we should adjust the current revision using the scheduled
|
||||
// compact revision on bootstrap when etcd gets started again.
|
||||
//
|
||||
// See https://github.com/etcd-io/etcd/issues/17780#issuecomment-2061900231
|
||||
if s.currentRev < scheduledCompact {
|
||||
s.currentRev = scheduledCompact
|
||||
}
|
||||
|
||||
tx.Unlock()
|
||||
|
||||
s.lg.Info("kvstore restored", zap.Int64("current-rev", s.currentRev))
|
||||
|
Loading…
x
Reference in New Issue
Block a user