add some debug info and sanity check
This commit is contained in:
		@ -928,6 +928,13 @@ bool ObTxDesc::execute_commit_cb()
 | 
				
			|||||||
        executed = true;
 | 
					        executed = true;
 | 
				
			||||||
        cb = commit_cb_;
 | 
					        cb = commit_cb_;
 | 
				
			||||||
        commit_cb_ = NULL;
 | 
					        commit_cb_ = NULL;
 | 
				
			||||||
 | 
					        if (0 <= cb_tid_) {
 | 
				
			||||||
 | 
					#ifdef ENABLE_DEBUG_LOG
 | 
				
			||||||
 | 
					          ob_abort();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					          TRANS_LOG(WARN, "unexpected error happen, cb_tid_ should smaller than 0",
 | 
				
			||||||
 | 
					                    KP(this), K(tx_id), KP(cb_tid_));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        ATOMIC_STORE_REL(&cb_tid_, GETTID());
 | 
					        ATOMIC_STORE_REL(&cb_tid_, GETTID());
 | 
				
			||||||
        // NOTE: it is required add trace event before callback,
 | 
					        // NOTE: it is required add trace event before callback,
 | 
				
			||||||
        // because txDesc may be released after callback called
 | 
					        // because txDesc may be released after callback called
 | 
				
			||||||
@ -937,7 +944,7 @@ bool ObTxDesc::execute_commit_cb()
 | 
				
			|||||||
                            OB_ID(thread_id), GETTID());
 | 
					                            OB_ID(thread_id), GETTID());
 | 
				
			||||||
        commit_cb_lock_.unlock();
 | 
					        commit_cb_lock_.unlock();
 | 
				
			||||||
        cb->callback(commit_out_);
 | 
					        cb->callback(commit_out_);
 | 
				
			||||||
        ATOMIC_STORE_REL(&cb_tid_, -1);
 | 
					        ATOMIC_STORE_REL(&cb_tid_, -GETTID());
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        commit_cb_lock_.unlock();
 | 
					        commit_cb_lock_.unlock();
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
				
			|||||||
@ -192,7 +192,7 @@ int ObTransService::reuse_tx(ObTxDesc &tx)
 | 
				
			|||||||
      PAUSE();
 | 
					      PAUSE();
 | 
				
			||||||
      if (++spin_cnt > 2000) {
 | 
					      if (++spin_cnt > 2000) {
 | 
				
			||||||
        TRANS_LOG(WARN, "blocking to wait tx referent quiescent cost too much time",
 | 
					        TRANS_LOG(WARN, "blocking to wait tx referent quiescent cost too much time",
 | 
				
			||||||
                  "tx_id", orig_tx_id, KP(&tx), K(final_ref_cnt), K(spin_cnt), K(tx.get_ref()));
 | 
					                  "tx_id", orig_tx_id, KP(&tx), K(final_ref_cnt), K(spin_cnt), K(tx.get_ref()), K(cb_tid));
 | 
				
			||||||
        tx.print_trace();
 | 
					        tx.print_trace();
 | 
				
			||||||
        usleep(2000000); // 2s
 | 
					        usleep(2000000); // 2s
 | 
				
			||||||
      } else if (spin_cnt > 200) {
 | 
					      } else if (spin_cnt > 200) {
 | 
				
			||||||
@ -200,6 +200,12 @@ int ObTransService::reuse_tx(ObTxDesc &tx)
 | 
				
			|||||||
      } else if (spin_cnt > 100) {
 | 
					      } else if (spin_cnt > 100) {
 | 
				
			||||||
        usleep(200);     // 200us
 | 
					        usleep(200);     // 200us
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					#ifdef ENABLE_DEBUG_LOG
 | 
				
			||||||
 | 
					      if (spin_cnt > 2015) {
 | 
				
			||||||
 | 
					        // at least wait 30s
 | 
				
			||||||
 | 
					        ob_abort();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // it is safe to operate tx without lock when not shared
 | 
					    // it is safe to operate tx without lock when not shared
 | 
				
			||||||
    uint32_t session_id = tx.sess_id_;
 | 
					    uint32_t session_id = tx.sess_id_;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user