fix ddl used old wait trans ctx under new status.

This commit is contained in:
obdev
2024-07-18 14:17:26 +00:00
committed by ob-robot
parent 0aa131314e
commit 6551476e1f
11 changed files with 13 additions and 11 deletions

View File

@ -520,7 +520,7 @@ ObAsyncTask *ObForeignKeyConstraintValidationTask::deep_copy(char *buf, const in
}
ObConstraintTask::ObConstraintTask()
: ObDDLTask(ObDDLType::DDL_INVALID), lock_(), wait_trans_ctx_(),
: ObDDLTask(ObDDLType::DDL_INVALID), lock_(),
alter_table_arg_(), root_service_(nullptr), check_job_ret_code_(INT64_MAX), check_replica_request_time_(0),
snapshot_held_(false)
{

View File

@ -148,7 +148,6 @@ private:
private:
static const int64_t OB_CONSTRAINT_TASK_VERSION = 1;
common::TCRWLock lock_;
ObDDLWaitTransEndCtx wait_trans_ctx_;
obrpc::ObAlterTableArg alter_table_arg_;
common::ObArenaAllocator allocator_;
ObRootService *root_service_;

View File

@ -128,7 +128,7 @@ class ObDDLRedefinitionTask : public ObDDLTask
{
public:
explicit ObDDLRedefinitionTask(const share::ObDDLType task_type):
ObDDLTask(task_type), wait_trans_ctx_(), sync_tablet_autoinc_seq_ctx_(),
ObDDLTask(task_type), sync_tablet_autoinc_seq_ctx_(),
build_replica_request_time_(0), complete_sstable_job_ret_code_(INT64_MAX), alter_table_arg_(),
dependent_task_result_map_(), snapshot_held_(false), has_synced_autoincrement_(false),
has_synced_stats_info_(false), update_autoinc_job_ret_code_(INT64_MAX), update_autoinc_job_time_(0),
@ -281,7 +281,6 @@ protected:
static const int64_t MAX_DEPEND_OBJECT_COUNT = 100L;
static const int64_t RETRY_INTERVAL = 1 * 1000 * 1000; // 1s
static const int64_t RETRY_LIMIT = 100;
ObDDLWaitTransEndCtx wait_trans_ctx_;
ObSyncTabletAutoincSeqCtx sync_tablet_autoinc_seq_ctx_;
int64_t build_replica_request_time_;
int64_t complete_sstable_job_ret_code_;

View File

@ -1161,6 +1161,7 @@ int ObDDLTask::switch_status(const ObDDLTaskStatus new_status, const bool enable
add_event_info(real_new_status, dst_tenant_id_);
task_status_ = real_new_status;
delay_schedule_time_ = 0; // when status changed, schedule immediately
clear_old_status_context();
LOG_INFO("ddl_scheduler switch status", K(ret), "ddl_event_info", ObDDLEventInfo(), K(task_status_));
}
@ -3849,5 +3850,10 @@ int ObDDLTask::remove_sql_exec_addr(const common::ObAddr &addr)
return ret;
}
void ObDDLTask::clear_old_status_context()
{
wait_trans_ctx_.reset();
}
} // end namespace rootserver
} // end namespace oceanbase

View File

@ -542,7 +542,7 @@ public:
parent_task_id_(0), parent_task_key_(), task_version_(0), parallelism_(0),
allocator_(lib::ObLabel("DdlTask")), compat_mode_(lib::Worker::CompatMode::INVALID), err_code_occurence_cnt_(0),
longops_stat_(nullptr), gmt_create_(0), stat_info_(), delay_schedule_time_(0), next_schedule_ts_(0),
execution_id_(-1), start_time_(0), data_format_version_(0), is_pre_split_(false)
execution_id_(-1), start_time_(0), data_format_version_(0), is_pre_split_(false), wait_trans_ctx_()
{}
virtual ~ObDDLTask() {}
virtual int process() = 0;
@ -678,6 +678,8 @@ protected:
}
int init_ddl_task_monitor_info(const uint64_t target_table_id);
virtual bool task_can_retry() const { return true; }
private:
void clear_old_status_context();
protected:
static const int64_t TASK_EXECUTE_TIME_THRESHOLD = 3 * 24 * 60 * 60 * 1000000L; // 3 days
common::TCRWLock lock_;
@ -719,6 +721,7 @@ protected:
uint64_t data_format_version_;
int64_t consumer_group_id_;
bool is_pre_split_;
ObDDLWaitTransEndCtx wait_trans_ctx_;
};
enum ColChecksumStat

View File

@ -28,7 +28,6 @@ using namespace oceanbase::sql;
ObDropIndexTask::ObDropIndexTask()
: ObDDLTask(DDL_DROP_INDEX),
wait_trans_ctx_(),
root_service_(nullptr),
drop_index_arg_()
{

View File

@ -69,7 +69,6 @@ private:
private:
static const int64_t OB_DROP_INDEX_TASK_VERSION = 1;
private:
ObDDLWaitTransEndCtx wait_trans_ctx_;
ObRootService *root_service_;
obrpc::ObDropIndexArg drop_index_arg_;
};

View File

@ -144,7 +144,6 @@ private:
int64_t drop_index_task_id_;
bool drop_index_task_submitted_;
ObRootService *root_service_;
ObDDLWaitTransEndCtx wait_trans_ctx_;
obrpc::ObCreateIndexArg create_index_arg_;
common::hash::ObHashMap<uint64_t, DependTaskStatus> dependent_task_result_map_;
};

View File

@ -174,7 +174,6 @@ private:
bool is_unique_index_;
bool is_global_index_;
ObRootService *root_service_;
ObDDLWaitTransEndCtx wait_trans_ctx_;
bool snapshot_held_;
bool is_sstable_complete_task_submitted_;
int64_t sstable_complete_request_time_;

View File

@ -161,7 +161,7 @@ ObAsyncTask *ObUpdateAutoincSequenceTask::deep_copy(char *buf, const int64_t buf
}
ObModifyAutoincTask::ObModifyAutoincTask()
: ObDDLTask(ObDDLType::DDL_INVALID), lock_(), wait_trans_ctx_(), alter_table_arg_(),
: ObDDLTask(ObDDLType::DDL_INVALID), lock_(), alter_table_arg_(),
update_autoinc_job_ret_code_(INT64_MAX), update_autoinc_job_time_(0)
{
}

View File

@ -85,7 +85,6 @@ private:
private:
static const int64_t OB_MODIFY_AUTOINC_TASK_VERSION = 1L;
common::TCRWLock lock_;
ObDDLWaitTransEndCtx wait_trans_ctx_;
obrpc::ObAlterTableArg alter_table_arg_;
int64_t update_autoinc_job_ret_code_;
int64_t update_autoinc_job_time_;