add dag_yield point to co merge && record time cost of tx_data lock_for_read in ObMultiVersionMicroBlockRowScanner
This commit is contained in:
		@ -1881,6 +1881,7 @@ int ObMultiVersionMicroBlockRowScanner::lock_for_read(
 | 
				
			|||||||
  int tmp_ret = OB_SUCCESS;
 | 
					  int tmp_ret = OB_SUCCESS;
 | 
				
			||||||
  SCN scn_trans_version = SCN::invalid_scn();
 | 
					  SCN scn_trans_version = SCN::invalid_scn();
 | 
				
			||||||
  auto &tx_table_guards = context_->store_ctx_->mvcc_acc_ctx_.get_tx_table_guards();
 | 
					  auto &tx_table_guards = context_->store_ctx_->mvcc_acc_ctx_.get_tx_table_guards();
 | 
				
			||||||
 | 
					  int64_t cost_time = common::ObClockGenerator::getClock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (OB_FAIL(tx_table_guards.lock_for_read(lock_for_read_arg,
 | 
					  if (OB_FAIL(tx_table_guards.lock_for_read(lock_for_read_arg,
 | 
				
			||||||
                                            can_read,
 | 
					                                            can_read,
 | 
				
			||||||
@ -1897,6 +1898,12 @@ int ObMultiVersionMicroBlockRowScanner::lock_for_read(
 | 
				
			|||||||
        "sql_seq", lock_for_read_arg.data_sql_sequence_);
 | 
					        "sql_seq", lock_for_read_arg.data_sql_sequence_);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  if (REACH_TENANT_TIME_INTERVAL(30 * 1000 * 1000 /*30s*/)) {
 | 
				
			||||||
 | 
					    cost_time = common::ObClockGenerator::getClock() - cost_time;
 | 
				
			||||||
 | 
					    if (cost_time > 10 * 1000 /*10ms*/) {
 | 
				
			||||||
 | 
					      LOG_INFO("multi-ver row scanner lock for read", K(ret), K(cost_time));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2798,6 +2805,7 @@ int ObMultiVersionMicroBlockMinorMergeRowScanner::check_curr_row_can_read(
 | 
				
			|||||||
    can_read = trans_state.can_read_;
 | 
					    can_read = trans_state.can_read_;
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    storage::ObTxTableGuards &tx_table_guards = context_->store_ctx_->mvcc_acc_ctx_.get_tx_table_guards();
 | 
					    storage::ObTxTableGuards &tx_table_guards = context_->store_ctx_->mvcc_acc_ctx_.get_tx_table_guards();
 | 
				
			||||||
 | 
					    int64_t cost_time = common::ObClockGenerator::getClock();
 | 
				
			||||||
    if (OB_FAIL(tx_table_guards.check_sql_sequence_can_read(
 | 
					    if (OB_FAIL(tx_table_guards.check_sql_sequence_can_read(
 | 
				
			||||||
            trans_id,
 | 
					            trans_id,
 | 
				
			||||||
            sql_seq,
 | 
					            sql_seq,
 | 
				
			||||||
@ -2809,6 +2817,12 @@ int ObMultiVersionMicroBlockMinorMergeRowScanner::check_curr_row_can_read(
 | 
				
			|||||||
        committed_trans_version_, last_trans_state_, can_read))) {
 | 
					        committed_trans_version_, last_trans_state_, can_read))) {
 | 
				
			||||||
      LOG_WARN("failed to add minor trans state", K(tmp_ret), K(trans_id), K(sql_seq), K(can_read));
 | 
					      LOG_WARN("failed to add minor trans state", K(tmp_ret), K(trans_id), K(sql_seq), K(can_read));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (REACH_TENANT_TIME_INTERVAL(30 * 1000 * 1000 /*30s*/)) {
 | 
				
			||||||
 | 
					      cost_time = common::ObClockGenerator::getClock() - cost_time;
 | 
				
			||||||
 | 
					      if (cost_time > 10 * 1000 /*10ms*/) {
 | 
				
			||||||
 | 
					        LOG_INFO("multi-ver minor row scanner check seq", K(ret), K(cost_time));
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  LOG_DEBUG("cxf debug check sql sequence can read", K(ret), K(can_read), K(trans_id), K(sql_seq));
 | 
					  LOG_DEBUG("cxf debug check sql sequence can read", K(ret), K(can_read), K(trans_id), K(sql_seq));
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
 | 
				
			|||||||
@ -388,7 +388,9 @@ int ObCOMerger::write_residual_data()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  for (int64_t i = 0; OB_SUCC(ret) && i < merge_writers_.count(); i++) {
 | 
					  for (int64_t i = 0; OB_SUCC(ret) && i < merge_writers_.count(); i++) {
 | 
				
			||||||
    ObCOMergeWriter *merge_writer = nullptr;
 | 
					    ObCOMergeWriter *merge_writer = nullptr;
 | 
				
			||||||
    if (OB_ISNULL(merge_writer = merge_writers_.at(i))) {
 | 
					    if (OB_FAIL(share::dag_yield())) {
 | 
				
			||||||
 | 
					      STORAGE_LOG(WARN, "fail to yield co merge dag", KR(ret));
 | 
				
			||||||
 | 
					    } else if (OB_ISNULL(merge_writer = merge_writers_.at(i))) {
 | 
				
			||||||
      ret = OB_ERR_UNEXPECTED;
 | 
					      ret = OB_ERR_UNEXPECTED;
 | 
				
			||||||
      STORAGE_LOG(WARN, "UNEXPECTED null writer", K(ret));
 | 
					      STORAGE_LOG(WARN, "UNEXPECTED null writer", K(ret));
 | 
				
			||||||
    } else if (OB_FAIL(merge_writer->append_residual_data())) {
 | 
					    } else if (OB_FAIL(merge_writer->append_residual_data())) {
 | 
				
			||||||
 | 
				
			|||||||
@ -587,6 +587,13 @@ int ObLSTxCtxMgr::get_tx_ctx_(const ObTransID &tx_id, const bool for_replay, ObP
 | 
				
			|||||||
      TRANS_LOG(INFO, "transaction statistics", K_(ls_id),
 | 
					      TRANS_LOG(INFO, "transaction statistics", K_(ls_id),
 | 
				
			||||||
          "total_tx_ctx_count", get_tx_ctx_count_());
 | 
					          "total_tx_ctx_count", get_tx_ctx_count_());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					#ifdef ENABLE_DEBUG_LOG
 | 
				
			||||||
 | 
					    // ENABLE_DEBUG_LOG macro only defined in inner test environment
 | 
				
			||||||
 | 
					    if (REACH_TIME_INTERVAL(3 * 60 * 1000 * 1000 /*3 min*/)) {
 | 
				
			||||||
 | 
					      TRANS_LOG(INFO, "transaction statistics", K_(ls_id),
 | 
				
			||||||
 | 
					          "total_tx_ctx_count", get_tx_ctx_count_(), K(lbt()));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user