diff --git a/src/rootserver/ddl_task/ob_column_redefinition_task.cpp b/src/rootserver/ddl_task/ob_column_redefinition_task.cpp index bfbe3bba27..c1ea366ba5 100644 --- a/src/rootserver/ddl_task/ob_column_redefinition_task.cpp +++ b/src/rootserver/ddl_task/ob_column_redefinition_task.cpp @@ -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) { diff --git a/src/rootserver/ddl_task/ob_constraint_task.cpp b/src/rootserver/ddl_task/ob_constraint_task.cpp index bf0813ab03..34ed9298ae 100644 --- a/src/rootserver/ddl_task/ob_constraint_task.cpp +++ b/src/rootserver/ddl_task/ob_constraint_task.cpp @@ -1076,14 +1076,15 @@ int ObConstraintTask::set_foreign_key_constraint_validated() ObSArray 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 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 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) { diff --git a/src/rootserver/ddl_task/ob_ddl_redefinition_task.cpp b/src/rootserver/ddl_task/ob_ddl_redefinition_task.cpp index 171df9713a..cb1e54c1bc 100644 --- a/src/rootserver/ddl_task/ob_ddl_redefinition_task.cpp +++ b/src/rootserver/ddl_task/ob_ddl_redefinition_task.cpp @@ -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 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> ls_to_tablet_map; diff --git a/src/rootserver/ddl_task/ob_ddl_single_replica_executor.cpp b/src/rootserver/ddl_task/ob_ddl_single_replica_executor.cpp index 40f18b978b..67f65e3c03 100644 --- a/src/rootserver/ddl_task/ob_ddl_single_replica_executor.cpp +++ b/src/rootserver/ddl_task/ob_ddl_single_replica_executor.cpp @@ -89,7 +89,7 @@ int ObDDLSingleReplicaExecutor::schedule_task() common::ObIArray &build_infos = partition_build_stat_; ObArray 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; diff --git a/src/rootserver/ddl_task/ob_ddl_task.cpp b/src/rootserver/ddl_task/ob_ddl_task.cpp index c9153f07f1..91049e321b 100644 --- a/src/rootserver/ddl_task/ob_ddl_task.cpp +++ b/src/rootserver/ddl_task/ob_ddl_task.cpp @@ -784,7 +784,7 @@ int group_tablets_leader_addr(const uint64_t tenant_id, const ObIArray &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 send_array; for (int64_t i = 0; OB_SUCC(ret) && i < stat_array_.count(); ++i) { PartitionColChecksumStat &item = stat_array_.at(i); diff --git a/src/rootserver/ddl_task/ob_drop_index_task.cpp b/src/rootserver/ddl_task/ob_drop_index_task.cpp index 002a9b1296..7b537c74e1 100644 --- a/src/rootserver/ddl_task/ob_drop_index_task.cpp +++ b/src/rootserver/ddl_task/ob_drop_index_task.cpp @@ -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_)); diff --git a/src/rootserver/ddl_task/ob_index_build_task.cpp b/src/rootserver/ddl_task/ob_index_build_task.cpp index 7838d9935d..3e67dac473 100644 --- a/src/rootserver/ddl_task/ob_index_build_task.cpp +++ b/src/rootserver/ddl_task/ob_index_build_task.cpp @@ -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_)); diff --git a/src/rootserver/ddl_task/ob_modify_autoinc_task.cpp b/src/rootserver/ddl_task/ob_modify_autoinc_task.cpp index 3bedd4ffa5..fd5a75cc76 100644 --- a/src/rootserver/ddl_task/ob_modify_autoinc_task.cpp +++ b/src/rootserver/ddl_task/ob_modify_autoinc_task.cpp @@ -457,7 +457,8 @@ int ObModifyAutoincTask::set_schema_available() } else { ObSArray 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)); } } diff --git a/src/rootserver/ddl_task/ob_table_redefinition_task.cpp b/src/rootserver/ddl_task/ob_table_redefinition_task.cpp index 942bb200a1..483c68b980 100644 --- a/src/rootserver/ddl_task/ob_table_redefinition_task.cpp +++ b/src/rootserver/ddl_task/ob_table_redefinition_task.cpp @@ -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) { diff --git a/src/share/ob_ddl_common.cpp b/src/share/ob_ddl_common.cpp index a3e188bce8..be56dea3da 100644 --- a/src/share/ob_ddl_common.cpp +++ b/src/share/ob_ddl_common.cpp @@ -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( diff --git a/src/share/ob_ddl_common.h b/src/share/ob_ddl_common.h index fb2425d452..bd16294a82 100644 --- a/src/share/ob_ddl_common.h +++ b/src/share/ob_ddl_common.h @@ -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 &column_names,