Fix several tx module's bug

This commit is contained in:
obdev 2023-06-30 03:12:20 +00:00 committed by ob-robot
parent 81cbd7e0fc
commit 65c2560d67
6 changed files with 452466 additions and 314207 deletions

View File

@ -269,13 +269,13 @@ STAT_EVENT_ADD_DEF(BANDWIDTH_OUT_SLEEP_US, "bandwidth out sleep us", ObStatClass
STAT_EVENT_ADD_DEF(MEMSTORE_WRITE_LOCK_WAIT_TIMEOUT_COUNT, "memstore write lock wait timeout count", ObStatClassIds::STORAGE, "memstore write wait timeout count", 60083, false, true)
STAT_EVENT_ADD_DEF(DATA_BLOCK_READ_CNT, "accessed data micro block count", ObStatClassIds::STORAGE, "accessed data micro block count", 60084, false, true)
STAT_EVENT_ADD_DEF(DATA_BLOCK_CACHE_HIT, "data micro block cache hit", ObStatClassIds::STORAGE, "data micro block cache hit", 60085, false, true)
STAT_EVENT_ADD_DEF(INDEX_BLOCK_READ_CNT, "accessed index micro block count", ObStatClassIds::STORAGE, "accessed index micro block count", 60086, false, true)
STAT_EVENT_ADD_DEF(INDEX_BLOCK_CACHE_HIT, "index micro block cache hit", ObStatClassIds::STORAGE, "index micro block cache hit", 60087, false, true)
STAT_EVENT_ADD_DEF(BLOCKSCAN_BLOCK_CNT, "blockscaned data micro block count", ObStatClassIds::STORAGE, "blockscaned data micro block count", 60088, false, true)
STAT_EVENT_ADD_DEF(BLOCKSCAN_ROW_CNT, "blockscaned row count", ObStatClassIds::STORAGE, "blockscaned row count", 60089, false, true)
STAT_EVENT_ADD_DEF(PUSHDOWN_STORAGE_FILTER_ROW_CNT, "storage filtered row count", ObStatClassIds::STORAGE, "storage filter row count", 60090, false, true)
STAT_EVENT_ADD_DEF(DATA_BLOCK_READ_CNT, "accessed data micro block count", ObStatClassIds::STORAGE, "accessed data micro block count", 60084, true, true)
STAT_EVENT_ADD_DEF(DATA_BLOCK_CACHE_HIT, "data micro block cache hit", ObStatClassIds::STORAGE, "data micro block cache hit", 60085, true, true)
STAT_EVENT_ADD_DEF(INDEX_BLOCK_READ_CNT, "accessed index micro block count", ObStatClassIds::STORAGE, "accessed index micro block count", 60086, true, true)
STAT_EVENT_ADD_DEF(INDEX_BLOCK_CACHE_HIT, "index micro block cache hit", ObStatClassIds::STORAGE, "index micro block cache hit", 60087, true, true)
STAT_EVENT_ADD_DEF(BLOCKSCAN_BLOCK_CNT, "blockscaned data micro block count", ObStatClassIds::STORAGE, "blockscaned data micro block count", 60088, true, true)
STAT_EVENT_ADD_DEF(BLOCKSCAN_ROW_CNT, "blockscaned row count", ObStatClassIds::STORAGE, "blockscaned row count", 60089, true, true)
STAT_EVENT_ADD_DEF(PUSHDOWN_STORAGE_FILTER_ROW_CNT, "storage filtered row count", ObStatClassIds::STORAGE, "storage filter row count", 60090, true, true)
// backup & restore
STAT_EVENT_ADD_DEF(BACKUP_IO_READ_COUNT, "backup io read count", ObStatClassIds::STORAGE, "backup io read count", 69000, true, true)

766627
observer.prof

File diff suppressed because it is too large Load Diff

View File

@ -1281,11 +1281,7 @@ int ObSqlTransControl::check_ls_readable(const uint64_t tenant_id,
|| max_stale_time_us <= -2) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ls_id), K(addr), K(max_stale_time_us));
} else if (max_stale_time_us < 0
|| GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_2_0_0) {
// no need check
can_read = true;
} else if (observer::ObServer::get_instance().get_self() == addr) {
} else if (observer::ObServer::get_instance().get_self() == addr && max_stale_time_us > 0) {
storage::ObLSService *ls_svr = MTL(storage::ObLSService *);
storage::ObLSHandle handle;
ObLS *ls = nullptr;
@ -1305,7 +1301,18 @@ int ObSqlTransControl::check_ls_readable(const uint64_t tenant_id,
LOG_WARN("log stream unreadable", K(ls_id), K(addr), K(max_stale_time_us));
}
} else {
LOG_TRACE("log stream is not local", K(ls_id), K(addr));
ObBLKey blk;
bool in_black_list = false;
if (OB_FAIL(blk.init(addr, tenant_id, ls_id))) {
LOG_WARN("ObBLKey init error", K(ret), K(addr), K(tenant_id), K(ls_id));
} else if (OB_FAIL(ObBLService::get_instance().check_in_black_list(blk, in_black_list))) {
LOG_WARN("check in black list error", K(ret), K(blk));
} else {
can_read = (in_black_list ? false : true);
if (!can_read && REACH_TIME_INTERVAL(10 * 1000 * 1000)) {
LOG_WARN("log stream unreadable", K(ls_id), K(blk), K(in_black_list));
}
}
}
return ret;
}

View File

@ -249,7 +249,7 @@ protected:
int64_t ctx_create_time_;
ObTransService *trans_service_;
mutable CtxLock lock_;
//ObTransTraceLog trace_log_;
ObTransTraceLog trace_log_;
ObTransTraceLog *tlog_;
uint64_t cluster_version_;
ObLSTxCtxMgr *ls_tx_ctx_mgr_;

View File

@ -154,7 +154,7 @@ int ObPartTransCtx::init(const uint64_t tenant_id,
if (!GCONF.enable_record_trace_log) {
tlog_ = NULL;
} else {
tlog_ = ObTransTraceLogFactory::alloc();
tlog_ = &trace_log_;
}
is_inited_ = true;
@ -246,7 +246,6 @@ void ObPartTransCtx::destroy()
if (NULL != tlog_) {
print_trace_log_if_necessary_();
ObTransTraceLogFactory::release(tlog_);
tlog_ = NULL;
}
@ -1251,7 +1250,7 @@ int ObPartTransCtx::get_prepare_version_if_prepared(bool &is_prepared, SCN &prep
int ret = OB_SUCCESS;
ObTxState cur_state = exec_info_.state_;
if (ObTxState::PREPARE == cur_state) {
if (ObTxState::PREPARE == cur_state || ObTxState::PRE_COMMIT == cur_state) {
is_prepared = true;
prepare_version = exec_info_.prepare_version_;
} else if (ObTxState::COMMIT == cur_state || ObTxState::ABORT == cur_state
@ -1259,7 +1258,7 @@ int ObPartTransCtx::get_prepare_version_if_prepared(bool &is_prepared, SCN &prep
is_prepared = true;
prepare_version.set_max();
} else {
is_prepared = true;
is_prepared = false;
prepare_version.set_max();
}
if (is_prepared && OB_INVALID_SCN_VAL == prepare_version.get_val_for_gts()) {

View File

@ -132,7 +132,9 @@ int ObTenantWeakReadClusterService::check_leader_info_(int64_t &leader_epoch) co
ret = OB_ERR_UNEXPECTED;
TRANS_LOG(WARN, "log stream service is NULL", K(ret));
} else if (OB_FAIL(ls_svr->get_ls(share::WRS_LS_ID, handle, ObLSGetMod::TRANS_MOD))) {
TRANS_LOG(WARN, "get id service log stream failed", K(ret));
if (OB_LS_NOT_EXIST != ret) {
TRANS_LOG(WARN, "get id service log stream failed", K(ret));
}
} else if (OB_ISNULL(handle.get_ls())) {
ret = OB_LS_NOT_EXIST;
} else if (OB_FAIL(MTL(logservice::ObLogService *)->get_palf_role(share::WRS_LS_ID, role, tmp_epoch))) {