fix create index costs too much time due to query latest execution id failed.
This commit is contained in:
parent
7c77f7f746
commit
f0ba5ff942
@ -193,7 +193,6 @@ int ObColumnRedefinitionTask::update_complete_sstable_job_status(const common::O
|
|||||||
const int ret_code)
|
const int ret_code)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
bool is_latest_execution_id = false;
|
|
||||||
if (OB_UNLIKELY(!is_inited_)) {
|
if (OB_UNLIKELY(!is_inited_)) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("ObColumnRedefinitionTask has not been inited", K(ret));
|
LOG_WARN("ObColumnRedefinitionTask has not been inited", K(ret));
|
||||||
@ -202,10 +201,8 @@ int ObColumnRedefinitionTask::update_complete_sstable_job_status(const common::O
|
|||||||
} else if (snapshot_version != snapshot_version_) {
|
} else if (snapshot_version != snapshot_version_) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("snapshot version not match", K(ret), K(snapshot_version), K(snapshot_version_));
|
LOG_WARN("snapshot version not match", K(ret), K(snapshot_version), K(snapshot_version_));
|
||||||
} else if (OB_FAIL(check_is_latest_execution_id(execution_id, is_latest_execution_id))) {
|
} else if (execution_id < execution_id_) {
|
||||||
LOG_WARN("failed to check latest execution id", K(ret), K(execution_id));
|
LOG_INFO("receive a mismatch execution result, ignore", K(ret_code), K(execution_id), K(execution_id_));
|
||||||
} else if (!is_latest_execution_id) {
|
|
||||||
LOG_INFO("receive a mismatch execution result, ignore", K(execution_id), K(execution_id_));
|
|
||||||
} else if (OB_FAIL(replica_builder_.set_partition_task_status(tablet_id, ret_code))) {
|
} else if (OB_FAIL(replica_builder_.set_partition_task_status(tablet_id, ret_code))) {
|
||||||
LOG_WARN("fail to set partition task status", K(ret));
|
LOG_WARN("fail to set partition task status", K(ret));
|
||||||
}
|
}
|
||||||
|
@ -590,30 +590,6 @@ int ObDDLTask::batch_release_snapshot(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObDDLTask::check_is_latest_execution_id(const int64_t execution_id, bool &is_latest)
|
|
||||||
{
|
|
||||||
int ret = OB_SUCCESS;
|
|
||||||
is_latest = true;
|
|
||||||
ObMySQLTransaction trans;
|
|
||||||
ObRootService *root_service = nullptr;
|
|
||||||
int64_t table_task_status = 0;
|
|
||||||
int64_t table_execution_id = 0;
|
|
||||||
if (OB_ISNULL(root_service = GCTX.root_service_)) {
|
|
||||||
ret = OB_ERR_UNEXPECTED;
|
|
||||||
LOG_WARN("error unexpected, root service must not be nullptr", K(ret));
|
|
||||||
} else if (OB_FAIL(trans.start(&root_service->get_sql_proxy(), tenant_id_))) {
|
|
||||||
LOG_WARN("start transaction failed", K(ret));
|
|
||||||
} else {
|
|
||||||
if (OB_FAIL(ObDDLTaskRecordOperator::select_for_update(trans, tenant_id_, task_id_, table_task_status, table_execution_id))) {
|
|
||||||
LOG_WARN("select for update failed", K(ret), K(task_id_));
|
|
||||||
} else if (table_execution_id > execution_id) {
|
|
||||||
is_latest = false;
|
|
||||||
}
|
|
||||||
trans.end(false);// abort
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ObDDLTask::push_execution_id()
|
int ObDDLTask::push_execution_id()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
@ -338,7 +338,6 @@ public:
|
|||||||
K_(task_version), K_(parallelism), K_(ddl_stmt_str), K_(compat_mode),
|
K_(task_version), K_(parallelism), K_(ddl_stmt_str), K_(compat_mode),
|
||||||
K_(sys_task_id), K_(err_code_occurence_cnt), K_(next_schedule_ts), K_(delay_schedule_time), K(execution_id_), K(sql_exec_addr_));
|
K_(sys_task_id), K_(err_code_occurence_cnt), K_(next_schedule_ts), K_(delay_schedule_time), K(execution_id_), K(sql_exec_addr_));
|
||||||
protected:
|
protected:
|
||||||
int check_is_latest_execution_id(const int64_t execution_id, bool &is_latest);
|
|
||||||
virtual bool is_error_need_retry(const int ret_code)
|
virtual bool is_error_need_retry(const int ret_code)
|
||||||
{
|
{
|
||||||
return !share::ObIDDLTask::in_ddl_retry_black_list(ret_code) && (share::ObIDDLTask::in_ddl_retry_white_list(ret_code)
|
return !share::ObIDDLTask::in_ddl_retry_black_list(ret_code) && (share::ObIDDLTask::in_ddl_retry_white_list(ret_code)
|
||||||
|
@ -958,7 +958,6 @@ int ObIndexBuildTask::update_complete_sstable_job_status(
|
|||||||
const int ret_code)
|
const int ret_code)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
bool is_latest_execution_id = false;
|
|
||||||
if (OB_UNLIKELY(!is_inited_)) {
|
if (OB_UNLIKELY(!is_inited_)) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("not init", K(ret));
|
LOG_WARN("not init", K(ret));
|
||||||
@ -971,10 +970,8 @@ int ObIndexBuildTask::update_complete_sstable_job_status(
|
|||||||
} else if (snapshot_version != snapshot_version_) {
|
} else if (snapshot_version != snapshot_version_) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("snapshot version not match", K(ret), K(snapshot_version), K(snapshot_version_));
|
LOG_WARN("snapshot version not match", K(ret), K(snapshot_version), K(snapshot_version_));
|
||||||
} else if (OB_FAIL(check_is_latest_execution_id(execution_id, is_latest_execution_id))) {
|
} else if (execution_id < execution_id_) {
|
||||||
LOG_WARN("failed to check latest execution id", K(ret), K(execution_id));
|
LOG_INFO("receive a mismatch execution result, ignore", K(ret_code), K(execution_id), K(execution_id_));
|
||||||
} else if (!is_latest_execution_id) {
|
|
||||||
LOG_INFO("receive a mismatch execution result, ignore", K(execution_id), K(execution_id_));
|
|
||||||
} else {
|
} else {
|
||||||
complete_sstable_job_ret_code_ = ret_code;
|
complete_sstable_job_ret_code_ = ret_code;
|
||||||
sstable_complete_ts_ = ObTimeUtility::current_time();
|
sstable_complete_ts_ = ObTimeUtility::current_time();
|
||||||
|
@ -119,7 +119,6 @@ int ObTableRedefinitionTask::update_complete_sstable_job_status(const common::Ob
|
|||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
TCWLockGuard guard(lock_);
|
TCWLockGuard guard(lock_);
|
||||||
UNUSED(tablet_id);
|
UNUSED(tablet_id);
|
||||||
bool is_latest_execution_id = false;
|
|
||||||
if (OB_UNLIKELY(!is_inited_)) {
|
if (OB_UNLIKELY(!is_inited_)) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("ObTableRedefinitionTask has not been inited", K(ret));
|
LOG_WARN("ObTableRedefinitionTask has not been inited", K(ret));
|
||||||
@ -128,10 +127,8 @@ int ObTableRedefinitionTask::update_complete_sstable_job_status(const common::Ob
|
|||||||
} else if (OB_UNLIKELY(snapshot_version_ != snapshot_version)) {
|
} else if (OB_UNLIKELY(snapshot_version_ != snapshot_version)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("error unexpected, snapshot version is not equal", K(ret), K(snapshot_version_), K(snapshot_version));
|
LOG_WARN("error unexpected, snapshot version is not equal", K(ret), K(snapshot_version_), K(snapshot_version));
|
||||||
} else if (OB_FAIL(check_is_latest_execution_id(execution_id, is_latest_execution_id))) {
|
} else if (execution_id < execution_id_) {
|
||||||
LOG_WARN("failed to check latest execution id", K(ret), K(execution_id));
|
LOG_INFO("receive a mismatch execution result, ignore", K(ret_code), K(execution_id), K(execution_id_));
|
||||||
} else if (!is_latest_execution_id) {
|
|
||||||
LOG_INFO("receive a mismatch execution result, ignore", K(execution_id), K(execution_id_));
|
|
||||||
} else {
|
} else {
|
||||||
complete_sstable_job_ret_code_ = ret_code;
|
complete_sstable_job_ret_code_ = ret_code;
|
||||||
execution_id_ = execution_id; // update ObTableRedefinitionTask::execution_id_ from ObDDLRedefinitionSSTableBuildTask::execution_id_
|
execution_id_ = execution_id; // update ObTableRedefinitionTask::execution_id_ from ObDDLRedefinitionSSTableBuildTask::execution_id_
|
||||||
|
@ -60,7 +60,7 @@ public:
|
|||||||
|| common::OB_PARTITION_NOT_EXIST == ret_code || common::OB_PG_IS_REMOVED == ret_code || common::OB_TENANT_NOT_EXIST == ret_code
|
|| common::OB_PARTITION_NOT_EXIST == ret_code || common::OB_PG_IS_REMOVED == ret_code || common::OB_TENANT_NOT_EXIST == ret_code
|
||||||
|| common::OB_RPC_SEND_ERROR == ret_code || common::OB_RPC_CONNECT_ERROR == ret_code || common::OB_DDL_SCHEMA_VERSION_NOT_MATCH == ret_code
|
|| common::OB_RPC_SEND_ERROR == ret_code || common::OB_RPC_CONNECT_ERROR == ret_code || common::OB_DDL_SCHEMA_VERSION_NOT_MATCH == ret_code
|
||||||
|| OB_TRANS_ROLLBACKED == ret_code || OB_TRANS_TIMEOUT == ret_code || OB_ERR_WAIT_REMOTE_SCHEMA_REFRESH == ret_code
|
|| OB_TRANS_ROLLBACKED == ret_code || OB_TRANS_TIMEOUT == ret_code || OB_ERR_WAIT_REMOTE_SCHEMA_REFRESH == ret_code
|
||||||
|| OB_PACKET_STATUS_UNKNOWN == ret_code || OB_TASK_EXPIRED == ret_code
|
|| OB_PACKET_STATUS_UNKNOWN == ret_code || OB_TASK_EXPIRED == ret_code || OB_GET_LOCATION_TIME_OUT == ret_code
|
||||||
|| is_location_service_renew_error(ret_code);
|
|| is_location_service_renew_error(ret_code);
|
||||||
}
|
}
|
||||||
static bool in_ddl_retry_black_list(const int ret_code)
|
static bool in_ddl_retry_black_list(const int ret_code)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user