do not read by ELR when tenant is not primary

This commit is contained in:
obdev
2023-01-04 13:38:09 +00:00
committed by ob-robot
parent 314746bd3d
commit 4ca6b270f0
2 changed files with 7 additions and 5 deletions

View File

@ -552,7 +552,7 @@ int ObTransService::get_read_snapshot(ObTxDesc &tx,
snapshot.uncertain_bound_))) { snapshot.uncertain_bound_))) {
TRANS_LOG(WARN, "acquire global snapshot fail", K(ret), K(tx)); TRANS_LOG(WARN, "acquire global snapshot fail", K(ret), K(tx));
} else { } else {
if (tx.is_can_elr()) { if (tx.is_can_elr() && MTL_IS_PRIMARY_TENANT()) {
snapshot.core_.version_ = std::max(snapshot.core_.version_, tx_version_mgr_.get_max_commit_ts(true)); snapshot.core_.version_ = std::max(snapshot.core_.version_, tx_version_mgr_.get_max_commit_ts(true));
} }
} }

View File

@ -23,11 +23,13 @@ namespace transaction
int ObTxELRUtil::check_and_update_tx_elr_info(ObTxDesc &tx) int ObTxELRUtil::check_and_update_tx_elr_info(ObTxDesc &tx)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (can_tenant_elr_ && OB_SYS_TENANT_ID != MTL_ID()) { // tenant config enable elr if (OB_SYS_TENANT_ID != MTL_ID() && MTL_IS_PRIMARY_TENANT()) {
tx.set_can_elr(true); if (can_tenant_elr_) { // tenant config enable elr
TX_STAT_ELR_ENABLE_TRANS_INC(MTL_ID()); tx.set_can_elr(true);
TX_STAT_ELR_ENABLE_TRANS_INC(MTL_ID());
}
refresh_elr_tenant_config_();
} }
refresh_elr_tenant_config_();
return ret; return ret;
} }