提交 e2969ea7 编写于 作者: Z zh0 提交者: LINGuanRen

adjust perf event statistic

上级 21e521f4
......@@ -78,8 +78,8 @@ void* AChunkMgr::direct_alloc(const uint64_t size)
{
common::ObTimeGuard time_guard(__func__, 1000 * 1000);
int orig_errno = errno;
EVENT_INC(MMAP_COUNT);
EVENT_ADD(MMAP_SIZE, size);
// EVENT_INC(MMAP_COUNT);
// EVENT_ADD(MMAP_SIZE, size);
void* ptr = nullptr;
ptr = low_alloc(size);
......
......@@ -86,10 +86,12 @@ STAT_EVENT_ADD_DEF(TRANS_SINGLE_PARTITION_COUNT, "trans single partition count",
"trans single partition count", 30012, true, true)
STAT_EVENT_ADD_DEF(TRANS_MULTI_PARTITION_COUNT, "trans multi partition count", ObStatClassIds::TRANS,
"trans multi partition count", 30013, true, true)
// STAT_EVENT_ADD_DEF(TRANS_DISTRIBUTED_STMT_COUNT, "trans distributed stmt count", TRANS, "trans distributed stmt
// count", 30014) STAT_EVENT_ADD_DEF(TRANS_LOCAL_STMT_COUNT, "trans local stmt count", TRANS, "trans local stmt count",
// 30015) STAT_EVENT_ADD_DEF(TRANS_REMOTE_STMT_COUNT, "trans remote stmt count", TRANS, "trans remote stmt count",
// 30016)
STAT_EVENT_ADD_DEF(TRANS_DISTRIBUTED_STMT_COUNT, "trans distributed stmt count", ObStatClassIds::TRANS,
"trans distributed stmt count", 30014, true, true)
STAT_EVENT_ADD_DEF(TRANS_LOCAL_STMT_COUNT, "trans local stmt count", ObStatClassIds::TRANS,
"trans local stmt count", 30015, true, true)
STAT_EVENT_ADD_DEF(TRANS_REMOTE_STMT_COUNT, "trans remote stmt count", ObStatClassIds::TRANS,
"trans remote stmt count", 30016, true, true)
STAT_EVENT_ADD_DEF(TRANS_ZERO_PARTITION_COUNT, "trans zero partition count", ObStatClassIds::TRANS,
"trans zero partition count", 30017, true, true)
STAT_EVENT_ADD_DEF(
......
......@@ -249,7 +249,6 @@ void ObMemtable::set_begin(const ObStoreCtx& ctx)
void ObMemtable::set_end(const ObStoreCtx& ctx, int ret)
{
if (NULL != ctx.mem_ctx_) {
if (OB_SUCC(ret)) {
EVENT_INC(MEMSTORE_APPLY_SUCC_COUNT);
......@@ -382,7 +381,7 @@ int ObMemtable::set_(const ObStoreCtx& ctx, const uint64_t table_id, const int64
bool is_lob_row = false;
bool is_new_locked = false;
bool need_explict_record_rowkey = false;
set_begin(ctx);
// set_begin(ctx);
if (OB_FAIL(col_ccw.init())) {
TRANS_LOG(WARN, "compact writer init fail", KR(ret));
} else if (OB_FAIL(mtk.encode(table_id, columns, &tmp_key))) {
......@@ -430,7 +429,7 @@ int ObMemtable::set_(const ObStoreCtx& ctx, const uint64_t table_id, const int64
old_row_data.reset();
}
}
set_end(ctx, ret);
// set_end(ctx, ret);
if (OB_SUCC(ret)) {
set_max_schema_version(ctx.mem_ctx_->get_max_table_version());
}
......@@ -751,7 +750,6 @@ void ObMemtable::get_begin(const ObStoreCtx& ctx)
void ObMemtable::get_end(const ObStoreCtx& ctx, int ret)
{
if (NULL != ctx.mem_ctx_) {
if (OB_SUCC(ret)) {
EVENT_INC(MEMSTORE_GET_SUCC_COUNT);
......@@ -773,7 +771,7 @@ int ObMemtable::exist(const ObStoreCtx& ctx, const uint64_t table_id, const comm
ObQueryFlag query_flag;
query_flag.read_latest_ = true;
query_flag.prewarm_ = false;
get_begin(ctx);
// get_begin(ctx);
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
TRANS_LOG(WARN, "not init", K(*this), K(ret));
......@@ -801,7 +799,7 @@ int ObMemtable::exist(const ObStoreCtx& ctx, const uint64_t table_id, const comm
} else {
TRANS_LOG(DEBUG, "Check memtable exist rowkey, ", K(table_id), K(rowkey), K(columns), K(is_exist), K(has_found));
}
get_end(ctx, ret);
// get_end(ctx, ret);
return ret;
}
......@@ -814,8 +812,8 @@ int ObMemtable::prefix_exist(ObRowsInfo& rows_info, bool& may_exist)
} else {
const ObStoreCtx& ctx = rows_info.exist_helper_.get_store_ctx();
ObMemtableKey parameter_mtk;
const ObStoreRowkey& rowkey = rows_info.get_prefix_rowkey().get_store_rowkey();
get_begin(ctx);
const ObStoreRowkey &rowkey = rows_info.get_prefix_rowkey().get_store_rowkey();
// get_begin(ctx);
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
TRANS_LOG(WARN, "not init", K(*this), K(ret));
......@@ -831,7 +829,7 @@ int ObMemtable::prefix_exist(ObRowsInfo& rows_info, bool& may_exist)
} else {
TRANS_LOG(DEBUG, "Check memtable prefix exist rowkey, ", K(rowkey), K(may_exist), K(rows_info));
}
get_end(ctx, ret);
// get_end(ctx, ret);
}
return ret;
}
......@@ -875,6 +873,7 @@ void ObMemtable::scan_begin(const ObStoreCtx& ctx)
(static_cast<ObMemtableCtx*>(ctx.mem_ctx_))->set_handle_start_time(ObTimeUtility::current_time());
EVENT_INC(MEMSTORE_SCAN_COUNT);
}
UNUSED(ctx);
}
void ObMemtable::scan_end(const ObStoreCtx& ctx, int ret)
......@@ -888,6 +887,8 @@ void ObMemtable::scan_end(const ObStoreCtx& ctx, int ret)
EVENT_ADD(MEMSTORE_SCAN_TIME,
ObTimeUtility::current_time() - (static_cast<ObMemtableCtx*>(ctx.mem_ctx_))->get_handle_start_time());
}
UNUSED(ctx);
UNUSED(ret);
}
int ObMemtable::get(const storage::ObTableIterParam& param, storage::ObTableAccessContext& context,
......@@ -1471,8 +1472,8 @@ int ObMemtable::replay(const ObStoreCtx& ctx, const char* data, const int64_t da
}
}
const int64_t end_us = ObTimeUtility::current_time();
EVENT_INC(MEMSTORE_MUTATOR_REPLAY_COUNT);
EVENT_ADD(MEMSTORE_MUTATOR_REPLAY_TIME, end_us - start_us);
// EVENT_INC(MEMSTORE_MUTATOR_REPLAY_COUNT);
// EVENT_ADD(MEMSTORE_MUTATOR_REPLAY_TIME, end_us - start_us);
return ret;
}
......
......@@ -377,7 +377,7 @@ int ObClogAdapter::submit_log(const ObPartitionKey& partition, const ObVersion&
int64_t& cur_log_timestamp)
{
int ret = OB_SUCCESS;
// const int64_t start = ObTimeUtility::current_time();
const int64_t start = ObTimeUtility::current_time();
if (IS_NOT_INIT) {
TRANS_LOG(WARN, "ObClogAdapter not inited");
......@@ -396,12 +396,11 @@ int ObClogAdapter::submit_log(const ObPartitionKey& partition, const ObVersion&
} else {
// do nothing
}
/*
if (OB_SUCCESS == ret) {
ObTransStatistic::get_instance().add_submit_trans_log_count(partition.get_tenant_id(), 1);
ObTransStatistic::get_instance().add_submit_trans_log_time(partition.get_tenant_id(),
ObTimeUtility::current_time() - start);
}*/
ObTransStatistic::get_instance().add_submit_trans_log_time(
partition.get_tenant_id(), ObTimeUtility::current_time() - start);
}
return ret;
}
......@@ -411,7 +410,7 @@ int ObClogAdapter::submit_log(const ObPartitionKey& partition, const ObVersion&
int64_t& cur_log_timestamp)
{
int ret = OB_SUCCESS;
// const int64_t start = ObTimeUtility::current_time();
const int64_t start = ObTimeUtility::current_time();
if (IS_NOT_INIT) {
TRANS_LOG(WARN, "ObClogAdapter not inited");
......@@ -431,12 +430,11 @@ int ObClogAdapter::submit_log(const ObPartitionKey& partition, const ObVersion&
} else {
// do nothing
}
/*
if (OB_SUCCESS == ret) {
ObTransStatistic::get_instance().add_submit_trans_log_count(partition.get_tenant_id(), 1);
ObTransStatistic::get_instance().add_submit_trans_log_time(partition.get_tenant_id(),
ObTimeUtility::current_time() - start);
}*/
ObTransStatistic::get_instance().add_submit_trans_log_time(
partition.get_tenant_id(), ObTimeUtility::current_time() - start);
}
return ret;
}
......
......@@ -176,7 +176,6 @@ int ObGlobalTimestampService::handle_request(const ObGtsRequest& request, ObGtsR
TRANS_LOG(WARN, "gts request fly too much time", K(request), K(result), K(cost_us));
}
ATOMIC_INC(&total_cnt);
ObTransStatistic::get_instance().add_gts_request_total_count(request.get_tenant_id(), 1);
(void)ATOMIC_FAA(&total_rt, end.mts_ - start.mts_);
if (REACH_TIME_INTERVAL(STATISTICS_INTERVAL_US)) {
TRANS_LOG(INFO,
......
......@@ -768,10 +768,6 @@ int ObGtsSource::query_gts_(const ObAddr& leader)
TRANS_LOG(WARN, "post gts request failed", KR(ret), K(leader), K(msg));
(void)refresh_gts_location_();
} else {
if (GCONF.enable_record_trace_log) {
gts_statistics_.inc_gts_rpc_cnt();
ObTransStatistic::get_instance().add_gts_rpc_count(tenant_id_, 1);
}
TRANS_LOG(DEBUG, "post gts request success", K(srr), K_(gts_local_cache));
}
return ret;
......
......@@ -69,7 +69,6 @@ int ObGTSTaskQueue::foreach_task(
break;
} else {
const uint64_t tenant_id = task->get_tenant_id();
const int64_t request_ts = task->get_request_ts();
if (GET_GTS == task_type_) {
if (OB_FAIL(task->get_gts_callback(srr, max(gts, local_trans_version), receive_gts_ts))) {
if (OB_EAGAIN != ret) {
......@@ -100,17 +99,7 @@ int ObGTSTaskQueue::foreach_task(
break;
}
} else {
if (GET_GTS == task_type_) {
const int64_t total_used = ObTimeUtility::current_time() - request_ts;
ObTransStatistic::get_instance().add_gts_acquire_total_time(tenant_id, total_used);
ObTransStatistic::get_instance().add_gts_acquire_total_wait_count(tenant_id, 1);
} else if (WAIT_GTS_ELAPSING == task_type_) {
const int64_t total_used = ObTimeUtility::current_time() - request_ts;
ObTransStatistic::get_instance().add_gts_wait_elapse_total_time(tenant_id, total_used);
ObTransStatistic::get_instance().add_gts_wait_elapse_total_wait_count(tenant_id, 1);
} else {
// do nothing
}
// do nothing
}
}
}
......
......@@ -58,7 +58,6 @@ void ObEndTransCallback::destroy()
int ObEndTransCallback::callback(const int cb_param)
{
int ret = OB_SUCCESS;
const int64_t start_us = ObTimeUtility::current_time();
if (NULL == cb_) {
ret = OB_ERR_UNEXPECTED;
......@@ -71,9 +70,6 @@ int ObEndTransCallback::callback(const int cb_param)
cb_->callback(cb_param);
cb_ = NULL;
}
const int64_t end_us = ObTimeUtility::current_time();
ObTransStatistic::get_instance().add_trans_callback_sql_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_trans_callback_sql_time(tenant_id_, end_us - start_us);
return ret;
}
......
......@@ -135,7 +135,7 @@ void ObTransStatistic::add_local_stmt_count(const uint64_t tenant_id, const int6
{
UNUSED(value);
common::ObTenantStatEstGuard guard(tenant_id);
// EVENT_ADD(TRANS_LOCAL_STMT_COUNT, value);
EVENT_ADD(TRANS_LOCAL_STMT_COUNT, value);
// local_stmt_stat_.add(value);
}
......@@ -143,7 +143,7 @@ void ObTransStatistic::add_remote_stmt_count(const uint64_t tenant_id, const int
{
UNUSED(value);
common::ObTenantStatEstGuard guard(tenant_id);
// EVENT_ADD(TRANS_REMOTE_STMT_COUNT, value);
EVENT_ADD(TRANS_REMOTE_STMT_COUNT, value);
// remote_stmt_stat_.add(value);
}
......@@ -151,7 +151,7 @@ void ObTransStatistic::add_distributed_stmt_count(const uint64_t tenant_id, cons
{
UNUSED(value);
common::ObTenantStatEstGuard guard(tenant_id);
// EVENT_ADD(TRANS_DISTRIBUTED_STMT_COUNT, value);
EVENT_ADD(TRANS_DISTRIBUTED_STMT_COUNT, value);
// distributed_stmt_stat_.add(value);
}
......
......@@ -572,8 +572,6 @@ int ObPartTransCtx::trans_end_(const bool commit, const int64_t commit_version)
}
const int64_t end_us = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_trans_mt_end_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_trans_mt_end_time(tenant_id_, end_us - start_us);
// just for debug
if (end_us - start_us > 5 * 1000 * 1000) {
TRANS_LOG(WARN,
......@@ -1653,7 +1651,7 @@ int ObPartTransCtx::on_sync_log_success(
const int64_t log_type, const int64_t log_id, const int64_t timestamp, const bool batch_committed)
{
int ret = OB_SUCCESS;
int64_t start_us = 0;
int64_t start_us = ObTimeUtility::fast_current_time();
int64_t end_us = 0;
bool has_redo_log = false;
bool has_pending_cb = true;
......@@ -1677,7 +1675,6 @@ int ObPartTransCtx::on_sync_log_success(
update_durable_log_id_ts_(log_type, log_id, timestamp);
if ((log_type & OB_LOG_SP_TRANS_REDO) != 0) {
start_us = ObTimeUtility::fast_current_time();
has_write_or_replay_mutator_redo_log_ = true;
++redo_log_no_;
if (redo_log_no_ == 1) {
......@@ -1697,14 +1694,9 @@ int ObPartTransCtx::on_sync_log_success(
// coordinator to progress the txn.
set_status_(OB_TRANS_ROLLBACKED);
}
ObTransStatistic::get_instance().add_sp_redo_log_cb_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_sp_redo_log_cb_time(
tenant_id_, ObTimeUtility::fast_current_time() - start_us);
end_us = ObTimeUtility::fast_current_time();
}
if ((log_type & OB_LOG_SP_ELR_TRANS_COMMIT) != 0) {
++redo_log_no_;
start_us = ObTimeUtility::fast_current_time();
update_last_checkpoint_(quick_checkpoint_);
if (OB_SUCC(ret)) {
set_state_(ObSpState::PREPARE);
......@@ -1734,10 +1726,6 @@ int ObPartTransCtx::on_sync_log_success(
}
INC_ELR_STATISTIC(with_dependency_trx_count);
ObTransStatistic::get_instance().add_sp_commit_log_cb_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_sp_commit_log_cb_time(
tenant_id_, ObTimeUtility::fast_current_time() - start_us);
end_us = ObTimeUtility::fast_current_time();
if (OB_FAIL(ret)) {
is_hazardous_ctx_ = true;
TRANS_LOG(ERROR, "current ctx status is hazardous", K(*this));
......@@ -1745,7 +1733,6 @@ int ObPartTransCtx::on_sync_log_success(
}
if ((log_type & OB_LOG_SP_TRANS_COMMIT) != 0 || (log_type & OB_LOG_SP_TRANS_ABORT) != 0) {
++redo_log_no_;
start_us = ObTimeUtility::fast_current_time();
const bool commit = ((log_type & OB_LOG_SP_TRANS_COMMIT) != 0) ? true : false;
if (commit) {
// update checkpoint
......@@ -1767,10 +1754,6 @@ int ObPartTransCtx::on_sync_log_success(
}
INC_ELR_STATISTIC(without_dependency_trx_count);
ObTransStatistic::get_instance().add_sp_commit_log_cb_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_sp_commit_log_cb_time(
tenant_id_, ObTimeUtility::fast_current_time() - start_us);
end_us = ObTimeUtility::fast_current_time();
if (OB_FAIL(ret)) {
is_hazardous_ctx_ = true;
TRANS_LOG(ERROR, "current ctx status is hazardous", K(*this));
......@@ -1790,7 +1773,6 @@ int ObPartTransCtx::on_sync_log_success(
}
// need submit redo_prepare log when log_type equal OB_LOG_TRANS_REDO
if (OB_LOG_TRANS_REDO == log_type) {
start_us = ObTimeUtility::fast_current_time();
// record the redo log id
if (!is_xa_last_empty_redo_log_() && OB_FAIL(calc_serialize_size_and_set_redo_log_(log_id))) {
TRANS_LOG(WARN, "redo log id push back error", KR(ret), "context", *this, K(log_id));
......@@ -1833,16 +1815,11 @@ int ObPartTransCtx::on_sync_log_success(
// coordinator to progress the txn
set_status_(OB_TRANS_ROLLBACKED);
}
ObTransStatistic::get_instance().add_redo_log_cb_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_redo_log_cb_time(
tenant_id_, ObTimeUtility::fast_current_time() - start_us);
end_us = ObTimeUtility::fast_current_time();
} else {
ret = OB_SUCCESS;
}
}
if ((log_type & OB_LOG_TRANS_PREPARE) != 0) {
start_us = ObTimeUtility::fast_current_time();
// update checkpoint
update_last_checkpoint_(quick_checkpoint_);
prepare_log_id_ = log_id;
......@@ -1863,10 +1840,6 @@ int ObPartTransCtx::on_sync_log_success(
is_hazardous_ctx_ = true;
TRANS_LOG(ERROR, "current ctx status is hazardous", K(*this));
}
ObTransStatistic::get_instance().add_prepare_log_cb_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_prepare_log_cb_time(
tenant_id_, ObTimeUtility::fast_current_time() - start_us);
end_us = ObTimeUtility::fast_current_time();
}
// ignore ret
if ((log_type & OB_LOG_TRANS_COMMIT) != 0) {
......@@ -1896,10 +1869,6 @@ int ObPartTransCtx::on_sync_log_success(
is_hazardous_ctx_ = true;
TRANS_LOG(ERROR, "current ctx status is hazardous", K(*this));
}
ObTransStatistic::get_instance().add_commit_log_cb_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_commit_log_cb_time(
tenant_id_, ObTimeUtility::fast_current_time() - start_us);
end_us = ObTimeUtility::fast_current_time();
}
}
// ignore ret
......@@ -1922,10 +1891,6 @@ int ObPartTransCtx::on_sync_log_success(
TRANS_LOG(WARN, "ObPartTransCtx on_abort error", KR(ret), "context", *this);
}
}
ObTransStatistic::get_instance().add_abort_log_cb_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_abort_log_cb_time(
tenant_id_, ObTimeUtility::fast_current_time() - start_us);
end_us = ObTimeUtility::fast_current_time();
}
}
// ignore ret
......@@ -1935,14 +1900,9 @@ int ObPartTransCtx::on_sync_log_success(
listener_handler_->set_commit_log_synced(true);
}
if (OB_ISNULL(listener_handler_) || listener_handler_->is_listener_ready()) {
start_us = ObTimeUtility::fast_current_time();
if (OB_FAIL(on_clear_(true))) {
TRANS_LOG(WARN, "ObPartTransCtx on_clear error", KR(ret), "context", *this);
}
ObTransStatistic::get_instance().add_clear_log_cb_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_clear_log_cb_time(
tenant_id_, ObTimeUtility::fast_current_time() - start_us);
end_us = ObTimeUtility::fast_current_time();
}
}
if ((OB_LOG_MUTATOR & log_type) != 0) {
......@@ -2007,9 +1967,6 @@ int ObPartTransCtx::on_sync_log_success(
// coordinator to progress the txn
set_status_(OB_TRANS_ROLLBACKED);
}
ObTransStatistic::get_instance().add_redo_log_cb_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_redo_log_cb_time(tenant_id_, ObTimeUtility::fast_current_time() - start_us);
end_us = ObTimeUtility::fast_current_time();
TRANS_LOG(DEBUG, "sync transaction mutator log", KR(ret), "context", *this, K(submit_log_type));
}
if ((OB_LOG_TRANS_STATE & log_type) != 0) {
......@@ -2018,7 +1975,6 @@ int ObPartTransCtx::on_sync_log_success(
TRANS_LOG(INFO, "sync transaction state log success", "context", *this);
}
if (OB_LOG_MUTATOR_ABORT == log_type) {
start_us = ObTimeUtility::fast_current_time();
(void)unregister_timeout_task_();
set_exiting_();
const bool commit = false;
......@@ -2026,9 +1982,6 @@ int ObPartTransCtx::on_sync_log_success(
(void)trans_end_(commit, get_global_trans_version_());
(void)trans_clear_();
end_trans_callback_(OB_TRANS_KILLED);
ObTransStatistic::get_instance().add_abort_log_cb_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_abort_log_cb_time(tenant_id_, ObTimeUtility::fast_current_time() - start_us);
end_us = ObTimeUtility::fast_current_time();
ObTransStatus trans_status(trans_id_, OB_TRANS_KILLED);
(void)trans_status_mgr_->set_status(trans_id_, trans_status);
TRANS_LOG(INFO, "sync transaction mutator abort log", KR(ret), "context", *this);
......@@ -2037,6 +1990,7 @@ int ObPartTransCtx::on_sync_log_success(
dup_table_syncing_log_id_ = UINT64_MAX;
dup_table_syncing_log_ts_ = INT64_MAX;
end_us = ObTimeUtility::fast_current_time();
if (end_us - start_us > 30 * 1000) {
TRANS_LOG(WARN,
......@@ -3417,8 +3371,7 @@ int ObPartTransCtx::replay_sp_redo_log(
store_ctx.log_ts_ = timestamp;
store_ctx.cur_pkey_ = self_;
cluster_id_ = log.get_cluster_id();
const ObTransMutator& mutator = log.get_mutator();
const int64_t mutator_size = mutator.get_position();
const ObTransMutator &mutator = log.get_mutator();
bool replayed = true;
if (OB_FAIL(partition_service_->replay_redo_log(
self_, store_ctx, timestamp, log_id, mutator.get_data(), mutator.get_position(), replayed))) {
......@@ -3437,7 +3390,6 @@ int ObPartTransCtx::replay_sp_redo_log(
} else {
TRANS_LOG(INFO, "no need to replay, maybe partition already removed", K(log), K(*this));
}
ObTransStatistic::get_instance().add_memstore_mutator_size(tenant_id_, mutator_size);
}
}
......@@ -3476,8 +3428,6 @@ int ObPartTransCtx::replay_sp_redo_log(
}
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_redo_log_replay_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_redo_log_replay_time(tenant_id_, end - start);
if (OB_UNLIKELY(end - start > REPLAY_PRINT_TRACE_THRESHOLD) && REACH_TIME_INTERVAL(1L * 1000 * 1000)) {
need_print_trace_log_ = true;
}
......@@ -3488,8 +3438,8 @@ int ObPartTransCtx::replay_sp_redo_log(
int ObPartTransCtx::replay_sp_commit_log(const ObSpTransCommitLog& log, const int64_t timestamp, const uint64_t log_id)
{
int ret = OB_SUCCESS;
const int64_t start = ObTimeUtility::fast_current_time();
CtxTransTableLockGuard guard(lock_, trans_table_seqlock_);
if (IS_NOT_INIT) {
......@@ -3611,9 +3561,6 @@ int ObPartTransCtx::replay_sp_commit_log(const ObSpTransCommitLog& log, const in
timestamp,
OB_ID(uref),
get_uref());
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_commit_log_replay_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_commit_log_replay_time(tenant_id_, end - start);
return ret;
}
......@@ -3691,9 +3638,6 @@ int ObPartTransCtx::replay_sp_abort_log(const ObSpTransAbortLog& log, const int6
timestamp,
OB_ID(uref),
get_uref());
const int64_t end = ObClockGenerator::getClock();
ObTransStatistic::get_instance().add_abort_log_replay_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_abort_log_replay_time(tenant_id_, end - start);
return ret;
}
......@@ -3703,8 +3647,8 @@ int ObPartTransCtx::replay_redo_log(const ObTransRedoLog& log, const int64_t tim
{
int ret = OB_SUCCESS;
int tmp_ret = OB_SUCCESS;
const int64_t start = ObTimeUtility::fast_current_time();
ObWorker::CompatMode mode = ObWorker::CompatMode::INVALID;
const int64_t start = ObTimeUtility::fast_current_time();
CtxTransTableLockGuard guard(lock_, trans_table_seqlock_);
......@@ -3783,8 +3727,7 @@ int ObPartTransCtx::replay_redo_log(const ObTransRedoLog& log, const int64_t tim
is_redo_prepared_ = true;
}
if (OB_SUCC(ret)) {
const ObTransMutator& mutator = log.get_mutator();
const int64_t mutator_size = mutator.get_position();
const ObTransMutator &mutator = log.get_mutator();
bool replayed = true;
if (0 == mutator.get_position() && is_xa_local_trans()) {
replayed = false;
......@@ -3806,7 +3749,6 @@ int ObPartTransCtx::replay_redo_log(const ObTransRedoLog& log, const int64_t tim
TRANS_LOG(INFO, "no need to replay, maybe partition already removed", K(log), K(*this));
}
}
ObTransStatistic::get_instance().add_memstore_mutator_size(tenant_id_, mutator_size);
}
}
REC_TRANS_TRACE_EXT(tlog_,
......@@ -3846,10 +3788,8 @@ int ObPartTransCtx::replay_redo_log(const ObTransRedoLog& log, const int64_t tim
update_durable_log_id_ts_(OB_LOG_TRANS_REDO, log_id, timestamp);
}
}
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_redo_log_replay_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_redo_log_replay_time(tenant_id_, end - start);
if (OB_UNLIKELY(end - start > REPLAY_PRINT_TRACE_THRESHOLD) && REACH_TIME_INTERVAL(1L * 1000 * 1000)) {
if (OB_UNLIKELY(ObTimeUtility::fast_current_time() - start > REPLAY_PRINT_TRACE_THRESHOLD) &&
REACH_TIME_INTERVAL(1L * 1000 * 1000)) {
need_print_trace_log_ = true;
}
......@@ -3861,9 +3801,9 @@ int ObPartTransCtx::replay_prepare_log(const ObTransPrepareLog& log, const int64
{
UNUSED(checkpoint);
int ret = OB_SUCCESS;
const int64_t start = ObTimeUtility::fast_current_time();
int64_t commit_version = 0;
bool can_checkpoint = false;
const int64_t start = ObTimeUtility::fast_current_time();
CtxTransTableLockGuard guard(lock_, trans_table_seqlock_);
if (IS_NOT_INIT) {
......@@ -4030,9 +3970,6 @@ int ObPartTransCtx::replay_prepare_log(const ObTransPrepareLog& log, const int64
can_checkpoint,
OB_ID(uref),
get_uref());
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_prepare_log_replay_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_prepare_log_replay_time(tenant_id_, end - start);
return ret;
}
......@@ -4124,9 +4061,6 @@ int ObPartTransCtx::replay_commit_log(const ObTransCommitLog& log, const int64_t
timestamp,
OB_ID(uref),
get_uref());
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_commit_log_replay_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_commit_log_replay_time(tenant_id_, end - start);
return ret;
}
......@@ -4341,9 +4275,6 @@ int ObPartTransCtx::replay_abort_log(const ObTransAbortLog& log, const int64_t t
timestamp,
OB_ID(uref),
get_uref());
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_abort_log_replay_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_abort_log_replay_time(tenant_id_, end - start);
return ret;
}
......@@ -4416,9 +4347,6 @@ int ObPartTransCtx::replay_clear_log(const ObTransClearLog& log, const int64_t t
timestamp,
OB_ID(uref),
get_uref());
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_clear_log_replay_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_clear_log_replay_time(tenant_id_, end - start);
return ret;
}
......@@ -4603,8 +4531,7 @@ int ObPartTransCtx::replay_trans_mutator_log(
store_ctx.mem_ctx_ = &mt_ctx_;
store_ctx.tenant_id_ = self_.get_tenant_id();
store_ctx.log_ts_ = timestamp;
const ObTransMutator& mutator = log.get_mutator();
const int64_t mutator_size = mutator.get_position();
const ObTransMutator &mutator = log.get_mutator();
bool replayed = true;
if (OB_FAIL(partition_service_->replay_redo_log(
self_, store_ctx, timestamp, log_id, mutator.get_data(), mutator.get_position(), replayed))) {
......@@ -4626,7 +4553,6 @@ int ObPartTransCtx::replay_trans_mutator_log(
} else {
TRANS_LOG(INFO, "no need to replay, maybe partition already removed", K(log), K(*this));
}
ObTransStatistic::get_instance().add_memstore_mutator_size(tenant_id_, mutator_size);
}
if (OB_FAIL(ret)) {
TRANS_LOG(WARN, "replay trans mutator log error", KR(ret), "context", *this, K(log), K(log_id));
......@@ -4716,9 +4642,6 @@ int ObPartTransCtx::replay_mutator_abort_log(
timestamp,
OB_ID(uref),
get_uref());
const int64_t end = ObClockGenerator::getClock();
ObTransStatistic::get_instance().add_abort_log_replay_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_abort_log_replay_time(tenant_id_, end - start);
return ret;
}
......@@ -4907,7 +4830,6 @@ int ObPartTransCtx::fill_redo_log_(char* buf, const int64_t size, int64_t& pos,
int64_t tmp_pos = pos;
int64_t available_capacity = 0;
ObTimeGuard timeguard("fill_redo_log", 10 * 1000);
const int64_t start = ObTimeUtility::fast_current_time();
ObElrTransInfoArray trans_array;
{
......@@ -4973,9 +4895,6 @@ int ObPartTransCtx::fill_redo_log_(char* buf, const int64_t size, int64_t& pos,
pos = tmp_pos;
mutator_size = mutator.get_position();
}
ObTransStatistic::get_instance().add_fill_redo_log_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_fill_redo_log_time(
tenant_id_, ObTimeUtility::fast_current_time() - start);
} else if (OB_SUCCESS == ret || OB_EAGAIN == ret) {
int tmp_ret = OB_SUCCESS;
if (OB_SUCCESS != (tmp_ret = log.serialize(buf, size, tmp_pos))) {
......@@ -4987,9 +4906,6 @@ int ObPartTransCtx::fill_redo_log_(char* buf, const int64_t size, int64_t& pos,
mutator_size = mutator.get_position();
last_redo_log_mutator_size_ = mutator.get_position();
}
ObTransStatistic::get_instance().add_fill_redo_log_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_fill_redo_log_time(
tenant_id_, ObTimeUtility::fast_current_time() - start);
} else if (OB_ENTRY_NOT_EXIST == ret) {
last_redo_log_mutator_size_ = 0;
} else {
......@@ -5313,7 +5229,6 @@ int ObPartTransCtx::fill_redo_prepare_commit_clear_log_(
int ObPartTransCtx::fill_sp_redo_log_(ObSpTransRedoLog& sp_redo_log, const int64_t capacity, int64_t& mutator_size)
{
int ret = OB_SUCCESS;
const int64_t start = ObTimeUtility::fast_current_time();
if (OB_UNLIKELY(!sp_redo_log.is_valid()) || OB_UNLIKELY(capacity < 0)) {
ret = OB_INVALID_ARGUMENT;
......@@ -5333,9 +5248,6 @@ int ObPartTransCtx::fill_sp_redo_log_(ObSpTransRedoLog& sp_redo_log, const int64
}
}
ObTransStatistic::get_instance().add_fill_redo_log_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_fill_redo_log_time(tenant_id_, ObTimeUtility::fast_current_time() - start);
return ret;
}
......@@ -5708,7 +5620,6 @@ int ObPartTransCtx::fill_mutator_log_(char* buf, const int64_t size, int64_t& po
int64_t available_capacity = 0;
ObTransMutatorLog log;
ObTimeGuard timeguard("fill_mutator_log", 10 * 1000);
const int64_t start = ObTimeUtility::fast_current_time();
{
ObElrTransArrGuard guard;
......@@ -5756,8 +5667,6 @@ int ObPartTransCtx::fill_mutator_log_(char* buf, const int64_t size, int64_t& po
pos = tmp_pos;
mutator_size = mutator.get_position();
}
ObTransStatistic::get_instance().add_fill_redo_log_count(tenant_id_, 1);
ObTransStatistic::get_instance().add_fill_redo_log_time(tenant_id_, ObTimeUtility::fast_current_time() - start);
} else if (OB_ENTRY_NOT_EXIST == ret) {
// do nothing
} else {
......@@ -6617,11 +6526,6 @@ int ObPartTransCtx::submit_log_impl_(const int64_t log_type, const bool pending,
inc_submit_log_count_();
}
}
if (OB_SUCC(ret)) {
if (mutator_size > 0) {
ObTransStatistic::get_instance().add_memstore_mutator_size(tenant_id_, mutator_size);
}
}
timeguard.click();
REC_TRANS_TRACE_EXT(tlog_, submit_log, Y(ret), OB_ID(uref), get_uref(), Y(timeguard));
}
......
......@@ -725,7 +725,6 @@ int ObTsMgr::update_local_trans_version(const uint64_t tenant_id, const int64_t
// you need to register the asynchronous callback task
int ObTsMgr::get_gts(const uint64_t tenant_id, ObTsCbTask* task, int64_t& gts)
{
const int64_t start = ObTimeUtility::fast_current_time();
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!is_inited_)) {
......@@ -765,20 +764,12 @@ int ObTsMgr::get_gts(const uint64_t tenant_id, ObTsCbTask* task, int64_t& gts)
}
} while (OB_SUCCESS == ret);
}
// If the gts acquisition fails, you need to register the wait task,
// and you don't need to count the total time of the gts acquire at this time.
if (GCONF.enable_record_trace_log && OB_SUCC(ret)) {
ObTransStatistic::get_instance().add_gts_acquire_total_count(tenant_id, 1);
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_gts_acquire_total_time(tenant_id, end - start);
}
return ret;
}
int ObTsMgr::get_local_trans_version(const uint64_t tenant_id, ObTsCbTask* task, int64_t& gts)
{
const int64_t start = ObTimeUtility::fast_current_time();
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!is_inited_)) {
......@@ -818,13 +809,6 @@ int ObTsMgr::get_local_trans_version(const uint64_t tenant_id, ObTsCbTask* task,
}
} while (OB_SUCCESS == ret);
}
// If the gts acquisition fails, you need to register the wait task,
// and you don't need to count the total time of the gts acquire at this time.
if (GCONF.enable_record_trace_log && OB_SUCC(ret)) {
ObTransStatistic::get_instance().add_gts_acquire_total_count(tenant_id, 1);
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_gts_acquire_total_time(tenant_id, end - start);
}
return ret;
}
......@@ -832,7 +816,6 @@ int ObTsMgr::get_local_trans_version(const uint64_t tenant_id, ObTsCbTask* task,
int ObTsMgr::get_local_trans_version(
const uint64_t tenant_id, const MonotonicTs stc, ObTsCbTask* task, int64_t& gts, MonotonicTs& receive_gts_ts)
{
const int64_t start = ObTimeUtility::fast_current_time();
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!is_inited_)) {
......@@ -874,13 +857,6 @@ int ObTsMgr::get_local_trans_version(
}
} while (OB_SUCCESS == ret);
}
// If the gts acquisition fails, you need to register the wait task,
// and you don't need to count the total time of the gts acquire at this time.
if (GCONF.enable_record_trace_log && OB_SUCC(ret)) {
ObTransStatistic::get_instance().add_gts_acquire_total_count(tenant_id, 1);
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_gts_acquire_total_time(tenant_id, end - start);
}
return ret;
}
......@@ -888,7 +864,6 @@ int ObTsMgr::get_local_trans_version(
int ObTsMgr::get_gts(
const uint64_t tenant_id, const MonotonicTs stc, ObTsCbTask* task, int64_t& gts, MonotonicTs& receive_gts_ts)
{
const int64_t start = ObTimeUtility::fast_current_time();
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!is_inited_)) {
......@@ -930,13 +905,6 @@ int ObTsMgr::get_gts(
}
} while (OB_SUCCESS == ret);
}
// If the gts acquisition fails, you need to register the wait task,
// and you do not need to count the total time of the gts acquire at this time
if (GCONF.enable_record_trace_log && OB_SUCC(ret)) {
ObTransStatistic::get_instance().add_gts_acquire_total_count(tenant_id, 1);
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_gts_acquire_total_time(tenant_id, end - start);
}
return ret;
}
......@@ -997,13 +965,6 @@ int ObTsMgr::get_ts_sync(const uint64_t tenant_id, const int64_t timeout_us, int
}
} while (OB_SUCCESS == ret);
}
// If the gts acquisition fails, you need to register the wait task,
// and you don't need to count the total time of the gts acquire at this time.
if (GCONF.enable_record_trace_log && OB_SUCC(ret)) {
ObTransStatistic::get_instance().add_gts_acquire_total_count(tenant_id, 1);
const int64_t end = ObTimeUtility::current_time();
ObTransStatistic::get_instance().add_gts_acquire_total_time(tenant_id, end - start);
}
return ret;
}
......@@ -1200,7 +1161,6 @@ int ObTsMgr::get_publish_version(const uint64_t tenant_id, int64_t& publish_vers
int ObTsMgr::wait_gts_elapse(const uint64_t tenant_id, const int64_t ts, ObTsCbTask* task, bool& need_wait)
{
const int64_t start = ObTimeUtility::fast_current_time();
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!is_inited_)) {
ret = OB_NOT_INIT;
......@@ -1239,11 +1199,6 @@ int ObTsMgr::wait_gts_elapse(const uint64_t tenant_id, const int64_t ts, ObTsCbT
}
} while (OB_SUCCESS == ret);
}
if (GCONF.enable_record_trace_log && OB_SUCC(ret)) {
ObTransStatistic::get_instance().add_gts_wait_elapse_total_count(tenant_id, 1);
const int64_t end = ObTimeUtility::fast_current_time();
ObTransStatistic::get_instance().add_gts_wait_elapse_total_time(tenant_id, end - start);
}
return ret;
}
......@@ -1293,9 +1248,6 @@ int ObTsMgr::get_gts_and_type(const uint64_t tenant_id, const MonotonicTs stc, i
}
} while (OB_SUCCESS == ret);
}
if (GCONF.enable_record_trace_log && OB_SUCC(ret)) {
ObTransStatistic::get_instance().add_gts_try_acquire_total_count(tenant_id, 1);
}
return ret;
}
......@@ -1343,7 +1295,6 @@ int ObTsMgr::wait_gts_elapse(const uint64_t tenant_id, const int64_t ts)
}
} while (OB_SUCCESS == ret);
}
ObTransStatistic::get_instance().add_gts_try_wait_elapse_total_count(tenant_id, 1);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册