[CP] remove lock_ddl_operation old lock
This commit is contained in:
parent
348df7f4f8
commit
22c2e18b66
@ -37144,10 +37144,7 @@ int ObDDLSQLTransaction::lock_all_ddl_operation(
|
|||||||
if (OB_ISNULL(conn = dynamic_cast<observer::ObInnerSQLConnection *>(trans.get_connection()))) {
|
if (OB_ISNULL(conn = dynamic_cast<observer::ObInnerSQLConnection *>(trans.get_connection()))) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("conn_ is NULL", KR(ret));
|
LOG_WARN("conn_ is NULL", KR(ret));
|
||||||
} else if (OB_FAIL(schema_service_->get_ddl_trans_controller().check_enable_ddl_trans_new_lock(tenant_id, enable_ddl_trans_new_lock))) {
|
} else {
|
||||||
LOG_WARN("fail to check_enable_ddl_lock_obj", K(ret), K(tenant_id));
|
|
||||||
} else if (enable_ddl_trans_new_lock) {
|
|
||||||
// new lock_obj
|
|
||||||
ObLockObjRequest lock_arg;
|
ObLockObjRequest lock_arg;
|
||||||
lock_arg.obj_type_ = ObLockOBJType::OBJ_TYPE_TENANT;
|
lock_arg.obj_type_ = ObLockOBJType::OBJ_TYPE_TENANT;
|
||||||
lock_arg.obj_id_ = tenant_id;
|
lock_arg.obj_id_ = tenant_id;
|
||||||
@ -37160,32 +37157,6 @@ int ObDDLSQLTransaction::lock_all_ddl_operation(
|
|||||||
conn))) {
|
conn))) {
|
||||||
LOG_WARN("lock table failed", KR(ret), K(tenant_id));
|
LOG_WARN("lock table failed", KR(ret), K(tenant_id));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
uint64_t compat_version = 0;
|
|
||||||
// first use old all_ddl_operation row lock
|
|
||||||
if (OB_FAIL(lock_all_ddl_operation(trans, tenant_id))) {
|
|
||||||
LOG_WARN("lock all_ddl_operation failed", K(ret), K(tenant_id));
|
|
||||||
} else if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id, compat_version))) {
|
|
||||||
LOG_WARN("get min data_version failed", K(ret), K(tenant_id));
|
|
||||||
} else if (compat_version >= DATA_VERSION_4_1_0_0) {
|
|
||||||
// new lock_obj
|
|
||||||
ObLockObjRequest lock_arg;
|
|
||||||
lock_arg.obj_type_ = ObLockOBJType::OBJ_TYPE_TENANT;
|
|
||||||
lock_arg.obj_id_ = tenant_id;
|
|
||||||
lock_arg.owner_id_.set_default();
|
|
||||||
lock_arg.lock_mode_ = !enable_parallel ? EXCLUSIVE : SHARE;
|
|
||||||
lock_arg.op_type_ = ObTableLockOpType::IN_TRANS_COMMON_LOCK;
|
|
||||||
lock_arg.timeout_us_ = ctx.get_timeout();
|
|
||||||
if (OB_FAIL(ObInnerConnectionLockUtil::lock_obj(tenant_id,
|
|
||||||
lock_arg,
|
|
||||||
conn))) {
|
|
||||||
LOG_WARN("lock table failed", KR(ret), K(tenant_id));
|
|
||||||
} else if (OB_FAIL(schema_service_->get_ddl_trans_controller().set_enable_ddl_trans_new_lock(tenant_id))) {
|
|
||||||
LOG_WARN("set enable_ddl_lock_obj failed", K(ret), K(tenant_id));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// only use old ddl operation row lock
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -37,8 +37,6 @@ int ObDDLTransController::init(share::schema::ObMultiVersionSchemaService *schem
|
|||||||
LOG_WARN("schema_service is null", KR(ret));
|
LOG_WARN("schema_service is null", KR(ret));
|
||||||
} else if (OB_FAIL(tenants_.create(10))) {
|
} else if (OB_FAIL(tenants_.create(10))) {
|
||||||
LOG_WARN("hashset create fail", KR(ret));
|
LOG_WARN("hashset create fail", KR(ret));
|
||||||
} else if (OB_FAIL(tenant_for_ddl_trans_new_lock_.create(10))) {
|
|
||||||
LOG_WARN("hashset create fail", KR(ret));
|
|
||||||
} else if (OB_FAIL(ObThreadPool::start())) {
|
} else if (OB_FAIL(ObThreadPool::start())) {
|
||||||
LOG_WARN("thread start fail", KR(ret));
|
LOG_WARN("thread start fail", KR(ret));
|
||||||
} else {
|
} else {
|
||||||
@ -70,7 +68,6 @@ void ObDDLTransController::destroy()
|
|||||||
ObThreadPool::destroy();
|
ObThreadPool::destroy();
|
||||||
tasks_.destroy();
|
tasks_.destroy();
|
||||||
tenants_.destroy();
|
tenants_.destroy();
|
||||||
tenant_for_ddl_trans_new_lock_.destroy();
|
|
||||||
schema_service_ = NULL;
|
schema_service_ = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,43 +360,6 @@ int ObDDLTransController::remove_task(const uint64_t tenant_id, const int64_t ta
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObDDLTransController::check_enable_ddl_trans_new_lock(
|
|
||||||
const uint64_t tenant_id, bool &res)
|
|
||||||
{
|
|
||||||
int ret = OB_SUCCESS;
|
|
||||||
if (!inited_) {
|
|
||||||
ret = OB_NOT_INIT;
|
|
||||||
LOG_WARN("ObDDLTransController", KR(ret));
|
|
||||||
} else {
|
|
||||||
SpinRLockGuard guard(lock_for_tenant_set_);
|
|
||||||
ret = tenant_for_ddl_trans_new_lock_.exist_refactored(tenant_id);
|
|
||||||
if (OB_HASH_EXIST == ret) {
|
|
||||||
res = true;
|
|
||||||
ret = OB_SUCCESS;
|
|
||||||
} else if (OB_HASH_NOT_EXIST == ret) {
|
|
||||||
res = false;
|
|
||||||
ret = OB_SUCCESS;
|
|
||||||
} else {
|
|
||||||
LOG_WARN("check tenant in hashset fail", KR(ret), K(tenant_id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ObDDLTransController::set_enable_ddl_trans_new_lock(const uint64_t tenant_id)
|
|
||||||
{
|
|
||||||
int ret = OB_SUCCESS;
|
|
||||||
if (!inited_) {
|
|
||||||
ret = OB_NOT_INIT;
|
|
||||||
LOG_WARN("ObDDLTransController", KR(ret));
|
|
||||||
} else {
|
|
||||||
SpinWLockGuard guard(lock_for_tenant_set_);
|
|
||||||
if (OB_FAIL(tenant_for_ddl_trans_new_lock_.set_refactored(tenant_id, 1, 0, 1))) {
|
|
||||||
LOG_WARN("fail set enable_ddl_trans_new_lock", KR(ret), K(tenant_id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end schema
|
} // end schema
|
||||||
} // end share
|
} // end share
|
||||||
|
@ -54,8 +54,6 @@ public:
|
|||||||
ObIArray<int64_t> &schema_version_res);
|
ObIArray<int64_t> &schema_version_res);
|
||||||
int wait_task_ready(const uint64_t tenant_id, const int64_t task_id, const int64_t wait_us);
|
int wait_task_ready(const uint64_t tenant_id, const int64_t task_id, const int64_t wait_us);
|
||||||
int remove_task(const uint64_t tenant_id, const int64_t task_id);
|
int remove_task(const uint64_t tenant_id, const int64_t task_id);
|
||||||
int check_enable_ddl_trans_new_lock(const uint64_t tenant_id, bool &res);
|
|
||||||
int set_enable_ddl_trans_new_lock(const uint64_t tenant_id);
|
|
||||||
int broadcast_consensus_version(const int64_t tenant_id,
|
int broadcast_consensus_version(const int64_t tenant_id,
|
||||||
const int64_t schema_version,
|
const int64_t schema_version,
|
||||||
const ObArray<ObAddr> &server_list);
|
const ObArray<ObAddr> &server_list);
|
||||||
@ -71,9 +69,6 @@ private:
|
|||||||
|
|
||||||
common::hash::ObHashSet<uint64_t> tenants_;
|
common::hash::ObHashSet<uint64_t> tenants_;
|
||||||
|
|
||||||
// for compat
|
|
||||||
common::SpinRWLock lock_for_tenant_set_;
|
|
||||||
common::hash::ObHashSet<uint64_t> tenant_for_ddl_trans_new_lock_;
|
|
||||||
|
|
||||||
common::ObCond wait_cond_;
|
common::ObCond wait_cond_;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user