Skip to content

Commit 5f387e6

Browse files
authored
Merge pull request #14733 from ahrtr/rev_inconsistency_3.5
[3.5] etcdserver: call the OnPreCommitUnsafe in unsafeCommit
2 parents c2378be + 563713e commit 5f387e6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

server/mvcc/backend/batch_tx.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,17 +329,16 @@ func (t *batchTxBuffered) CommitAndStop() {
329329
}
330330

331331
func (t *batchTxBuffered) commit(stop bool) {
332-
if t.backend.hooks != nil {
333-
t.backend.hooks.OnPreCommitUnsafe(t)
334-
}
335-
336332
// all read txs must be closed to acquire boltdb commit rwlock
337333
t.backend.readTx.Lock()
338334
t.unsafeCommit(stop)
339335
t.backend.readTx.Unlock()
340336
}
341337

342338
func (t *batchTxBuffered) unsafeCommit(stop bool) {
339+
if t.backend.hooks != nil {
340+
t.backend.hooks.OnPreCommitUnsafe(t)
341+
}
343342
if t.backend.readTx.tx != nil {
344343
// wait all store read transactions using the current boltdb tx to finish,
345344
// then close the boltdb tx

0 commit comments

Comments
 (0)