Skip to content

Commit

Permalink
Merge pull request #14733 from ahrtr/rev_inconsistency_3.5
Browse files Browse the repository at this point in the history
[3.5] etcdserver: call the OnPreCommitUnsafe in unsafeCommit
  • Loading branch information
ahrtr committed Nov 14, 2022
2 parents c2378be + 563713e commit 5f387e6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions server/mvcc/backend/batch_tx.go
Expand Up @@ -329,17 +329,16 @@ 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)
t.backend.readTx.Unlock()
}

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
Expand Down

0 comments on commit 5f387e6

Please sign in to comment.