Merge pull request #17862 from fuweid/update-rev-in-revMu

server/storage/mvcc: should update currentRev in revMu
This commit is contained in:
Marek Siarkowicz
2024-04-24 13:21:20 +02:00
committed by GitHub

View File

@@ -367,6 +367,17 @@ func (s *store) restore() error {
if s.currentRev < s.compactMainRev {
s.currentRev = s.compactMainRev
}
// 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
}
s.revMu.Unlock()
}
@@ -388,18 +399,6 @@ 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.RUnlock()
s.lg.Info("kvstore restored", zap.Int64("current-rev", s.currentRev))