Skip to content

Commit

Permalink
use slow-log-txn to log run-in-txn (tikv#144)
Browse files Browse the repository at this point in the history
Signed-off-by: AmoebaProtozoa <[email protected]>
  • Loading branch information
AmoebaProtozoa authored and rleungx committed Jul 27, 2023
1 parent a0358a7 commit 28fcdf5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/storage/kv/etcd_kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,13 @@ func (txn *etcdTxn) LoadRange(key, endKey string, limit int) (keys []string, val
return keys, values, err
}

// commit perform the operations on etcd, with pre-condition that values observed by user has not been changed.
// commit perform the operations on etcd, with pre-condition that values observed by user have not been changed.
func (txn *etcdTxn) commit() error {
baseTxn := txn.kv.client.Txn(txn.ctx)
baseTxn.If(txn.conditions...)
baseTxn.Then(txn.operations...)
resp, err := baseTxn.Commit()
// Using slowLogTxn to commit transaction.
slowLogTxn := NewSlowLogTxn(txn.kv.client)
slowLogTxn.If(txn.conditions...)
slowLogTxn.Then(txn.operations...)
resp, err := slowLogTxn.Commit()
if err != nil {
return err
}
Expand Down

0 comments on commit 28fcdf5

Please sign in to comment.