fix ps cache access out of mtl lock
This commit is contained in:
@ -40,6 +40,7 @@ int ObAllVirtualPsItemInfo::inner_get_next_row()
|
||||
tenant_id_array_idx_ = 0;
|
||||
} else {
|
||||
uint64_t tenant_id = tenant_id_array_.at(tenant_id_array_idx_);
|
||||
MTL_SWITCH(tenant_id) {
|
||||
if (OB_FAIL(get_next_row_from_specified_tenant(tenant_id, is_sub_end))) {
|
||||
SERVER_LOG(WARN, "get_next_row_from_specified_tenant failed", K(ret), K(tenant_id));
|
||||
} else {
|
||||
@ -48,6 +49,7 @@ int ObAllVirtualPsItemInfo::inner_get_next_row()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (is_sub_end && OB_SUCC(ret));
|
||||
return ret;
|
||||
}
|
||||
@ -185,7 +187,6 @@ int ObAllVirtualPsItemInfo::get_next_row_from_specified_tenant(uint64_t tenant_i
|
||||
int ret = OB_SUCCESS;
|
||||
is_end = false;
|
||||
if (OB_INVALID_ID == stmt_id_array_idx_) {
|
||||
MTL_SWITCH(tenant_id) {
|
||||
ps_cache_ = MTL(ObPsCache*);
|
||||
if (false == ps_cache_->is_inited()) {
|
||||
is_end = true;
|
||||
@ -196,7 +197,6 @@ int ObAllVirtualPsItemInfo::get_next_row_from_specified_tenant(uint64_t tenant_i
|
||||
stmt_id_array_idx_ = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && false == is_end) {
|
||||
bool is_filled = false;
|
||||
while (OB_SUCC(ret) && false == is_filled && false == is_end) {
|
||||
|
@ -80,7 +80,6 @@ int ObGVSql::get_row_from_specified_tenant(uint64_t tenant_id, bool &is_end)
|
||||
ObReqTimeGuard req_timeinfo_guard;
|
||||
is_end = false;
|
||||
if (OB_INVALID_ID == static_cast<uint64_t>(plan_id_array_idx_)) {
|
||||
MTL_SWITCH(tenant_id) {
|
||||
plan_cache_ = MTL(ObPlanCache*);
|
||||
NG_TRACE(trav_ps_map_start);
|
||||
ObGetAllCacheIdOp plan_id_op(&plan_id_array_);
|
||||
@ -91,7 +90,6 @@ int ObGVSql::get_row_from_specified_tenant(uint64_t tenant_id, bool &is_end)
|
||||
}
|
||||
NG_TRACE(trav_ps_map_end);
|
||||
}
|
||||
}
|
||||
if (NULL == plan_cache_) {
|
||||
// do nothing
|
||||
is_end = true;
|
||||
@ -899,7 +897,9 @@ int ObGVSql::get_row_from_tenants()
|
||||
ret = OB_ITER_END;
|
||||
tenant_id_array_idx_ = 0;
|
||||
} else {
|
||||
if (OB_FAIL(get_row_from_specified_tenant(tenant_id_array_.at(tenant_id_array_idx_),
|
||||
uint64_t tenant_id = tenant_id_array_.at(tenant_id_array_idx_);
|
||||
MTL_SWITCH(tenant_id) {
|
||||
if (OB_FAIL(get_row_from_specified_tenant(tenant_id,
|
||||
is_sub_end))) {
|
||||
SERVER_LOG(WARN,
|
||||
"fail to insert plan by tenant id",
|
||||
@ -913,6 +913,7 @@ int ObGVSql::get_row_from_tenants()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while(is_sub_end && OB_SUCCESS == ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -165,7 +165,6 @@ int ObVirtualSqlPlanStatistics::get_row_from_specified_tenant(uint64_t tenant_id
|
||||
is_end = false;
|
||||
sql::ObPlanCache *plan_cache = NULL;
|
||||
if (OB_INVALID_ID == static_cast<uint64_t>(operator_stat_array_idx_)) {
|
||||
MTL_SWITCH(tenant_id) {
|
||||
plan_cache = MTL(ObPlanCache*);
|
||||
ObGetAllOperatorStatOp operator_stat_op(&operator_stat_array_);
|
||||
if (OB_FAIL(plan_cache->foreach_cache_obj(operator_stat_op))) {
|
||||
@ -174,7 +173,6 @@ int ObVirtualSqlPlanStatistics::get_row_from_specified_tenant(uint64_t tenant_id
|
||||
operator_stat_array_idx_ = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (operator_stat_array_idx_ < 0) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
@ -310,7 +308,9 @@ int ObVirtualSqlPlanStatistics::inner_get_next_row(common::ObNewRow *&row)
|
||||
ret = OB_ITER_END;
|
||||
tenant_id_array_idx_ = 0;
|
||||
} else {
|
||||
if (OB_FAIL(get_row_from_specified_tenant(tenant_id_array_.at(tenant_id_array_idx_),
|
||||
uint64_t tenant_id = tenant_id_array_.at(tenant_id_array_idx_);
|
||||
MTL_SWITCH(tenant_id) {
|
||||
if (OB_FAIL(get_row_from_specified_tenant(tenant_id,
|
||||
is_sub_end))) {
|
||||
SERVER_LOG(WARN,
|
||||
"fail to insert plan by tenant id",
|
||||
@ -324,6 +324,7 @@ int ObVirtualSqlPlanStatistics::inner_get_next_row(common::ObNewRow *&row)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while(is_sub_end && OB_SUCCESS == ret);
|
||||
if (OB_SUCC(ret)) {
|
||||
row = &cur_row_;
|
||||
|
Reference in New Issue
Block a user