etcdserver: add two failpoints for backend
1. before and after create boltDB transaction; 2. before and after writebuf back to read buffer; Signed-off-by: Benjamin Wang <wachao@vmware.com>dependabot/go_modules/go.uber.org/atomic-1.10.0
parent
efa144a66a
commit
4f824336ad
|
@ -634,7 +634,9 @@ func (b *backend) begin(write bool) *bolt.Tx {
|
|||
}
|
||||
|
||||
func (b *backend) unsafeBegin(write bool) *bolt.Tx {
|
||||
// gofail: var beforeStartDBTxn struct{}
|
||||
tx, err := b.db.Begin(write)
|
||||
// gofail: var afterStartDBTxn struct{}
|
||||
if err != nil {
|
||||
b.lg.Fatal("failed to begin tx", zap.Error(err))
|
||||
}
|
||||
|
|
|
@ -307,7 +307,9 @@ func newBatchTxBuffered(backend *backend) *batchTxBuffered {
|
|||
func (t *batchTxBuffered) Unlock() {
|
||||
if t.pending != 0 {
|
||||
t.backend.readTx.Lock() // blocks txReadBuffer for writing.
|
||||
// gofail: var beforeWritebackBuf struct{}
|
||||
t.buf.writeback(&t.backend.readTx.buf)
|
||||
// gofail: var afterWritebackBuf struct{}
|
||||
t.backend.readTx.Unlock()
|
||||
if t.pending >= t.backend.batchLimit {
|
||||
t.commit(false)
|
||||
|
|
Loading…
Reference in New Issue