@ -572,7 +572,7 @@ Status MultiOpsTxnsStressTest::PrimaryKeyUpdateTxn(ThreadState* thread,
assert ( txn ) ;
assert ( txn ) ;
txn - > SetSnapshotOnNextOperation ( /*notifier=*/ nullptr ) ;
txn - > SetSnapshotOnNextOperation ( /*notifier=*/ nullptr ) ;
const Defer cleanup ( [ new_a , & s , thread , this ] ( ) {
const Defer cleanup ( [ new_a , & s , thread , this , & txn ] ( ) {
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
// Two gets, one for existing pk, one for locking potential new pk.
// Two gets, one for existing pk, one for locking potential new pk.
thread - > stats . AddGets ( /*ngets=*/ 2 , /*nfounds=*/ 1 ) ;
thread - > stats . AddGets ( /*ngets=*/ 2 , /*nfounds=*/ 1 ) ;
@ -594,6 +594,7 @@ Status MultiOpsTxnsStressTest::PrimaryKeyUpdateTxn(ThreadState* thread,
}
}
auto & key_gen = key_gen_for_a_ [ thread - > tid ] ;
auto & key_gen = key_gen_for_a_ [ thread - > tid ] ;
key_gen - > UndoAllocation ( new_a ) ;
key_gen - > UndoAllocation ( new_a ) ;
txn - > Rollback ( ) . PermitUncheckedError ( ) ;
} ) ;
} ) ;
ReadOptions ropts ;
ReadOptions ropts ;
@ -692,7 +693,7 @@ Status MultiOpsTxnsStressTest::SecondaryKeyUpdateTxn(ThreadState* thread,
Iterator * it = nullptr ;
Iterator * it = nullptr ;
long iterations = 0 ;
long iterations = 0 ;
const Defer cleanup ( [ new_c , & s , thread , & it , this , & iterations ] ( ) {
const Defer cleanup ( [ new_c , & s , thread , & txn , & it , this , & iterations ] ( ) {
delete it ;
delete it ;
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
thread - > stats . AddIterations ( iterations ) ;
thread - > stats . AddIterations ( iterations ) ;
@ -717,6 +718,7 @@ Status MultiOpsTxnsStressTest::SecondaryKeyUpdateTxn(ThreadState* thread,
}
}
auto & key_gen = key_gen_for_c_ [ thread - > tid ] ;
auto & key_gen = key_gen_for_c_ [ thread - > tid ] ;
key_gen - > UndoAllocation ( new_c ) ;
key_gen - > UndoAllocation ( new_c ) ;
txn - > Rollback ( ) . PermitUncheckedError ( ) ;
} ) ;
} ) ;
// TODO (yanqin) try SetSnapshotOnNextOperation(). We currently need to take
// TODO (yanqin) try SetSnapshotOnNextOperation(). We currently need to take
@ -887,7 +889,7 @@ Status MultiOpsTxnsStressTest::UpdatePrimaryIndexValueTxn(ThreadState* thread,
assert ( txn ) ;
assert ( txn ) ;
const Defer cleanup ( [ & s , thread ] ( ) {
const Defer cleanup ( [ & s , thread , & txn ] ( ) {
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
thread - > stats . AddGets ( /*ngets=*/ 1 , /*nfounds=*/ 1 ) ;
thread - > stats . AddGets ( /*ngets=*/ 1 , /*nfounds=*/ 1 ) ;
thread - > stats . AddBytesForWrites (
thread - > stats . AddBytesForWrites (
@ -904,6 +906,7 @@ Status MultiOpsTxnsStressTest::UpdatePrimaryIndexValueTxn(ThreadState* thread,
} else {
} else {
thread - > stats . AddErrors ( 1 ) ;
thread - > stats . AddErrors ( 1 ) ;
}
}
txn - > Rollback ( ) . PermitUncheckedError ( ) ;
} ) ;
} ) ;
ReadOptions ropts ;
ReadOptions ropts ;
ropts . rate_limiter_priority =
ropts . rate_limiter_priority =
@ -967,7 +970,7 @@ Status MultiOpsTxnsStressTest::PointLookupTxn(ThreadState* thread,
assert ( txn ) ;
assert ( txn ) ;
const Defer cleanup ( [ & s , thread ] ( ) {
const Defer cleanup ( [ & s , thread , & txn ] ( ) {
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
thread - > stats . AddGets ( /*ngets=*/ 1 , /*nfounds=*/ 1 ) ;
thread - > stats . AddGets ( /*ngets=*/ 1 , /*nfounds=*/ 1 ) ;
return ;
return ;
@ -976,6 +979,7 @@ Status MultiOpsTxnsStressTest::PointLookupTxn(ThreadState* thread,
} else {
} else {
thread - > stats . AddErrors ( 1 ) ;
thread - > stats . AddErrors ( 1 ) ;
}
}
txn - > Rollback ( ) . PermitUncheckedError ( ) ;
} ) ;
} ) ;
std : : shared_ptr < const Snapshot > snapshot ;
std : : shared_ptr < const Snapshot > snapshot ;
@ -1010,12 +1014,13 @@ Status MultiOpsTxnsStressTest::RangeScanTxn(ThreadState* thread,
assert ( txn ) ;
assert ( txn ) ;
const Defer cleanup ( [ & s , thread ] ( ) {
const Defer cleanup ( [ & s , thread , & txn ] ( ) {
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
thread - > stats . AddIterations ( 1 ) ;
thread - > stats . AddIterations ( 1 ) ;
return ;
return ;
}
}
thread - > stats . AddErrors ( 1 ) ;
thread - > stats . AddErrors ( 1 ) ;
txn - > Rollback ( ) . PermitUncheckedError ( ) ;
} ) ;
} ) ;
std : : shared_ptr < const Snapshot > snapshot ;
std : : shared_ptr < const Snapshot > snapshot ;