support switchover/failover verify empty shell
This commit is contained in:
@ -1865,6 +1865,8 @@ int ObSwitchTenantExecutor::execute(ObExecContext &ctx, ObSwitchTenantStmt &stmt
|
||||
|
||||
// TODO support specify ALL
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (arg.get_is_verify()) {
|
||||
//do nothing
|
||||
} else if (OB_FAIL(OB_PRIMARY_STANDBY_SERVICE.switch_tenant(arg))) {
|
||||
LOG_WARN("failed to switch_tenant", KR(ret), K(arg));
|
||||
}
|
||||
|
||||
@ -1122,6 +1122,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
|
||||
{"variables", VARIABLES},
|
||||
{"variance", VARIANCE},
|
||||
{"verbose", VERBOSE},
|
||||
{"verify", VERIFY},
|
||||
{"version", VERSION},
|
||||
{"materialized", MATERIALIZED},
|
||||
{"virtual", VIRTUAL},
|
||||
|
||||
@ -502,7 +502,7 @@ END_P SET_VAR DELIMITER
|
||||
%type <node> get_diagnostics_stmt get_statement_diagnostics_stmt get_condition_diagnostics_stmt statement_information_item_list condition_information_item_list statement_information_item condition_information_item statement_information_item_name condition_information_item_name condition_arg
|
||||
%type <node> method_opt method_list method extension
|
||||
%type <node> opt_storage_name opt_calibration_list calibration_info_list
|
||||
%type <node> switchover_tenant_stmt switchover_clause
|
||||
%type <node> switchover_tenant_stmt switchover_clause opt_verify
|
||||
%type <node> recover_tenant_stmt recover_point_clause
|
||||
%type <node> external_file_format_list external_file_format external_table_partition_option
|
||||
%type <node> dynamic_sampling_hint
|
||||
@ -16943,10 +16943,10 @@ RELEASE SAVEPOINT var_name
|
||||
*===========================================================*/
|
||||
|
||||
switchover_tenant_stmt:
|
||||
ALTER SYSTEM switchover_clause
|
||||
ALTER SYSTEM switchover_clause opt_verify
|
||||
{
|
||||
(void)($2);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_SWITCHOVER, 1, $3);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_SWITCHOVER, 2, $3, $4);
|
||||
}
|
||||
;
|
||||
|
||||
@ -16965,6 +16965,14 @@ ACTIVATE STANDBY opt_tenant_name
|
||||
}
|
||||
;
|
||||
|
||||
opt_verify:
|
||||
VERIFY
|
||||
{
|
||||
malloc_terminal_node($$, result->malloc_pool_, T_VERIFY); }
|
||||
| /* EMPTY */
|
||||
{ $$ = NULL; }
|
||||
;
|
||||
|
||||
recover_tenant_stmt:
|
||||
ALTER SYSTEM RECOVER STANDBY opt_tenant_name recover_point_clause
|
||||
{
|
||||
|
||||
@ -45,6 +45,7 @@ int ObSwitchTenantResolver::resolve_switch_tenant(const ParseNode &parse_tree)
|
||||
ObSwitchTenantStmt *stmt = create_stmt<ObSwitchTenantStmt>();
|
||||
ObString tenant_name;
|
||||
obrpc::ObSwitchTenantArg::OpType op_type = obrpc::ObSwitchTenantArg::OpType::INVALID;
|
||||
bool is_verify = false;
|
||||
if (OB_UNLIKELY(T_SWITCHOVER != parse_tree.type_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse node, type is not T_SWITCHOVER", KR(ret), "type",
|
||||
@ -52,7 +53,7 @@ int ObSwitchTenantResolver::resolve_switch_tenant(const ParseNode &parse_tree)
|
||||
} else if (OB_ISNULL(stmt)) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("create stmt fail", KR(ret));
|
||||
} else if (1 != parse_tree.num_child_
|
||||
} else if (2 != parse_tree.num_child_
|
||||
|| OB_ISNULL(parse_tree.children_)
|
||||
|| OB_ISNULL(parse_tree.children_[0])) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
@ -89,10 +90,17 @@ int ObSwitchTenantResolver::resolve_switch_tenant(const ParseNode &parse_tree)
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_ISNULL(parse_tree.children_[1])) {
|
||||
// not verify
|
||||
} else if (T_VERIFY == parse_tree.children_[1]->type_) {
|
||||
is_verify = true;
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(stmt->get_arg().init(session_info_->get_effective_tenant_id(), op_type, tenant_name))) {
|
||||
if (OB_FAIL(stmt->get_arg().init(session_info_->get_effective_tenant_id(), op_type, tenant_name, is_verify))) {
|
||||
LOG_WARN("fail to init arg", KR(ret), K(stmt->get_arg()),
|
||||
K(session_info_->get_effective_tenant_id()), K(tenant_name), K(op_type));
|
||||
K(session_info_->get_effective_tenant_id()), K(tenant_name), K(op_type), K(is_verify));
|
||||
} else {
|
||||
stmt_ = stmt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user