fix create index hang
This commit is contained in:
parent
7f58d252c0
commit
f47b3587de
@ -210,6 +210,7 @@ int ObColumnRedefinitionTask::check_build_single_replica(bool &is_end)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
is_end = false;
|
||||
TCRLockGuard guard(lock_);
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObColumnRedefinitionTask has not been inited", K(ret));
|
||||
|
@ -2241,3 +2241,9 @@ int ObDDLRedefinitionTask::reap_old_replica_build_task(bool &need_exec_new_inner
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t ObDDLRedefinitionTask::get_build_replica_request_time()
|
||||
{
|
||||
TCRLockGuard guard(lock_);
|
||||
return build_replica_request_time_;
|
||||
}
|
||||
|
@ -209,6 +209,7 @@ protected:
|
||||
int get_child_task_ids(char *buf, int64_t len);
|
||||
int get_estimated_timeout(const share::schema::ObTableSchema *dst_table_schema, int64_t &estimated_timeout);
|
||||
int get_orig_all_index_tablet_count(ObSchemaGetterGuard &schema_guard, int64_t &all_tablet_count);
|
||||
int64_t get_build_replica_request_time();
|
||||
protected:
|
||||
struct DependTaskStatus final
|
||||
{
|
||||
|
@ -852,6 +852,12 @@ int ObIndexBuildTask::check_build_single_replica(bool &is_end)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ObIndexBuildTask::is_sstable_complete_task_submitted()
|
||||
{
|
||||
TCRLockGuard guard(lock_);
|
||||
return is_sstable_complete_task_submitted_;
|
||||
}
|
||||
|
||||
int ObIndexBuildTask::wait_data_complement()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -868,7 +874,7 @@ int ObIndexBuildTask::wait_data_complement()
|
||||
bool is_request_end = false;
|
||||
|
||||
// submit a job to complete sstable for the index table on snapshot_version
|
||||
if (OB_SUCC(ret) && !state_finished && !is_sstable_complete_task_submitted_) {
|
||||
if (OB_SUCC(ret) && !state_finished && !is_sstable_complete_task_submitted()) {
|
||||
bool need_exec_new_inner_sql = false;
|
||||
if (OB_FAIL(reap_old_replica_build_task(need_exec_new_inner_sql))) {
|
||||
if (OB_EAGAIN == ret) {
|
||||
@ -885,7 +891,7 @@ int ObIndexBuildTask::wait_data_complement()
|
||||
|
||||
DEBUG_SYNC(CREATE_INDEX_REPLICA_BUILD);
|
||||
|
||||
if (OB_SUCC(ret) && !state_finished && is_sstable_complete_task_submitted_) {
|
||||
if (OB_SUCC(ret) && !state_finished && is_sstable_complete_task_submitted()) {
|
||||
if (OB_FAIL(check_build_single_replica(is_request_end))) {
|
||||
LOG_WARN("fail to check build single replica", K(ret));
|
||||
} else if (is_request_end) {
|
||||
|
@ -138,6 +138,7 @@ private:
|
||||
int check_need_acquire_lob_snapshot(const ObTableSchema *data_table_schema,
|
||||
const ObTableSchema *index_table_schema,
|
||||
bool &need_acquire);
|
||||
bool is_sstable_complete_task_submitted();
|
||||
private:
|
||||
static const int64_t OB_INDEX_BUILD_TASK_VERSION = 1;
|
||||
using ObDDLTask::is_inited_;
|
||||
|
@ -269,6 +269,7 @@ int ObTableRedefinitionTask::check_build_replica_timeout()
|
||||
int ObTableRedefinitionTask::check_build_replica_end(bool &is_end)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
TCWLockGuard guard(lock_);
|
||||
if (INT64_MAX == complete_sstable_job_ret_code_) {
|
||||
// not complete
|
||||
} else if (OB_SUCCESS != complete_sstable_job_ret_code_) {
|
||||
@ -327,7 +328,7 @@ int ObTableRedefinitionTask::table_redefinition(const ObDDLTaskStatus next_task_
|
||||
LOG_WARN("unexpected snapshot", K(ret), KPC(this));
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret) && !is_build_replica_end && 0 == build_replica_request_time_) {
|
||||
if (OB_SUCC(ret) && !is_build_replica_end && 0 == get_build_replica_request_time()) {
|
||||
bool need_exec_new_inner_sql = false;
|
||||
if (OB_FAIL(reap_old_replica_build_task(need_exec_new_inner_sql))) {
|
||||
if (OB_EAGAIN == ret) {
|
||||
@ -340,6 +341,7 @@ int ObTableRedefinitionTask::table_redefinition(const ObDDLTaskStatus next_task_
|
||||
} else if (OB_FAIL(send_build_replica_request())) {
|
||||
LOG_WARN("fail to send build replica request", K(ret));
|
||||
} else {
|
||||
TCWLockGuard guard(lock_);
|
||||
build_replica_request_time_ = ObTimeUtility::current_time();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user