[FEAT MERGE] merge transfer
Co-authored-by: wxhwang <wxhwang@126.com> Co-authored-by: godyangfight <godyangfight@gmail.com> Co-authored-by: Tyshawn <tuyunshan@gmail.com>
This commit is contained in:
@ -542,7 +542,7 @@ int ObFlushDagWarningsExecutor::execute(ObExecContext &ctx, ObFlushDagWarningsSt
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("get task exec ctx error", K(ret), KP(task_exec_ctx));
|
||||
} else {
|
||||
share::ObDagWarningHistoryManager::get_instance().clear();
|
||||
MTL(ObDagWarningHistoryManager *)->clear();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -2416,7 +2416,6 @@ int ObCheckpointSlogExecutor::execute(ObExecContext &ctx, ObCheckpointSlogStmt &
|
||||
obrpc::ObSrvRpcProxy *srv_rpc_proxy = NULL;
|
||||
const ObAddr server = stmt.server_;
|
||||
ObCheckpointSlogArg arg;
|
||||
const int64_t TIMEOUT = 60 * 1000 * 1000; // 60s
|
||||
arg.tenant_id_ = stmt.tenant_id_;
|
||||
|
||||
if (OB_ISNULL(task_exec_ctx = GET_TASK_EXECUTOR_CTX(ctx))) {
|
||||
@ -2425,7 +2424,7 @@ int ObCheckpointSlogExecutor::execute(ObExecContext &ctx, ObCheckpointSlogStmt &
|
||||
} else if (OB_ISNULL(srv_rpc_proxy = task_exec_ctx->get_srv_rpc())) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("get srv rpc proxy failed");
|
||||
} else if (OB_FAIL(srv_rpc_proxy->to(server).timeout(TIMEOUT).checkpoint_slog(arg))) {
|
||||
} else if (OB_FAIL(srv_rpc_proxy->to(server).timeout(THIS_WORKER.get_timeout_remain()).checkpoint_slog(arg))) {
|
||||
LOG_WARN("rpc proxy checkpoint slog failed", K(ret));
|
||||
}
|
||||
|
||||
@ -2434,6 +2433,39 @@ int ObCheckpointSlogExecutor::execute(ObExecContext &ctx, ObCheckpointSlogStmt &
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObCancelRestoreExecutor::execute(ObExecContext &ctx, ObCancelRestoreStmt &stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTaskExecutorCtx *task_exec_ctx = nullptr;
|
||||
obrpc::ObCommonRpcProxy *common_rpc_proxy = nullptr;
|
||||
ObSchemaGetterGuard guard;
|
||||
const ObTenantSchema *tenant_schema = nullptr;
|
||||
if (OB_ISNULL(task_exec_ctx = GET_TASK_EXECUTOR_CTX(ctx))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("task exec ctx must not be null", K(ret));
|
||||
} else if (OB_ISNULL(common_rpc_proxy = task_exec_ctx->get_common_rpc())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("common rpc proxy must not be null", K(ret));
|
||||
} else if (OB_FAIL(GSCHEMASERVICE.get_tenant_schema_guard(OB_SYS_TENANT_ID, guard))) {
|
||||
LOG_WARN("failed to get sys tenant schema guard", K(ret));
|
||||
} else if (OB_FAIL(guard.get_tenant_info(stmt.get_drop_tenant_arg().tenant_name_, tenant_schema))) {
|
||||
LOG_WARN("failed to get tenant info", K(ret), K(stmt));
|
||||
} else if (OB_ISNULL(tenant_schema)) {
|
||||
ret = OB_TENANT_NOT_EXIST;
|
||||
LOG_USER_ERROR(OB_TENANT_NOT_EXIST, stmt.get_drop_tenant_arg().tenant_name_.length(), stmt.get_drop_tenant_arg().tenant_name_.ptr());
|
||||
LOG_WARN("tenant not exist", KR(ret), K(stmt));
|
||||
} else if (!tenant_schema->is_restore()) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "Cancel tenant not in restore is");
|
||||
LOG_WARN("Cancel tenant not in restore is not allowed", K(ret), K(stmt.get_drop_tenant_arg()));
|
||||
} else if (OB_FAIL(common_rpc_proxy->drop_tenant(stmt.get_drop_tenant_arg()))) {
|
||||
LOG_WARN("rpc proxy drop tenant failed", K(ret));
|
||||
} else {
|
||||
LOG_INFO("[RESTORE]succeed to cancel restore tenant", K(stmt));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace sql
|
||||
} // end namespace oceanbase
|
||||
|
||||
@ -117,6 +117,7 @@ DEF_SIMPLE_EXECUTOR(ObDropDisk);
|
||||
|
||||
DEF_SIMPLE_EXECUTOR(ObArchiveLog);
|
||||
DEF_SIMPLE_EXECUTOR(ObBackupDatabase);
|
||||
DEF_SIMPLE_EXECUTOR(ObCancelRestore);
|
||||
DEF_SIMPLE_EXECUTOR(ObBackupManage);
|
||||
DEF_SIMPLE_EXECUTOR(ObBackupClean);
|
||||
DEF_SIMPLE_EXECUTOR(ObDeletePolicy);
|
||||
|
||||
@ -114,8 +114,6 @@ int ObAlterTablegroupExecutor::execute(ObExecContext &ctx, ObAlterTablegroupStmt
|
||||
const_cast<obrpc::ObAlterTablegroupArg&>(alter_tablegroup_arg).ddl_stmt_str_ = first_stmt;
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(check_alter_partition(ctx, stmt, alter_tablegroup_arg))) {
|
||||
LOG_WARN("check alter partition failed", K(ret));
|
||||
} else if (OB_ISNULL(task_exec_ctx = GET_TASK_EXECUTOR_CTX(ctx))) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("get task executor context failed");
|
||||
@ -129,75 +127,5 @@ int ObAlterTablegroupExecutor::execute(ObExecContext &ctx, ObAlterTablegroupStmt
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObAlterTablegroupExecutor::check_alter_partition(ObExecContext &ctx,
|
||||
ObAlterTablegroupStmt &stmt,
|
||||
const obrpc::ObAlterTablegroupArg &arg)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (arg.is_alter_partitions()) {
|
||||
const ObTablegroupSchema &tablegroup_schema = arg.alter_tablegroup_schema_;
|
||||
if (arg.alter_option_bitset_.has_member(obrpc::ObAlterTablegroupArg::ADD_PARTITION)
|
||||
|| arg.alter_option_bitset_.has_member(obrpc::ObAlterTablegroupArg::PARTITIONED_TABLE)
|
||||
|| arg.alter_option_bitset_.has_member(obrpc::ObAlterTablegroupArg::REORGANIZE_PARTITION)
|
||||
|| arg.alter_option_bitset_.has_member(obrpc::ObAlterTablegroupArg::SPLIT_PARTITION)) {
|
||||
ObPartition **partition_array = tablegroup_schema.get_part_array();
|
||||
int64_t real_part_num = tablegroup_schema.get_partition_num();
|
||||
const int64_t fun_expr_num = stmt.get_part_func_expr_num();
|
||||
if (arg.alter_option_bitset_.has_member(obrpc::ObAlterTablegroupArg::SPLIT_PARTITION)) {
|
||||
real_part_num = tablegroup_schema.get_part_option().get_part_num();
|
||||
}
|
||||
if (tablegroup_schema.is_range_part()) {
|
||||
ObSEArray<ObObj, 8> range_partition_obj;
|
||||
ObIArray<ObRawExpr *> &range_values_exprs = stmt.get_part_values_exprs();
|
||||
if (OB_ISNULL(partition_array)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("partition_array is NULL", K(ret));
|
||||
} else if (OB_FAIL(ObPartitionExecutorUtils::cast_range_expr_to_obj(
|
||||
ctx,
|
||||
range_values_exprs,
|
||||
fun_expr_num,
|
||||
stmt::T_ALTER_TABLEGROUP,
|
||||
false, //is_subpart
|
||||
real_part_num,
|
||||
partition_array,
|
||||
NULL,
|
||||
range_partition_obj))) {
|
||||
LOG_WARN("partition_array is NULL", K(ret));
|
||||
}
|
||||
} else if (tablegroup_schema.is_list_part()) {
|
||||
if (OB_ISNULL(partition_array)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("partition_array is NULL", K(ret));
|
||||
} else if (OB_FAIL(ObPartitionExecutorUtils::cast_list_expr_to_obj(ctx,
|
||||
stmt,
|
||||
false,
|
||||
partition_array,
|
||||
NULL))) {
|
||||
LOG_WARN("failed cast list to expr", K(ret));
|
||||
}
|
||||
} else if (!arg.alter_option_bitset_.has_member(obrpc::ObAlterTablegroupArg::PARTITIONED_TABLE)) {
|
||||
ret = OB_ERR_ONLY_ON_RANGE_LIST_PARTITION;
|
||||
LOG_WARN("unexpected partition type", K(ret),
|
||||
"partition type", tablegroup_schema.get_part_option().get_part_func_type());
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (arg.alter_option_bitset_.has_member(obrpc::ObAlterTablegroupArg::SPLIT_PARTITION)) {
|
||||
//由于split在不引起二义性的情况下,可以不指定high_value,part_num需要和实际range_value_expr对应
|
||||
//在解析完成后可以置为正确的partition_num
|
||||
const_cast<ObTablegroupSchema &>(tablegroup_schema).get_part_option().set_part_num(
|
||||
tablegroup_schema.get_partition_num());
|
||||
}
|
||||
} else if (arg.alter_option_bitset_.has_member(obrpc::ObAlterTablegroupArg::DROP_PARTITION)) {
|
||||
// do-nothing
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("no operation", K(arg), K(ret));
|
||||
}
|
||||
LOG_DEBUG("dump table schema", K(tablegroup_schema));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
|
||||
@ -56,9 +56,6 @@ public:
|
||||
virtual ~ObAlterTablegroupExecutor() {}
|
||||
int execute(ObExecContext &ctx, ObAlterTablegroupStmt &stmt);
|
||||
private:
|
||||
int check_alter_partition(ObExecContext &ctx,
|
||||
ObAlterTablegroupStmt &stmt,
|
||||
const obrpc::ObAlterTablegroupArg &arg);
|
||||
DISALLOW_COPY_AND_ASSIGN(ObAlterTablegroupExecutor);
|
||||
};
|
||||
|
||||
|
||||
@ -2498,10 +2498,13 @@ int ObTableScanOp::init_ddl_column_checksum()
|
||||
column_checksum_.set_allocator(&ctx_.get_allocator());
|
||||
col_need_reshape_.set_allocator(&ctx_.get_allocator());
|
||||
const ObSQLSessionInfo *session = nullptr;
|
||||
const ObIArray<ObColumnParam *> &cols = MY_CTDEF.scan_ctdef_.table_param_.get_read_info().get_columns();
|
||||
const ObIArray<ObColumnParam *> *cols = MY_CTDEF.scan_ctdef_.table_param_.get_read_info().get_columns();
|
||||
if (OB_ISNULL(session = ctx_.get_my_session())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid session", K(ret));
|
||||
} else if (OB_ISNULL(cols)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("col param array is unexpected null", K(ret),KP(cols));
|
||||
} else if (MY_SPEC.output_.count() != MY_SPEC.ddl_output_cids_.count()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid arguments", K(ret), K(MY_SPEC.output_), K(MY_CTDEF.scan_ctdef_.table_param_), K(MY_SPEC.ddl_output_cids_));
|
||||
@ -2518,8 +2521,8 @@ int ObTableScanOp::init_ddl_column_checksum()
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < MY_SPEC.ddl_output_cids_.count(); ++i) {
|
||||
bool found = false;
|
||||
bool need_reshape = false;
|
||||
for (int64_t j = 0; OB_SUCC(ret) && !found && j < cols.count(); ++j) {
|
||||
const ObColumnParam *col_param = cols.at(j);
|
||||
for (int64_t j = 0; OB_SUCC(ret) && !found && j < cols->count(); ++j) {
|
||||
const ObColumnParam *col_param = cols->at(j);
|
||||
if (OB_ISNULL(col_param)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid col param", K(ret));
|
||||
|
||||
Reference in New Issue
Block a user