support switchover/failover verify empty shell
This commit is contained in:
@ -5696,7 +5696,8 @@ int ObUpdateTenantInfoCacheRes::assign(const ObUpdateTenantInfoCacheRes &other)
|
|||||||
int ObSwitchTenantArg::init(
|
int ObSwitchTenantArg::init(
|
||||||
const uint64_t exec_tenant_id,
|
const uint64_t exec_tenant_id,
|
||||||
const OpType op_type,
|
const OpType op_type,
|
||||||
const ObString &tenant_name)
|
const ObString &tenant_name,
|
||||||
|
const bool is_verify)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (OB_UNLIKELY(OB_INVALID_TENANT_ID == exec_tenant_id
|
if (OB_UNLIKELY(OB_INVALID_TENANT_ID == exec_tenant_id
|
||||||
@ -5707,6 +5708,7 @@ int ObSwitchTenantArg::init(
|
|||||||
exec_tenant_id_ = exec_tenant_id;
|
exec_tenant_id_ = exec_tenant_id;
|
||||||
op_type_ = op_type;
|
op_type_ = op_type;
|
||||||
tenant_name_ = tenant_name;
|
tenant_name_ = tenant_name;
|
||||||
|
is_verify_ = is_verify;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -5719,11 +5721,12 @@ int ObSwitchTenantArg::assign(const ObSwitchTenantArg &other)
|
|||||||
op_type_ = other.op_type_;
|
op_type_ = other.op_type_;
|
||||||
tenant_name_ = other.tenant_name_;
|
tenant_name_ = other.tenant_name_;
|
||||||
stmt_str_ = other.stmt_str_;
|
stmt_str_ = other.stmt_str_;
|
||||||
|
is_verify_ = other.is_verify_;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
OB_SERIALIZE_MEMBER(ObSwitchTenantArg, exec_tenant_id_, op_type_, tenant_name_, stmt_str_);
|
OB_SERIALIZE_MEMBER(ObSwitchTenantArg, exec_tenant_id_, op_type_, tenant_name_, stmt_str_, is_verify_);
|
||||||
|
|
||||||
int ObRecoverTenantArg::init(
|
int ObRecoverTenantArg::init(
|
||||||
const uint64_t exec_tenant_id,
|
const uint64_t exec_tenant_id,
|
||||||
|
|||||||
@ -6568,12 +6568,14 @@ public:
|
|||||||
ObSwitchTenantArg() : exec_tenant_id_(OB_INVALID_TENANT_ID),
|
ObSwitchTenantArg() : exec_tenant_id_(OB_INVALID_TENANT_ID),
|
||||||
op_type_(INVALID),
|
op_type_(INVALID),
|
||||||
tenant_name_(),
|
tenant_name_(),
|
||||||
stmt_str_() {}
|
stmt_str_(),
|
||||||
|
is_verify_(false) {}
|
||||||
~ObSwitchTenantArg() {}
|
~ObSwitchTenantArg() {}
|
||||||
int init(
|
int init(
|
||||||
const uint64_t exec_tenant_id,
|
const uint64_t exec_tenant_id,
|
||||||
const OpType op_type,
|
const OpType op_type,
|
||||||
const ObString &tenant_name);
|
const ObString &tenant_name,
|
||||||
|
const bool is_verify);
|
||||||
bool is_valid() const {
|
bool is_valid() const {
|
||||||
return OB_INVALID_TENANT_ID != exec_tenant_id_
|
return OB_INVALID_TENANT_ID != exec_tenant_id_
|
||||||
&& INVALID != op_type_;
|
&& INVALID != op_type_;
|
||||||
@ -6581,7 +6583,7 @@ public:
|
|||||||
int assign(const ObSwitchTenantArg &other);
|
int assign(const ObSwitchTenantArg &other);
|
||||||
void set_stmt_str(const ObString &stmt_str) { stmt_str_ = stmt_str; }
|
void set_stmt_str(const ObString &stmt_str) { stmt_str_ = stmt_str; }
|
||||||
|
|
||||||
TO_STRING_KV(K_(exec_tenant_id), K_(op_type), K_(stmt_str), K_(tenant_name));
|
TO_STRING_KV(K_(exec_tenant_id), K_(op_type), K_(stmt_str), K_(tenant_name), K_(is_verify));
|
||||||
|
|
||||||
const char *get_alter_type_str() const
|
const char *get_alter_type_str() const
|
||||||
{
|
{
|
||||||
@ -6613,6 +6615,7 @@ public:\
|
|||||||
Property_declare_var(OpType, op_type)
|
Property_declare_var(OpType, op_type)
|
||||||
Property_declare_var(ObString, tenant_name)
|
Property_declare_var(ObString, tenant_name)
|
||||||
Property_declare_var(ObString, stmt_str)
|
Property_declare_var(ObString, stmt_str)
|
||||||
|
Property_declare_var(bool, is_verify)
|
||||||
#undef Property_declare_var
|
#undef Property_declare_var
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1865,6 +1865,8 @@ int ObSwitchTenantExecutor::execute(ObExecContext &ctx, ObSwitchTenantStmt &stmt
|
|||||||
|
|
||||||
// TODO support specify ALL
|
// TODO support specify ALL
|
||||||
if (OB_FAIL(ret)) {
|
if (OB_FAIL(ret)) {
|
||||||
|
} else if (arg.get_is_verify()) {
|
||||||
|
//do nothing
|
||||||
} else if (OB_FAIL(OB_PRIMARY_STANDBY_SERVICE.switch_tenant(arg))) {
|
} else if (OB_FAIL(OB_PRIMARY_STANDBY_SERVICE.switch_tenant(arg))) {
|
||||||
LOG_WARN("failed to switch_tenant", KR(ret), K(arg));
|
LOG_WARN("failed to switch_tenant", KR(ret), K(arg));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1122,6 +1122,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
|
|||||||
{"variables", VARIABLES},
|
{"variables", VARIABLES},
|
||||||
{"variance", VARIANCE},
|
{"variance", VARIANCE},
|
||||||
{"verbose", VERBOSE},
|
{"verbose", VERBOSE},
|
||||||
|
{"verify", VERIFY},
|
||||||
{"version", VERSION},
|
{"version", VERSION},
|
||||||
{"materialized", MATERIALIZED},
|
{"materialized", MATERIALIZED},
|
||||||
{"virtual", VIRTUAL},
|
{"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> 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> method_opt method_list method extension
|
||||||
%type <node> opt_storage_name opt_calibration_list calibration_info_list
|
%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> recover_tenant_stmt recover_point_clause
|
||||||
%type <node> external_file_format_list external_file_format external_table_partition_option
|
%type <node> external_file_format_list external_file_format external_table_partition_option
|
||||||
%type <node> dynamic_sampling_hint
|
%type <node> dynamic_sampling_hint
|
||||||
@ -16943,10 +16943,10 @@ RELEASE SAVEPOINT var_name
|
|||||||
*===========================================================*/
|
*===========================================================*/
|
||||||
|
|
||||||
switchover_tenant_stmt:
|
switchover_tenant_stmt:
|
||||||
ALTER SYSTEM switchover_clause
|
ALTER SYSTEM switchover_clause opt_verify
|
||||||
{
|
{
|
||||||
(void)($2);
|
(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:
|
recover_tenant_stmt:
|
||||||
ALTER SYSTEM RECOVER STANDBY opt_tenant_name recover_point_clause
|
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>();
|
ObSwitchTenantStmt *stmt = create_stmt<ObSwitchTenantStmt>();
|
||||||
ObString tenant_name;
|
ObString tenant_name;
|
||||||
obrpc::ObSwitchTenantArg::OpType op_type = obrpc::ObSwitchTenantArg::OpType::INVALID;
|
obrpc::ObSwitchTenantArg::OpType op_type = obrpc::ObSwitchTenantArg::OpType::INVALID;
|
||||||
|
bool is_verify = false;
|
||||||
if (OB_UNLIKELY(T_SWITCHOVER != parse_tree.type_)) {
|
if (OB_UNLIKELY(T_SWITCHOVER != parse_tree.type_)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("invalid parse node, type is not T_SWITCHOVER", KR(ret), "type",
|
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)) {
|
} else if (OB_ISNULL(stmt)) {
|
||||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||||
LOG_WARN("create stmt fail", KR(ret));
|
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_)
|
||||||
|| OB_ISNULL(parse_tree.children_[0])) {
|
|| OB_ISNULL(parse_tree.children_[0])) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
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_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()),
|
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 {
|
} else {
|
||||||
stmt_ = stmt;
|
stmt_ = stmt;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user