mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge c8e050b7e0974081d9a03c1ea4ef541cb38d0585 into c86c93ca2951338115159dcdd20711603044e1f1
This commit is contained in:
commit
d235a463fc
@ -477,6 +477,16 @@ func (b *backend) defrag() error {
|
|||||||
b.readTx.Lock()
|
b.readTx.Lock()
|
||||||
defer b.readTx.Unlock()
|
defer b.readTx.Unlock()
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
// NOTE: We should exit as soon as possible because that tx
|
||||||
|
// might be closed. The inflight request might use invalid
|
||||||
|
// tx and then panic as well. The real panic reason might be
|
||||||
|
// shadowed by new panic. So, we should fatal here with lock.
|
||||||
|
if rerr := recover(); rerr != nil {
|
||||||
|
b.lg.Fatal("unexpected panic during defrag", zap.Any("panic", rerr))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
b.batchTx.unsafeCommit(true)
|
b.batchTx.unsafeCommit(true)
|
||||||
|
|
||||||
b.batchTx.tx = nil
|
b.batchTx.tx = nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user