@@ -614,14 +614,11 @@ void EngineShard::PollExecution(const char* context, Transaction* trans) {
614
614
continuation_trans_ = nullptr ;
615
615
}
616
616
617
- string dbg_id;
618
617
bool update_stats = false ;
619
618
620
- auto run = [this , &dbg_id, &update_stats](Transaction* tx, bool is_ooo) -> bool /* keep */ {
621
- dbg_id = VLOG_IS_ON (1 ) ? tx->DebugId () : " " ;
622
- bool concluding = tx->RunInShard (this , is_ooo);
619
+ auto run = [this , &update_stats](Transaction* tx, bool is_ooo) -> bool /* concluding */ {
623
620
update_stats = true ;
624
- return !concluding ;
621
+ return tx-> RunInShard ( this , is_ooo) ;
625
622
};
626
623
627
624
// Check the currently running transaction, we have to handle it first until it concludes
@@ -632,9 +629,7 @@ void EngineShard::PollExecution(const char* context, Transaction* trans) {
632
629
633
630
if ((is_self && disarmed) || continuation_trans_->DisarmInShard (sid)) {
634
631
auto bc = continuation_trans_->GetNamespace ().GetBlockingController (shard_id_);
635
- if (bool keep = run (continuation_trans_, false ); !keep) {
636
- // if this holds, we can remove this check altogether.
637
- DCHECK (continuation_trans_ == nullptr );
632
+ if (bool concludes = run (continuation_trans_, false ); concludes) {
638
633
continuation_trans_ = nullptr ;
639
634
}
640
635
if (bc && bc->HasAwakedTransaction ()) {
@@ -677,25 +672,28 @@ void EngineShard::PollExecution(const char* context, Transaction* trans) {
677
672
DCHECK_LT (committed_txid_, txid); // strictly increasing when processed via txq
678
673
committed_txid_ = txid;
679
674
680
- if (bool keep = run (head, false ); keep)
675
+ DCHECK (!continuation_trans_); // while() check above ensures this.
676
+ if (bool concludes = run (head, false ); !concludes) {
681
677
continuation_trans_ = head;
678
+ }
682
679
}
683
680
684
681
// If we disarmed, but didn't find ourselves in the loop, run now.
685
682
if (trans && disarmed) {
686
683
DCHECK (trans != head);
687
684
DCHECK (trans_mask & (Transaction::OUT_OF_ORDER | Transaction::SUSPENDED_Q));
685
+ CHECK (trans != continuation_trans_);
688
686
689
687
bool is_ooo = trans_mask & Transaction::OUT_OF_ORDER;
690
- bool keep = run (trans, is_ooo);
691
- if (is_ooo && !keep ) {
688
+ bool concludes = run (trans, is_ooo);
689
+ if (is_ooo && concludes ) {
692
690
stats_.tx_ooo_total ++;
693
691
}
694
692
695
693
// If the transaction concluded, it must remove itself from the tx queue.
696
694
// Otherwise it is required to stay there to keep the relative order.
697
695
if (is_ooo && !trans->IsMulti ())
698
- DCHECK_EQ (keep, trans->DEBUG_GetTxqPosInShard (sid) != TxQueue::kEnd );
696
+ LOG_IF (DFATAL, concludes != ( trans->DEBUG_GetTxqPosInShard (sid) == TxQueue::kEnd ) );
699
697
}
700
698
if (update_stats) {
701
699
CacheStats ();
0 commit comments