Skip to content

Commit

Permalink
add pre-verify before pause at no-wait opt.
Browse files Browse the repository at this point in the history
  • Loading branch information
thawk105 committed May 9, 2020
1 parent bfe7c52 commit 842900b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 12 deletions.
8 changes: 4 additions & 4 deletions tictoc/script/ycsb-xth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
tuple=10000000
maxope=16
#rratioary=(50 95 100)
rratioary=(90)
rratioary=(50)
rmw=false
skew=0.8
skew=0.9
ycsb=true
cpumhz=2100
extime=3
Expand All @@ -21,13 +21,13 @@ thread=224
fi

cd ../
make clean; make -j VAL_SIZE=1000
make clean; make -j
cd script/

for rratio in "${rratioary[@]}"
do
if test $rratio = 50 ; then
result=result_tictoc_ycsbA_tuple10m_ope16_rmw_skew099.dat
result=result_tictoc_ycsb_tuple10m_skew09.dat
elif test $rratio = 90 ; then
result=result_tictoc_ycsb_tuple10m_skew08.dat
elif test $rratio = 95 ; then
Expand Down
61 changes: 53 additions & 8 deletions tictoc/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,11 @@ void TxExecutor::lockWriteSet() {
__atomic_load_n(&((*itr).rcdptr_->tsw_.obj_), __ATOMIC_ACQUIRE);
for (;;) {
if (expected.lock) {
#if NO_WAIT_LOCKING_IN_VALIDATION
/**
* no-wait locking in validation
*/
if (this->wonly_ == false) {
#if NO_WAIT_LOCKING_IN_VALIDATION
/**
* no-wait locking in validation
*/
this->status_ = TransactionStatus::aborted;
/**
* unlock locked record.
Expand All @@ -383,12 +383,57 @@ void TxExecutor::lockWriteSet() {
unlockWriteSet(itr);
}
return;
}
#elif NO_WAIT_OF_TICTOC
if (itr != write_set_.begin()) unlockWriteSet(itr);
sleepTics(FLAGS_clocks_per_us); // sleep 1us.
goto retry;
if (itr != write_set_.begin()) unlockWriteSet(itr);
/**
* pre-verify
*/
for (auto itr = read_set_.begin(); itr != read_set_.end(); ++itr) {
TsWord v1, v2;

v1.obj_ =
__atomic_load_n(&((*itr).rcdptr_->tsw_.obj_), __ATOMIC_ACQUIRE);
if ((*itr).tsw_.rts() < commit_ts_) {
if ((*itr).tsw_.wts != v1.wts) {
// start timestamp history processing
#if TIMESTAMP_HISTORY
TsWord pre_v1;
pre_v1.obj_ = __atomic_load_n(&((*itr).rcdptr_->pre_tsw_.obj_),
__ATOMIC_ACQUIRE);
if (pre_v1.wts <= commit_ts_ && commit_ts_ < v1.wts) {
/**
* Success
*/
#if ADD_ANALYSIS
++tres_->local_timestamp_history_success_counts_;
#endif
continue;
}
/**
* Fail
*/
#if ADD_ANALYSIS
++tres_->local_timestamp_history_fail_counts_;
#endif
#endif
// end timestamp history processing
this->status_ = TransactionStatus::aborted;
return;
}

if ((v1.rts()) < commit_ts_ && v1.lock) {
this->status_ = TransactionStatus::aborted;
return;
}
}
}
/**
* end pre-verify
*/
sleepTics(FLAGS_clocks_per_us); // sleep 1us.
goto retry;
#endif
}
expected.obj_ = loadAcquire((*itr).rcdptr_->tsw_.obj_);
} else {
desired = expected;
Expand Down

0 comments on commit 842900b

Please sign in to comment.