mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
mvcc: should update currentRev in revMu
Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
parent
41eb03a55e
commit
4cb197e0fa
@ -450,6 +450,17 @@ func (s *store) restore() error {
|
||||
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
|
||||
}
|
||||
|
||||
if scheduledCompact <= s.compactMainRev {
|
||||
scheduledCompact = 0
|
||||
}
|
||||
@ -474,17 +485,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.Unlock()
|
||||
|
||||
if scheduledCompact != 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user