File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ use tokio::sync::RwLock;
25
25
// FIXME: these numbers and how they are used are all just cargo-culted in, there
26
26
// may be more optimal values.
27
27
const RECONNECT_INTERVAL_SEC : u64 = 1 ;
28
- const MAX_REQUEST_COUNT : usize = 3 ;
28
+ const MAX_REQUEST_COUNT : usize = 5 ;
29
29
const LEADER_CHANGE_RETRY : usize = 10 ;
30
30
31
31
/// Client for communication with a PD cluster. Has the facility to reconnect to the cluster.
Original file line number Diff line number Diff line change @@ -325,11 +325,12 @@ async fn txn_bank_transfer() -> Result<()> {
325
325
init ( ) . await ?;
326
326
let client = TransactionClient :: new ( pd_addrs ( ) ) . await ?;
327
327
let mut rng = thread_rng ( ) ;
328
+ let options = TransactionOptions :: new_optimistic ( )
329
+ . use_async_commit ( )
330
+ . drop_check ( tikv_client:: CheckLevel :: Warn ) ;
328
331
329
332
let people = gen_u32_keys ( NUM_PEOPLE , & mut rng) ;
330
- let mut txn = client
331
- . begin_with_options ( TransactionOptions :: new_optimistic ( ) )
332
- . await ?;
333
+ let mut txn = client. begin_with_options ( options. clone ( ) ) . await ?;
333
334
let mut sum: u32 = 0 ;
334
335
for person in & people {
335
336
let init = rng. gen :: < u8 > ( ) as u32 ;
@@ -340,9 +341,7 @@ async fn txn_bank_transfer() -> Result<()> {
340
341
341
342
// transfer
342
343
for _ in 0 ..NUM_TRNASFER {
343
- let mut txn = client
344
- . begin_with_options ( TransactionOptions :: new_optimistic ( ) . use_async_commit ( ) )
345
- . await ?;
344
+ let mut txn = client. begin_with_options ( options. clone ( ) ) . await ?;
346
345
let chosen_people = people. iter ( ) . choose_multiple ( & mut rng, 2 ) ;
347
346
let alice = chosen_people[ 0 ] ;
348
347
let mut alice_balance = get_txn_u32 ( & mut txn, alice. clone ( ) ) . await ?;
You can’t perform that action at this time.
0 commit comments