Skip to content

Commit

Permalink
store/tikv: remove use of CommitHook transaction option in store/tikv
Browse files Browse the repository at this point in the history
Signed-off-by: disksing <i@disksing.com>
  • Loading branch information
disksing committed Apr 28, 2021
1 parent 75be70c commit 9767ef9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions store/driver/txn/txn_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ func (txn *tikvTxn) SetOption(opt int, val interface{}) {
txn.KVTxn.GetSnapshot().SetIsolationLevel(level)
case tikvstore.Pessimistic:
txn.SetPessimistic(val.(bool))
case tikvstore.CommitHook:
txn.SetCommitCallback(val.(func(string, error)))
default:
txn.KVTxn.SetOption(opt, val)
}
Expand Down
8 changes: 6 additions & 2 deletions store/tikv/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ func (txn *KVTxn) SetOption(opt int, val interface{}) {
txn.txnInfoSchema = val.(SchemaVer)
case kv.SchemaAmender:
txn.schemaAmender = val.(SchemaAmender)
case kv.CommitHook:
txn.commitCallback = val.(func(info string, err error))
}
}

Expand All @@ -211,6 +209,12 @@ func (txn *KVTxn) SetPessimistic(b bool) {
txn.isPessimistic = b
}

// SetCommitCallback sets up a function that will be called when the transaction
// is finished.
func (txn *KVTxn) SetCommitCallback(f func(string, error)) {
txn.commitCallback = f
}

// SetKVFilter sets the filter to ignore key-values in memory buffer.
func (txn *KVTxn) SetKVFilter(filter KVFilter) {
txn.kvFilter = filter
Expand Down

0 comments on commit 9767ef9

Please sign in to comment.