Merge pull request #14730 from ahrtr/rev_inconsistency_20221111

etcdserver: call the OnPreCommitUnsafe in unsafeCommit
This commit is contained in:
Marek Siarkowicz 2022-11-13 13:34:39 +01:00 committed by GitHub
commit 0e4bf4ac4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,10 +329,6 @@ func (t *batchTxBuffered) CommitAndStop() {
}
func (t *batchTxBuffered) commit(stop bool) {
if t.backend.hooks != nil {
t.backend.hooks.OnPreCommitUnsafe(t)
}
// all read txs must be closed to acquire boltdb commit rwlock
t.backend.readTx.Lock()
t.unsafeCommit(stop)
@ -340,6 +336,10 @@ func (t *batchTxBuffered) commit(stop bool) {
}
func (t *batchTxBuffered) unsafeCommit(stop bool) {
if t.backend.hooks != nil {
t.backend.hooks.OnPreCommitUnsafe(t)
}
if t.backend.readTx.tx != nil {
// wait all store read transactions using the current boltdb tx to finish,
// then close the boltdb tx