fix ddl rpc timeout out

This commit is contained in:
Charles0429
2022-12-13 07:37:54 +00:00
committed by ob-robot
parent 700ed322cd
commit 9f87d6fb3b
11 changed files with 43 additions and 28 deletions

View File

@ -250,7 +250,7 @@ int ObColumnRedefinitionTask::copy_table_indexes()
LOG_INFO("indexes schema are already built", K(index_ids));
} else {
// if there is no indexes in new tables, we need to rebuild indexes in new table
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg_, index_ids))) {
LOG_WARN("rebuild hidden table index failed", K(ret));
}
@ -358,7 +358,7 @@ int ObColumnRedefinitionTask::copy_table_constraints()
alter_table_arg_.ddl_task_type_ = share::REBUILD_CONSTRAINT_TASK;
alter_table_arg_.table_id_ = object_id_;
alter_table_arg_.hidden_table_id_ = target_object_id_;
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg_, constraint_ids))) {
LOG_WARN("rebuild hidden table constraint failed", K(ret));
}
@ -402,7 +402,7 @@ int ObColumnRedefinitionTask::copy_table_foreign_keys()
alter_table_arg_.ddl_task_type_ = share::REBUILD_FOREIGN_KEY_TASK;
alter_table_arg_.table_id_ = object_id_;
alter_table_arg_.hidden_table_id_ = target_object_id_;
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg_, fk_ids))) {
LOG_WARN("rebuild hidden table constraint failed", K(ret));
}
@ -536,7 +536,7 @@ int ObColumnRedefinitionTask::take_effect(const ObDDLTaskStatus next_task_status
}
} else if (OB_FAIL(sync_stats_info())) {
LOG_WARN("fail to sync stats info", K(ret), K(object_id_), K(target_object_id_));
} else if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).
} else if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg_, objs))) {
LOG_WARN("fail to swap original and hidden table state", K(ret));
if (OB_TIMEOUT == ret) {

View File

@ -1076,14 +1076,15 @@ int ObConstraintTask::set_foreign_key_constraint_validated()
ObSArray<uint64_t> unused_ids;
alter_table_arg.ddl_task_type_ = share::MODIFY_FOREIGN_KEY_STATE_TASK;
alter_table_arg.hidden_table_id_ = object_id_;
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg, unused_ids))) {
LOG_WARN("fail to alter table", K(ret), K(alter_table_arg), K(fk_arg));
}
} else {
if (OB_FAIL(ObDDLUtil::refresh_alter_table_arg(tenant_id_, object_id_, alter_table_arg))) {
LOG_WARN("failed to refresh name for alter table schema", K(ret));
} else if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).alter_table(alter_table_arg, res))) {
} else if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
alter_table(alter_table_arg, res))) {
LOG_WARN("alter table failed", K(ret));
}
}
@ -1146,7 +1147,8 @@ int ObConstraintTask::set_check_constraint_validated()
ObSArray<uint64_t> unused_ids;
alter_table_arg.ddl_task_type_ = share::MODIFY_NOT_NULL_COLUMN_STATE_TASK;
alter_table_arg.hidden_table_id_ = object_id_;
if (OB_FAIL(root_service_->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).execute_ddl_task(alter_table_arg, unused_ids))) {
if (OB_FAIL(root_service_->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg, unused_ids))) {
LOG_WARN("alter table failed", K(ret));
if (OB_TABLE_NOT_EXIST == ret) {
ret = OB_NO_NEED_UPDATE;
@ -1189,7 +1191,8 @@ int ObConstraintTask::set_check_constraint_validated()
}
DEBUG_SYNC(CONSTRAINT_BEFORE_SET_CHECK_CONSTRAINT_VALIDATED_BEFORE_ALTER_TABLE);
if (OB_FAIL(ret)) {
} else if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).alter_table(alter_table_arg, res))) {
} else if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
alter_table(alter_table_arg, res))) {
LOG_WARN("alter table failed", K(ret));
}
}
@ -1247,7 +1250,8 @@ int ObConstraintTask::set_new_not_null_column_validate()
}
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).alter_table(alter_table_arg, res))) {
} else if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
alter_table(alter_table_arg, res))) {
LOG_WARN("alter table failed", K(ret));
} else {
LOG_TRACE("set new not null column validate", K(alter_table_arg));
@ -1339,7 +1343,8 @@ int ObConstraintTask::rollback_failed_check_constraint()
alter_table_arg.is_alter_columns_ = false;
alter_table_arg.index_arg_list_.reset();
alter_table_arg.foreign_key_arg_list_.reset();
if (OB_FAIL(root_service_->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).alter_table(alter_table_arg, tmp_res))) {
if (OB_FAIL(root_service_->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
alter_table(alter_table_arg, tmp_res))) {
LOG_WARN("alter table failed", K(ret));
if (OB_TABLE_NOT_EXIST == ret || OB_ERR_CANT_DROP_FIELD_OR_KEY == ret || OB_ERR_CONTRAINT_NOT_FOUND == ret) {
ret = OB_NO_NEED_UPDATE;
@ -1400,7 +1405,8 @@ int ObConstraintTask::rollback_failed_foregin_key()
ObSArray<uint64_t> unused_ids;
alter_table_arg.ddl_task_type_ = share::MODIFY_FOREIGN_KEY_STATE_TASK;
alter_table_arg.hidden_table_id_ = object_id_;
if (OB_FAIL(root_service_->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).execute_ddl_task(alter_table_arg, unused_ids))) {
if (OB_FAIL(root_service_->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg, unused_ids))) {
LOG_WARN("alter table failed", K(ret));
if (OB_TABLE_NOT_EXIST == ret || OB_ERR_CANT_DROP_FIELD_OR_KEY == ret) {
ret = OB_NO_NEED_UPDATE;
@ -1413,7 +1419,8 @@ int ObConstraintTask::rollback_failed_foregin_key()
} else {
LOG_WARN("failed to refresh name for alter table schema", K(ret));
}
} else if (OB_FAIL(root_service_->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).alter_table(alter_table_arg, tmp_res))) {
} else if (OB_FAIL(root_service_->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
alter_table(alter_table_arg, tmp_res))) {
LOG_WARN("alter table failed", K(ret));
if (OB_TABLE_NOT_EXIST == ret || OB_ERR_CANT_DROP_FIELD_OR_KEY == ret) {
ret = OB_NO_NEED_UPDATE;
@ -1495,7 +1502,7 @@ int ObConstraintTask::rollback_failed_add_not_null_columns()
}
}
if (OB_SUCC(ret)
&& OB_FAIL(root_service_->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).
&& OB_FAIL(root_service_->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg, objs))) {
LOG_WARN("alter table failed", K(ret));
if (OB_TABLE_NOT_EXIST == ret || OB_ERR_CANT_DROP_FIELD_OR_KEY == ret) {

View File

@ -1228,7 +1228,7 @@ int ObDDLRedefinitionTask::finish()
} else if (OB_FAIL(schema_guard.get_table_schema(tenant_id_, object_id_, data_table_schema))) {
LOG_WARN("get data table schema failed", K(ret), K(tenant_id_), K(object_id_));
} else if (nullptr != data_table_schema && data_table_schema->get_association_table_id() != OB_INVALID_ID &&
OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).
OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg_, objs))) {
LOG_WARN("cleanup garbage failed", K(ret));
} else if (OB_FAIL(cleanup())) {
@ -2011,7 +2011,7 @@ template<typename P, typename A>
int ObSyncTabletAutoincSeqCtx::call_and_process_all_tablet_autoinc_seqs(P &proxy, A &arg, const bool is_get)
{
int ret = OB_SUCCESS;
const int64_t rpc_timeout = max(GCONF.rpc_timeout, 1000L * 1000L * 9L);
const int64_t rpc_timeout = ObDDLUtil::get_ddl_rpc_timeout();
const bool force_renew = false;
share::ObLocationService *location_service = nullptr;
ObHashMap<ObLSID, ObSEArray<ObMigrateTabletAutoincSeqParam, 1>> ls_to_tablet_map;

View File

@ -89,7 +89,7 @@ int ObDDLSingleReplicaExecutor::schedule_task()
common::ObIArray<ObPartitionBuildInfo> &build_infos = partition_build_stat_;
ObArray<int64_t> idxs;
const int64_t current_time = ObTimeUtility::current_time();
const int64_t rpc_timeout = max(GCONF.rpc_timeout, 3 * 1000L * 1000L);
const int64_t rpc_timeout = ObDDLUtil::get_ddl_rpc_timeout();
const bool force_renew = true;
bool is_cache_hit = false;
const int64_t expire_renew_time = force_renew ? INT64_MAX : 0;

View File

@ -784,7 +784,7 @@ int group_tablets_leader_addr(const uint64_t tenant_id, const ObIArray<ObTabletI
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(tenant_id), K(tablet_ids.count()));
} else {
const int64_t rpc_timeout = max(GCONF.rpc_timeout, 1000L * 1000L * 9L);
const int64_t rpc_timeout = ObDDLUtil::get_ddl_rpc_timeout();
if (OB_FAIL(group_items.reserve(tablet_ids.count()))) {
LOG_WARN("reserve send array failed", K(ret), K(tablet_ids.count()));
}
@ -830,7 +830,7 @@ int check_trans_end(const ObArray<SendItem> &send_array,
} else {
// group by leader addr and send batch rpc
std::sort(tmp_send_array.begin(), tmp_send_array.end());
const int64_t rpc_timeout = max(GCONF.rpc_timeout, 1000L * 1000L * 9L);
const int64_t rpc_timeout = ObDDLUtil::get_ddl_rpc_timeout();
ObAddr last_addr;
for (int64_t i = 0; OB_SUCC(ret) && i < tmp_send_array.count(); ++i) {
const SendItem &send_item = tmp_send_array.at(i);
@ -1076,7 +1076,7 @@ int ObDDLWaitTransEndCtx::get_snapshot(int64_t &snapshot_version)
ObRootService *root_service = nullptr;
ObFreezeInfoProxy freeze_info_proxy(tenant_id_);
ObSimpleFrozenStatus frozen_status;
const int64_t timeout = 10 * 1000 * 1000;// 10s
const int64_t timeout = ObDDLUtil::get_ddl_rpc_timeout();
SCN curr_ts;
bool is_external_consistent = false;
if (OB_UNLIKELY(!is_inited_)) {
@ -1370,7 +1370,7 @@ int send_batch_calc_rpc(obrpc::ObSrvRpcProxy &rpc_proxy,
int64_t &send_succ_count)
{
int ret = OB_SUCCESS;
const int64_t rpc_timeout = max(GCONF.rpc_timeout, 1000L * 1000L * 9L);
const int64_t rpc_timeout = ObDDLUtil::get_ddl_rpc_timeout();
if (OB_FAIL(rpc_proxy.to(leader_addr)
.by(arg.tenant_id_)
.timeout(rpc_timeout)
@ -1418,7 +1418,7 @@ int ObDDLWaitColumnChecksumCtx::send_calc_rpc(int64_t &send_succ_count)
LOG_WARN("root service or location_cache is null", K(ret), KP(root_service), KP(location_service));
} else {
ObLSID ls_id;
const int64_t rpc_timeout = max(GCONF.rpc_timeout, 1000L * 1000L * 9L);
const int64_t rpc_timeout = ObDDLUtil::get_ddl_rpc_timeout();
ObArray<SendItem> send_array;
for (int64_t i = 0; OB_SUCC(ret) && i < stat_array_.count(); ++i) {
PartitionColChecksumStat &item = stat_array_.at(i);

View File

@ -135,7 +135,7 @@ int ObDropIndexTask::update_index_status(const ObIndexStatus new_status)
arg.in_offline_ddl_white_list_ = index_schema->get_table_state_flag() != TABLE_STATE_NORMAL;
DEBUG_SYNC(BEFORE_UPDATE_GLOBAL_INDEX_STATUS);
if (OB_FAIL(root_service_->get_common_rpc_proxy().to(GCTX.self_addr()).update_index_status(arg))) {
if (OB_FAIL(root_service_->get_common_rpc_proxy().to(GCTX.self_addr()).timeout(ObDDLUtil::get_ddl_rpc_timeout()).update_index_status(arg))) {
LOG_WARN("update index status failed", K(ret), K(arg));
} else {
LOG_INFO("notify index status changed finish", K(new_status), K(target_object_id_));

View File

@ -1063,7 +1063,7 @@ int ObIndexBuildTask::update_index_status_in_schema(const ObTableSchema &index_s
arg.in_offline_ddl_white_list_ = index_schema.get_table_state_flag() != TABLE_STATE_NORMAL;
DEBUG_SYNC(BEFORE_UPDATE_GLOBAL_INDEX_STATUS);
if (OB_FAIL(root_service_->get_common_rpc_proxy().to(GCTX.self_addr()).update_index_status(arg))) {
if (OB_FAIL(root_service_->get_common_rpc_proxy().to(GCTX.self_addr()).timeout(ObDDLUtil::get_ddl_rpc_timeout()).update_index_status(arg))) {
LOG_WARN("update index status failed", K(ret), K(arg));
} else {
LOG_INFO("notify index status changed finish", K(new_status), K(index_table_id_));

View File

@ -457,7 +457,8 @@ int ObModifyAutoincTask::set_schema_available()
} else {
ObSArray<uint64_t> unused_ids;
alter_table_arg_.ddl_task_type_ = share::UPDATE_AUTOINC_SCHEMA;
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).execute_ddl_task(alter_table_arg_, unused_ids))) {
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg_, unused_ids))) {
LOG_WARN("alter table failed", K(ret));
}
}

View File

@ -331,7 +331,7 @@ int ObTableRedefinitionTask::copy_table_indexes()
LOG_INFO("indexes schema are already built", K(index_ids));
} else {
// if there is no indexes in new tables, we need to rebuild indexes in new table
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg_, index_ids))) {
LOG_WARN("rebuild hidden table index failed", K(ret));
}
@ -437,7 +437,7 @@ int ObTableRedefinitionTask::copy_table_constraints()
alter_table_arg_.ddl_task_type_ = share::REBUILD_CONSTRAINT_TASK;
alter_table_arg_.table_id_ = object_id_;
alter_table_arg_.hidden_table_id_ = target_object_id_;
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg_, constraint_ids))) {
LOG_WARN("rebuild hidden table constraint failed", K(ret));
}
@ -506,7 +506,7 @@ int ObTableRedefinitionTask::copy_table_foreign_keys()
alter_table_arg_.ddl_task_type_ = share::REBUILD_FOREIGN_KEY_TASK;
alter_table_arg_.table_id_ = object_id_;
alter_table_arg_.hidden_table_id_ = target_object_id_;
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).
if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg_, fk_ids))) {
LOG_WARN("rebuild hidden table constraint failed", K(ret));
}
@ -657,7 +657,7 @@ int ObTableRedefinitionTask::take_effect(const ObDDLTaskStatus next_task_status)
}
} else if (OB_FAIL(sync_stats_info())) {
LOG_WARN("fail to sync stats info", K(ret), K(object_id_), K(target_object_id_));
} else if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).
} else if (OB_FAIL(root_service->get_ddl_service().get_common_rpc()->to(obrpc::ObRpcProxy::myaddr_).timeout(ObDDLUtil::get_ddl_rpc_timeout()).
execute_ddl_task(alter_table_arg_, objs))) {
LOG_WARN("fail to swap original and hidden table state", K(ret));
if (OB_TIMEOUT == ret) {

View File

@ -899,6 +899,11 @@ int ObDDLUtil::check_table_exist(
return ret;
}
int64_t ObDDLUtil::get_ddl_rpc_timeout()
{
return max(GCONF.rpc_timeout, 9 * 1000 * 1000L);
}
/****************** ObCheckTabletDataComplementOp *************/
int ObCheckTabletDataComplementOp::check_task_inner_sql_session_status(

View File

@ -305,6 +305,8 @@ public:
const uint64_t table_id,
share::schema::ObSchemaGetterGuard &schema_guard);
static int64_t get_ddl_rpc_timeout();
private:
static int generate_column_name_str(
const common::ObIArray<ObColumnNameInfo> &column_names,