提交 e35e0058 编写于 作者: O obdev 提交者: ob-robot

fix the background thread's tenant_id is inconsistent with the ps cache's while changing tenants

上级 5e453942
......@@ -1748,7 +1748,6 @@ int ObChangeTenantExecutor::execute(ObExecContext &ctx, ObChangeTenantStmt &stmt
ObPCMemPctConf pc_mem_conf;
// tenant has been locked before
ObPlanCache *pc = conn->tenant_->get<ObPlanCache*>();
ObPsCache *ps = conn->tenant_->get<ObPsCache*>();
int64_t received_schema_version = OB_INVALID_VERSION;
if (OB_SUCC(ret)) {
ret = OB_E(EventTable::EN_CHANGE_TENANT_FAILED) OB_SUCCESS;
......@@ -1770,15 +1769,10 @@ int ObChangeTenantExecutor::execute(ObExecContext &ctx, ObChangeTenantStmt &stmt
K(effective_tenant_id), K(pre_effective_tenant_id), K(received_schema_version));
} else if (OB_FAIL(pc->set_mem_conf(pc_mem_conf))) {
SQL_PC_LOG(WARN, "fail to set plan cache memory conf", K(ret));
} else if (OB_FAIL(ps->set_mem_conf(pc_mem_conf))) {
SQL_PC_LOG(WARN, "fail to set plan cache memory conf", K(ret));
} else if (!ps->is_inited() &&
OB_FAIL(ps->init(common::OB_PLAN_CACHE_BUCKET_NUMBER, effective_tenant_id))) {
LOG_WARN("failed to init ps cache");
} else {
session_info->set_database_id(OB_SYS_DATABASE_ID);
session_info->set_plan_cache(pc);
session_info->set_ps_cache(ps);
session_info->set_ps_cache(NULL);
if (OB_SUCC(ret)) {
// System tenant's __oceanbase_inner_standby_user is used to execute remote sqls
......
......@@ -303,7 +303,8 @@ ObPlanCache::ObPlanCache()
inner_allocator_(),
ref_handle_mgr_(),
pcm_(NULL),
destroy_(0)
destroy_(0),
tg_id_(-1)
{
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册