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;
2525// FIXME: these numbers and how they are used are all just cargo-culted in, there
2626// may be more optimal values.
2727const RECONNECT_INTERVAL_SEC : u64 = 1 ;
28- const MAX_REQUEST_COUNT : usize = 3 ;
28+ const MAX_REQUEST_COUNT : usize = 5 ;
2929const LEADER_CHANGE_RETRY : usize = 10 ;
3030
3131/// 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<()> {
325325 init ( ) . await ?;
326326 let client = TransactionClient :: new ( pd_addrs ( ) ) . await ?;
327327 let mut rng = thread_rng ( ) ;
328+ let options = TransactionOptions :: new_optimistic ( )
329+ . use_async_commit ( )
330+ . drop_check ( tikv_client:: CheckLevel :: Warn ) ;
328331
329332 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 ?;
333334 let mut sum: u32 = 0 ;
334335 for person in & people {
335336 let init = rng. gen :: < u8 > ( ) as u32 ;
@@ -340,9 +341,7 @@ async fn txn_bank_transfer() -> Result<()> {
340341
341342 // transfer
342343 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 ?;
346345 let chosen_people = people. iter ( ) . choose_multiple ( & mut rng, 2 ) ;
347346 let alice = chosen_people[ 0 ] ;
348347 let mut alice_balance = get_txn_u32 ( & mut txn, alice. clone ( ) ) . await ?;
You can’t perform that action at this time.
0 commit comments