fix longops start time not correct

This commit is contained in:
obdev 2023-04-24 02:44:38 +00:00 committed by ob-robot
parent 610f5a50d4
commit 240d3685c6
11 changed files with 24 additions and 14 deletions

View File

@ -64,9 +64,9 @@ static int easy_encode_uint16(char *buf, const uint64_t buf_len, int64_t *pos, u
{
int ret = ((NULL != buf) &&
((buf_len - *pos) >= (uint64_t)(sizeof(val)))) ? EASY_OK : EASY_ABORT;
if (EASY_OK == ret) {
*(buf + (*pos)++) = (char)((((val) >> 8)) & 0xff);
if (EASY_OK == ret) {
*(buf + (*pos)++) = (char)((((val) >> 8)) & 0xff);
*(buf + (*pos)++) = (char)((val) & 0xff);
}
@ -164,9 +164,9 @@ static int easy_decode_negotiation_msg(easy_negotiation_msg_t *ne_msg, char *rec
easy_info_log("decode eio magic failed!ret:%d.", ret);
return ret;
}
pos++; //for io thread index
*decode_len = pos;
pos++; //for io thread index
*decode_len = pos;
return ret;
}
@ -276,9 +276,9 @@ void net_consume_negotiation_msg(int fd, uint64_t magic)
return;
}
int easy_send_negotiate_message(easy_connection_t *c)
{
int easy_send_negotiate_message(easy_connection_t *c)
{
int ret = EASY_OK;
easy_io_thread_t *ioth = c->ioth;
easy_io_t *eio = ioth->eio;

View File

@ -59,6 +59,7 @@ int ObColumnRedefinitionTask::init(const uint64_t tenant_id, const int64_t task_
} else if (OB_FAIL(ObShareUtil::fetch_current_data_version(*GCTX.sql_proxy_, tenant_id, tenant_data_format_version))) {
LOG_WARN("get min data version failed", K(ret), K(tenant_id));
} else {
set_gmt_create(ObTimeUtility::current_time());
task_type_ = ddl_type;
object_id_ = data_table_id;
target_object_id_ = dest_table_id;

View File

@ -507,6 +507,7 @@ int ObConstraintTask::init(
ret = OB_ERR_SYS;
LOG_WARN("error sys, root service must not be nullptr", K(ret));
} else {
set_gmt_create(ObTimeUtility::current_time());
object_id_ = table_schema->get_table_id();
target_object_id_ = object_id;
tenant_id_ = tenant_id;

View File

@ -179,6 +179,7 @@ int ObDDLRetryTask::init(const uint64_t tenant_id,
} else if (OB_FAIL(init_compat_mode(ddl_type, ddl_arg))) {
LOG_WARN("init compat mode failed", K(ret));
} else {
set_gmt_create(ObTimeUtility::current_time());
object_id_ = object_id;
target_object_id_ = object_id;
schema_version_ = schema_version;

View File

@ -863,6 +863,7 @@ int ObDDLTask::convert_to_record(
int ret = OB_SUCCESS;
const int64_t serialize_param_size = get_serialize_param_size();
int64_t pos = 0;
task_record.gmt_create_ = get_gmt_create();
task_record.tenant_id_ = get_tenant_id();
task_record.object_id_ = get_object_id();
task_record.target_object_id_ = get_target_object_id();
@ -1282,7 +1283,7 @@ int ObDDLTask::copy_longops_stat(ObLongopsValue &value)
value.tenant_id_ = tenant_id_;
value.start_time_ = gmt_create_;
value.finish_time_ = stat_info_.finish_time_;
value.elapsed_seconds_ = (ObTimeUtility::current_time() - stat_info_.start_time_);
value.elapsed_seconds_ = (ObTimeUtility::current_time() - value.start_time_);
value.time_remaining_ = stat_info_.time_remaining_;
value.last_update_time_ = ObTimeUtility::current_time();
MEMCPY(value.op_name_, stat_info_.op_name_, common::MAX_LONG_OPS_NAME_LENGTH);
@ -2442,6 +2443,7 @@ bool ObDDLTaskRecord::is_valid() const
void ObDDLTaskRecord::reset()
{
gmt_create_ = 0;
task_id_ = 0;
parent_task_id_ = 0;
ddl_type_ = ObDDLType::DDL_INVALID;
@ -2988,9 +2990,9 @@ int ObDDLTaskRecordOperator::insert_record(
} else if (OB_FAIL(to_hex_str(record.message_, message_string))) {
LOG_WARN("append hex escaped string failed", K(ret));
} else if (OB_FAIL(sql_string.assign_fmt(
" INSERT INTO %s (task_id, parent_task_id, tenant_id, object_id, schema_version, target_object_id, ddl_type, trace_id, status, task_version, execution_id, ret_code, ddl_stmt_str, message) "
" VALUES (%lu, %lu, %lu, %lu, %lu, %lu, %d, '%s', %ld, %lu, %ld, %lu, '%.*s', \"%.*s\") ",
OB_ALL_DDL_TASK_STATUS_TNAME, record.task_id_, record.parent_task_id_,
" INSERT INTO %s (gmt_create, gmt_modified, task_id, parent_task_id, tenant_id, object_id, schema_version, target_object_id, ddl_type, trace_id, status, task_version, execution_id, ret_code, ddl_stmt_str, message) "
" VALUES (usec_to_time(%lu), usec_to_time(%lu), %lu, %lu, %lu, %lu, %lu, %lu, %d, '%s', %ld, %lu, %ld, %lu, '%.*s', \"%.*s\") ",
OB_ALL_DDL_TASK_STATUS_TNAME, record.gmt_create_, record.gmt_create_, record.task_id_, record.parent_task_id_,
ObSchemaUtils::get_extract_tenant_id(record.tenant_id_, record.tenant_id_), record.object_id_, record.schema_version_,
get_record_id(record.ddl_type_, record.target_object_id_), record.ddl_type_, trace_id_str, record.task_status_, record.task_version_, record.execution_id_, record.ret_code_,
static_cast<int>(ddl_stmt_string.length()), ddl_stmt_string.ptr(), static_cast<int>(message_string.length()), message_string.ptr()))) {

View File

@ -432,7 +432,7 @@ public:
target_object_id_(0), task_status_(share::ObDDLTaskStatus::PREPARE), snapshot_version_(0), ret_code_(OB_SUCCESS), task_id_(0),
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), stat_info_(), delay_schedule_time_(0), next_schedule_ts_(0),
longops_stat_(nullptr), gmt_create_(0), stat_info_(), delay_schedule_time_(0), next_schedule_ts_(0),
execution_id_(-1), sql_exec_addr_(), start_time_(0), data_format_version_(0)
{}
virtual ~ObDDLTask() {}

View File

@ -56,6 +56,7 @@ int ObDropIndexTask::init(
} else if (OB_FAIL(deep_copy_index_arg(allocator_, drop_index_arg, drop_index_arg_))) {
LOG_WARN("deep copy drop index arg failed", K(ret));
} else {
set_gmt_create(ObTimeUtility::current_time());
tenant_id_ = tenant_id;
object_id_ = data_table_id;
target_object_id_ = index_table_id;

View File

@ -48,6 +48,7 @@ int ObDropPrimaryKeyTask::init(const uint64_t tenant_id, const int64_t task_id,
alter_table_arg, task_status, snapshot_version))) {
LOG_WARN("fail to init ObDropPrimaryKeyTask", K(ret));
} else {
set_gmt_create(ObTimeUtility::current_time());
consumer_group_id_ = consumer_group_id;
task_version_ = OB_DROP_PRIMARY_KEY_TASK_VERSION;
ddl_tracing_.open();

View File

@ -351,6 +351,7 @@ int ObIndexBuildTask::init(
} else if (OB_FAIL(ObShareUtil::fetch_current_data_version(*GCTX.sql_proxy_, tenant_id, tenant_data_format_version))) {
LOG_WARN("get min data version failed", K(ret), K(tenant_id));
} else {
set_gmt_create(ObTimeUtility::current_time());
is_global_index_ = index_schema->is_global_index_table();
is_unique_index_ = index_schema->is_unique_index();
tenant_id_ = tenant_id;

View File

@ -171,6 +171,7 @@ int ObModifyAutoincTask::init(const uint64_t tenant_id,
} else if (OB_FAIL(set_ddl_stmt_str(alter_table_arg_.ddl_stmt_str_))) {
LOG_WARN("set ddl stmt str failed", K(ret));
} else {
set_gmt_create(ObTimeUtility::current_time());
task_type_ = ObDDLType::DDL_MODIFY_AUTO_INCREMENT;
object_id_ = table_id;
target_object_id_ = table_id;

View File

@ -63,6 +63,7 @@ int ObTableRedefinitionTask::init(const uint64_t tenant_id, const int64_t task_i
} else if (OB_FAIL(ObShareUtil::fetch_current_data_version(*GCTX.sql_proxy_, tenant_id, tenant_data_format_version))) {
LOG_WARN("get min data version failed", K(ret), K(tenant_id));
} else {
set_gmt_create(ObTimeUtility::current_time());
consumer_group_id_ = consumer_group_id;
task_type_ = ddl_type;
object_id_ = data_table_id;