patch back the flashback table/tenant/database/index(without flashback to scn)
This commit is contained in:
parent
a15a151dae
commit
ac82728867
1
.gitignore
vendored
1
.gitignore
vendored
@ -93,6 +93,7 @@ test/tmp
|
||||
test/var
|
||||
*.ccls-cache/
|
||||
.cproject
|
||||
.cache
|
||||
|
||||
##### Git Sub Module
|
||||
deps/logmessage
|
||||
|
@ -171,7 +171,6 @@ PCODE_DEF(OB_REACH_PARTITION_LIMIT, 0x24A)
|
||||
PCODE_DEF(OB_ALTER_CLUSTER_INFO, 0x24B)
|
||||
PCODE_DEF(OB_CHECK_MERGE_FINISH, 0x24C)
|
||||
PCODE_DEF(OB_CHECK_CLUSTER_VALID_TO_ADD, 0x24D)
|
||||
PCODE_DEF(OB_FLASHBACK_TABLE_TO_SCN, 0x24E)
|
||||
PCODE_DEF(OB_GET_STANDBY_CLUSTER_STATISTIC, 0x24F)
|
||||
|
||||
// Privilege relating pcode
|
||||
|
@ -254,7 +254,6 @@ void oceanbase::observer::init_srv_xlator_for_rootserver(ObSrvRpcXlator* xlator)
|
||||
RPC_PROCESSOR(rootserver::ObGetClusterStatsP, *gctx_.root_service_);
|
||||
|
||||
RPC_PROCESSOR(rootserver::ObCheckMergeFinishP, *gctx_.root_service_);
|
||||
RPC_PROCESSOR(rootserver::ObRpcFlashBackTableToScnP, *gctx_.root_service_);
|
||||
RPC_PROCESSOR(rootserver::ObCheckClusterValidToAddP, *gctx_.root_service_);
|
||||
|
||||
RPC_PROCESSOR(rootserver::ObRpcCreateRestorePointP, *gctx_.root_service_);
|
||||
|
@ -5096,14 +5096,6 @@ int ObRootService::flashback_table_from_recyclebin(const ObFlashBackTableFromRec
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObRootService::flashback_table_to_time_point(const obrpc::ObFlashBackTableToScnArg& arg)
|
||||
{
|
||||
int ret = OB_NOT_SUPPORTED;
|
||||
UNUSED(arg);
|
||||
LOG_INFO("receive flashback table arg", K(arg));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObRootService::purge_table(const ObPurgeTableArg& arg)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -977,7 +977,6 @@ public:
|
||||
int update_index_status(const obrpc::ObUpdateIndexStatusArg& arg);
|
||||
int purge_table(const obrpc::ObPurgeTableArg& arg);
|
||||
int flashback_table_from_recyclebin(const obrpc::ObFlashBackTableFromRecyclebinArg& arg);
|
||||
int flashback_table_to_time_point(const obrpc::ObFlashBackTableToScnArg& arg);
|
||||
int purge_database(const obrpc::ObPurgeDatabaseArg& arg);
|
||||
int flashback_database(const obrpc::ObFlashBackDatabaseArg& arg);
|
||||
int check_tenant_in_alter_locality(const uint64_t tenant_id, bool& in_alter_locality);
|
||||
|
@ -392,8 +392,6 @@ DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_FLASHBACK_TENANT, ObRpcFlashBackTenantP, f
|
||||
DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_PURGE_TENANT, ObRpcPurgeTenantP, purge_tenant(arg_));
|
||||
DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_PURGE_EXPIRE_RECYCLE_OBJECTS, ObRpcPurgeExpireRecycleObjectsP,
|
||||
purge_expire_recycle_objects(arg_, result_));
|
||||
DEFINE_RS_RPC_PROCESSOR(
|
||||
obrpc::OB_FLASHBACK_TABLE_TO_SCN, ObRpcFlashBackTableToScnP, flashback_table_to_time_point(arg_));
|
||||
DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_ROOT_SPLIT_PARTITION, ObRpcRootSplitPartitionP, root_split_partition(arg_));
|
||||
DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_ALTER_CLUSTER_ATTR_DDL, ObRpcAlterClusterAttrP, alter_cluster_attr(arg_));
|
||||
DEFINE_DDL_RS_RPC_PROCESSOR(
|
||||
|
@ -79,7 +79,6 @@ public:
|
||||
RPC_S(PRD create_table_like, obrpc::OB_CREATE_TABLE_LIKE, (ObCreateTableLikeArg));
|
||||
RPC_S(PRD flashback_table_from_recyclebin, obrpc::OB_FLASHBACK_TABLE_FROM_RECYCLEBIN,
|
||||
(ObFlashBackTableFromRecyclebinArg));
|
||||
RPC_S(PRD flashback_table_to_time_point, obrpc::OB_FLASHBACK_TABLE_TO_SCN, (ObFlashBackTableToScnArg));
|
||||
RPC_S(PRD purge_table, obrpc::OB_PURGE_TABLE, (ObPurgeTableArg));
|
||||
RPC_S(PRD flashback_database, obrpc::OB_FLASHBACK_DATABASE, (ObFlashBackDatabaseArg));
|
||||
RPC_S(PRD purge_database, obrpc::OB_PURGE_DATABASE, (ObPurgeDatabaseArg));
|
||||
|
@ -1883,26 +1883,6 @@ bool ObFlashBackTableFromRecyclebinArg::is_valid() const
|
||||
OB_SERIALIZE_MEMBER((ObFlashBackTableFromRecyclebinArg, ObDDLArg), tenant_id_, origin_table_name_, new_db_name_,
|
||||
new_table_name_, origin_db_name_);
|
||||
|
||||
bool ObFlashBackTableToScnArg::is_valid() const
|
||||
{
|
||||
int bret = true;
|
||||
if (OB_INVALID_ID == tenant_id_) {
|
||||
bret = false;
|
||||
LOG_WARN("tenant_id is invalid", K_(tenant_id));
|
||||
} else if (OB_INVALID_ID == time_point_) {
|
||||
bret = false;
|
||||
LOG_WARN("timepoint is invalid", K_(time_point));
|
||||
} else if (0 == tables_.count()) {
|
||||
bret = false;
|
||||
LOG_WARN("table is empty", K_(tables));
|
||||
} else if (-1 == query_end_time_) {
|
||||
bret = false;
|
||||
}
|
||||
return bret;
|
||||
}
|
||||
|
||||
OB_SERIALIZE_MEMBER(ObFlashBackTableToScnArg, tenant_id_, time_point_, tables_, query_end_time_);
|
||||
|
||||
bool ObFlashBackIndexArg::is_valid() const
|
||||
{
|
||||
int bret = true;
|
||||
|
@ -1995,22 +1995,6 @@ public:
|
||||
K_(origin_table_id));
|
||||
};
|
||||
|
||||
struct ObFlashBackTableToScnArg : public ObDDLArg {
|
||||
OB_UNIS_VERSION(1);
|
||||
|
||||
public:
|
||||
ObFlashBackTableToScnArg() : tenant_id_(common::OB_INVALID_ID), time_point_(-1), tables_(), query_end_time_(-1)
|
||||
{}
|
||||
bool is_valid() const;
|
||||
|
||||
uint64_t tenant_id_;
|
||||
int64_t time_point_;
|
||||
common::ObSArray<ObTableItem> tables_;
|
||||
int64_t query_end_time_;
|
||||
|
||||
TO_STRING_KV(K_(tenant_id), K_(time_point), K_(tables), K_(query_end_time));
|
||||
};
|
||||
|
||||
struct ObFlashBackIndexArg : public ObDDLArg {
|
||||
OB_UNIS_VERSION(1);
|
||||
|
||||
|
@ -949,6 +949,9 @@ ob_set_subtarget(ob_sql resolver
|
||||
resolver/ddl/ob_drop_tenant_stmt.cpp
|
||||
resolver/ddl/ob_explain_resolver.cpp
|
||||
resolver/ddl/ob_explain_stmt.cpp
|
||||
resolver/ddl/ob_flashback_resolver.cpp
|
||||
resolver/ddl/ob_flashback_resolver.h
|
||||
resolver/ddl/ob_flashback_stmt.h
|
||||
resolver/ddl/ob_lock_tenant_resolver.cpp
|
||||
resolver/ddl/ob_lock_tenant_stmt.cpp
|
||||
resolver/ddl/ob_modify_tenant_resolver.cpp
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "sql/resolver/ddl/ob_use_database_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_alter_database_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_drop_database_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_flashback_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_purge_stmt.h"
|
||||
#include "sql/engine/ob_exec_context.h"
|
||||
#include "sql/session/ob_sql_session_info.h"
|
||||
@ -228,6 +229,33 @@ int ObDropDatabaseExecutor::execute(ObExecContext& ctx, ObDropDatabaseStmt& stmt
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObFlashBackDatabaseExecutor::execute(ObExecContext &ctx, ObFlashBackDatabaseStmt &stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const obrpc::ObFlashBackDatabaseArg &flashback_database_arg = stmt.get_flashback_database_arg();
|
||||
ObTaskExecutorCtx *task_exec_ctx = NULL;
|
||||
obrpc::ObCommonRpcProxy *common_rpc_proxy = NULL;
|
||||
ObString first_stmt;
|
||||
if (OB_FAIL(stmt.get_first_stmt(first_stmt))) {
|
||||
SQL_ENG_LOG(WARN, "fail to get first stmt" , K(ret));
|
||||
} else {
|
||||
const_cast<obrpc::ObFlashBackDatabaseArg&>(flashback_database_arg).ddl_stmt_str_ = first_stmt;
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_ISNULL(task_exec_ctx = GET_TASK_EXECUTOR_CTX(ctx))) {
|
||||
ret = OB_NOT_INIT;
|
||||
SQL_ENG_LOG(WARN, "get task executor context failed");
|
||||
} else if (OB_FAIL(task_exec_ctx->get_common_rpc(common_rpc_proxy))) {
|
||||
SQL_ENG_LOG(WARN, "get common rpc proxy failed", K(ret));
|
||||
} else if (OB_ISNULL(common_rpc_proxy)){
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SQL_ENG_LOG(WARN, "common rpc proxy should not be null", K(ret));
|
||||
} else if (OB_FAIL(common_rpc_proxy->flashback_database(flashback_database_arg))) {
|
||||
SQL_ENG_LOG(WARN, "rpc proxy flashback database failed", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObPurgeDatabaseExecutor::execute(ObExecContext& ctx, ObPurgeDatabaseStmt& stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "sql/resolver/ob_resolver_utils.h"
|
||||
#include "sql/engine/ob_exec_context.h"
|
||||
#include "sql/engine/cmd/ob_partition_executor_utils.h"
|
||||
#include "sql/resolver/ddl/ob_flashback_stmt.h"
|
||||
#include "observer/ob_server.h"
|
||||
|
||||
using namespace oceanbase::common;
|
||||
@ -342,6 +343,32 @@ int ObDropIndexExecutor::execute(ObExecContext& ctx, ObDropIndexStmt& stmt)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObFlashBackIndexExecutor::execute(ObExecContext &ctx, ObFlashBackIndexStmt &stmt) {
|
||||
int ret = OB_SUCCESS;
|
||||
ObTaskExecutorCtx *task_exec_ctx = NULL;
|
||||
obrpc::ObCommonRpcProxy *common_rpc_proxy = NULL;
|
||||
const obrpc::ObFlashBackIndexArg &flashback_index_arg = stmt.get_flashback_index_arg();
|
||||
ObString first_stmt;
|
||||
if (OB_FAIL(stmt.get_first_stmt(first_stmt))) {
|
||||
LOG_WARN("fail to get first stmt" , K(ret));
|
||||
} else {
|
||||
const_cast<obrpc::ObFlashBackIndexArg&>(flashback_index_arg).ddl_stmt_str_ = first_stmt;
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_ISNULL(task_exec_ctx = GET_TASK_EXECUTOR_CTX(ctx))) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("get task executor context failed");
|
||||
} else if (OB_FAIL(task_exec_ctx->get_common_rpc(common_rpc_proxy))) {
|
||||
LOG_WARN("get common rpc proxy failed", K(ret));
|
||||
} else if (OB_ISNULL(common_rpc_proxy)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("common rpc proxy should not be null", K(ret));
|
||||
} else if (OB_FAIL(common_rpc_proxy->flashback_index(flashback_index_arg))) {
|
||||
LOG_WARN("rpc proxy flashback index failed", "dst", common_rpc_proxy->get_server(), K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObPurgeIndexExecutor::execute(ObExecContext& ctx, ObPurgeIndexStmt& stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "sql/resolver/ddl/ob_rename_table_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_truncate_table_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_create_table_like_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_flashback_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_purge_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_optimize_stmt.h"
|
||||
#include "sql/resolver/ob_resolver_utils.h"
|
||||
@ -2064,6 +2065,32 @@ int ObCreateTableLikeExecutor::execute(ObExecContext& ctx, ObCreateTableLikeStmt
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObFlashBackTableFromRecyclebinExecutor::execute(ObExecContext &ctx, ObFlashBackTableFromRecyclebinStmt &stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const obrpc::ObFlashBackTableFromRecyclebinArg &flashback_table_arg = stmt.get_flashback_table_arg();
|
||||
ObString first_stmt;
|
||||
if (OB_FAIL(stmt.get_first_stmt(first_stmt))) {
|
||||
LOG_WARN("get first statement failed", K(ret));
|
||||
} else {
|
||||
const_cast<obrpc::ObFlashBackTableFromRecyclebinArg&>(flashback_table_arg).ddl_stmt_str_ = first_stmt;
|
||||
ObTaskExecutorCtx *task_exec_ctx = NULL;
|
||||
obrpc::ObCommonRpcProxy *common_rpc_proxy = NULL;
|
||||
if (OB_ISNULL(task_exec_ctx = GET_TASK_EXECUTOR_CTX(ctx))) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("get task executor context failed");
|
||||
} else if (OB_FAIL(task_exec_ctx->get_common_rpc(common_rpc_proxy))) {
|
||||
LOG_WARN("get common rpc proxy failed", K(ret));
|
||||
} else if (OB_ISNULL(common_rpc_proxy)){
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("common rpc proxy should not be null", K(ret));
|
||||
} else if (OB_FAIL(common_rpc_proxy->flashback_table_from_recyclebin(flashback_table_arg))) {
|
||||
LOG_WARN("rpc proxy flashback table failed", K(ret));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObPurgeTableExecutor::execute(ObExecContext& ctx, ObPurgeTableStmt& stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -255,18 +255,6 @@ public:
|
||||
private:
|
||||
};
|
||||
|
||||
class ObFlashBackTableToScnStmt;
|
||||
class ObFlashBackTableToScnExecutor {
|
||||
public:
|
||||
ObFlashBackTableToScnExecutor()
|
||||
{}
|
||||
virtual ~ObFlashBackTableToScnExecutor()
|
||||
{}
|
||||
int execute(ObExecContext& ctx, ObFlashBackTableToScnStmt& stmt);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class ObPurgeTableStmt;
|
||||
class ObPurgeTableExecutor {
|
||||
public:
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "sql/resolver/ddl/ob_drop_tenant_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_lock_tenant_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_modify_tenant_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_flashback_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_purge_stmt.h"
|
||||
#include "sql/engine/ob_exec_context.h"
|
||||
#include "sql/engine/cmd/ob_variable_set_executor.h"
|
||||
@ -502,6 +503,33 @@ int ObDropTenantExecutor::execute(ObExecContext& ctx, ObDropTenantStmt& stmt)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObFlashBackTenantExecutor::execute(ObExecContext &ctx, ObFlashBackTenantStmt &stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const obrpc::ObFlashBackTenantArg &flashback_tenant_arg = stmt.get_flashback_tenant_arg();
|
||||
ObTaskExecutorCtx *task_exec_ctx = NULL;
|
||||
obrpc::ObCommonRpcProxy *common_rpc_proxy = NULL;
|
||||
ObString first_stmt;
|
||||
if (OB_FAIL(stmt.get_first_stmt(first_stmt))) {
|
||||
SQL_ENG_LOG(WARN, "fail to get first stmt" , K(ret));
|
||||
} else {
|
||||
const_cast<obrpc::ObFlashBackTenantArg&>(flashback_tenant_arg).ddl_stmt_str_ = first_stmt;
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_ISNULL(task_exec_ctx = GET_TASK_EXECUTOR_CTX(ctx))) {
|
||||
ret = OB_NOT_INIT;
|
||||
SQL_ENG_LOG(WARN, "get task executor context failed");
|
||||
} else if (OB_FAIL(task_exec_ctx->get_common_rpc(common_rpc_proxy))) {
|
||||
SQL_ENG_LOG(WARN, "get common rpc proxy failed", K(ret));
|
||||
} else if (OB_ISNULL(common_rpc_proxy)){
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SQL_ENG_LOG(WARN, "common rpc proxy should not be null", K(ret));
|
||||
} else if (OB_FAIL(common_rpc_proxy->flashback_tenant(flashback_tenant_arg))) {
|
||||
SQL_ENG_LOG(WARN, "rpc proxy flashback tenant failed", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObPurgeTenantExecutor::execute(ObExecContext& ctx, ObPurgeTenantStmt& stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "sql/resolver/ddl/ob_rename_table_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_truncate_table_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_create_table_like_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_flashback_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_purge_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_alter_baseline_stmt.h"
|
||||
#include "sql/resolver/dcl/ob_create_user_stmt.h"
|
||||
@ -309,6 +310,22 @@ int ObCmdExecutor::execute(ObExecContext& ctx, ObICmd& cmd)
|
||||
DEFINE_EXECUTE_CMD(ObCreateTableLikeStmt, ObCreateTableLikeExecutor);
|
||||
break;
|
||||
}
|
||||
case stmt::T_FLASHBACK_TABLE_FROM_RECYCLEBIN: {
|
||||
DEFINE_EXECUTE_CMD(ObFlashBackTableFromRecyclebinStmt, ObFlashBackTableFromRecyclebinExecutor);
|
||||
break;
|
||||
}
|
||||
case stmt::T_FLASHBACK_INDEX: {
|
||||
DEFINE_EXECUTE_CMD(ObFlashBackIndexStmt, ObFlashBackIndexExecutor);
|
||||
break;
|
||||
}
|
||||
case stmt::T_FLASHBACK_DATABASE: {
|
||||
DEFINE_EXECUTE_CMD(ObFlashBackDatabaseStmt, ObFlashBackDatabaseExecutor);
|
||||
break;
|
||||
}
|
||||
case stmt::T_FLASHBACK_TENANT: {
|
||||
DEFINE_EXECUTE_CMD(ObFlashBackTenantStmt, ObFlashBackTenantExecutor);
|
||||
break;
|
||||
}
|
||||
case stmt::T_PURGE_TABLE: {
|
||||
DEFINE_EXECUTE_CMD(ObPurgeTableStmt, ObPurgeTableExecutor);
|
||||
break;
|
||||
|
@ -189,6 +189,7 @@ static const NonReservedKeyword Mysql_none_reserved_keywords[] = {
|
||||
{"first", FIRST},
|
||||
{"first_value", FIRST_VALUE},
|
||||
{"fixed", FIXED},
|
||||
{"flashback", FLASHBACK},
|
||||
{"flush", FLUSH},
|
||||
{"follower", FOLLOWER},
|
||||
{"format", FORMAT},
|
||||
|
@ -406,7 +406,7 @@ END_P SET_VAR DELIMITER
|
||||
%type <node> create_tablegroup_stmt drop_tablegroup_stmt alter_tablegroup_stmt default_tablegroup
|
||||
%type <node> set_transaction_stmt transaction_characteristics transaction_access_mode isolation_level
|
||||
%type <node> lock_tables_stmt unlock_tables_stmt lock_type lock_table_list lock_table opt_local
|
||||
%type <node> purge_stmt
|
||||
%type <node> flashback_stmt purge_stmt opt_flashback_rename_table opt_flashback_rename_database opt_flashback_rename_tenant
|
||||
%type <node> tenant_name_list opt_tenant_list tenant_list_tuple cache_type flush_scope opt_zone_list
|
||||
%type <node> into_opt into_clause field_opt field_term field_term_list line_opt line_term line_term_list into_var_list into_var
|
||||
%type <node> string_list text_string string_val_list
|
||||
@ -534,6 +534,7 @@ stmt:
|
||||
{ $$ = $1; check_question_mark($$, result); $$->value_ = 1; }
|
||||
| unlock_tables_stmt
|
||||
{ $$ = $1; check_question_mark($$, result); $$->value_ = 1; }
|
||||
| flashback_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
| purge_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
| load_data_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
| xa_begin_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
@ -11269,6 +11270,43 @@ SET DEFAULT signed_literal
|
||||
* RECYCLE grammar
|
||||
*
|
||||
*****************************************************************************/
|
||||
flashback_stmt:
|
||||
FLASHBACK TABLE relation_factor TO BEFORE DROP opt_flashback_rename_table
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_FLASHBACK_TABLE_FROM_RECYCLEBIN, 2, $3, $7);
|
||||
}
|
||||
|
|
||||
FLASHBACK database_key database_factor TO BEFORE DROP opt_flashback_rename_database
|
||||
{
|
||||
(void)($2);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_FLASHBACK_DATABASE, 2, $3, $7);
|
||||
}
|
||||
|
|
||||
FLASHBACK TENANT relation_name TO BEFORE DROP opt_flashback_rename_tenant
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_FLASHBACK_TENANT, 2, $3, $7);
|
||||
}
|
||||
|
||||
opt_flashback_rename_table:
|
||||
RENAME TO relation_factor
|
||||
{
|
||||
$$ = $3;
|
||||
}
|
||||
| /*EMPTY*/ { $$ = NULL; }
|
||||
|
||||
opt_flashback_rename_database:
|
||||
RENAME TO database_factor
|
||||
{
|
||||
$$ = $3;
|
||||
}
|
||||
| /*EMPTY*/ { $$ = NULL; }
|
||||
|
||||
opt_flashback_rename_tenant:
|
||||
RENAME TO relation_name
|
||||
{
|
||||
$$ = $3;
|
||||
}
|
||||
| /*EMPTY*/ { $$ = NULL; }
|
||||
|
||||
purge_stmt:
|
||||
PURGE TABLE relation_factor
|
||||
|
@ -1776,6 +1776,10 @@ int ObOraSysChecker::check_ora_ddl_priv(ObSchemaGetterGuard& guard, const uint64
|
||||
DEFINE_DROP_CHECK_CMD(PRIV_ID_DROP_ANY_TYPE);
|
||||
break;
|
||||
}
|
||||
case stmt::T_FLASHBACK_TABLE_FROM_RECYCLEBIN: {
|
||||
DEFINE_DROP_CHECK_CMD(PRIV_ID_DROP_ANY_TABLE);
|
||||
break;
|
||||
}
|
||||
case stmt::T_PURGE_TABLE: {
|
||||
DEFINE_DROP_CHECK_CMD(PRIV_ID_DROP_ANY_TABLE);
|
||||
break;
|
||||
@ -1814,7 +1818,7 @@ int ObOraSysChecker::check_ora_ddl_priv(ObSchemaGetterGuard& guard, const uint64
|
||||
}
|
||||
case stmt::T_CREATE_RESTORE_POINT:
|
||||
case stmt::T_DROP_RESTORE_POINT: {
|
||||
DEFINE_PUB_CHECK_CMD(PRIV_ID_SELECT_ANY_DICTIONARY);
|
||||
DEFINE_PURGE_CHECK_CMD(PRIV_ID_FLASHBACK_ANY_TABLE, PRIV_ID_SELECT_ANY_DICTIONARY);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
@ -1578,6 +1578,29 @@ int get_alter_tablegroup_stmt_need_privs(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get_flashback_table_stmt_need_privs(
|
||||
const ObSessionPrivInfo &session_priv,
|
||||
const ObStmt *basic_stmt,
|
||||
ObIArray<ObNeedPriv> &need_privs)
|
||||
{
|
||||
UNUSED(session_priv);
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(basic_stmt)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("Basic stmt should be not be NULL", K(ret));
|
||||
} else if (stmt::T_FLASHBACK_TABLE_FROM_RECYCLEBIN != basic_stmt->get_stmt_type()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("Stmt type should be T_FLASHBACK_TABLE",
|
||||
K(ret), "stmt type", basic_stmt->get_stmt_type());
|
||||
} else {
|
||||
ObNeedPriv need_priv;
|
||||
need_priv.priv_set_ = OB_PRIV_SUPER;
|
||||
need_priv.priv_level_ = OB_PRIV_USER_LEVEL;
|
||||
ADD_NEED_PRIV(need_priv);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get_purge_recyclebin_stmt_need_privs(
|
||||
const ObSessionPrivInfo& session_priv, const ObStmt* basic_stmt, ObIArray<ObNeedPriv>& need_privs)
|
||||
{
|
||||
@ -1598,6 +1621,52 @@ int get_purge_recyclebin_stmt_need_privs(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get_flashback_index_stmt_need_privs(
|
||||
const ObSessionPrivInfo &session_priv,
|
||||
const ObStmt *basic_stmt,
|
||||
ObIArray<ObNeedPriv> &need_privs)
|
||||
{
|
||||
UNUSED(session_priv);
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(basic_stmt)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("Basic stmt should not be NULL", K(ret));
|
||||
} else if (OB_UNLIKELY(stmt::T_FLASHBACK_INDEX != basic_stmt->get_stmt_type())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("Stmt type should be T_FLASHBACK_TABLE",
|
||||
K(ret), "stmt type", basic_stmt->get_stmt_type());
|
||||
} else {
|
||||
ObNeedPriv need_priv;
|
||||
need_priv.priv_set_ = OB_PRIV_SUPER;
|
||||
need_priv.priv_level_ = OB_PRIV_USER_LEVEL;
|
||||
ADD_NEED_PRIV(need_priv);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get_flashback_database_stmt_need_privs(
|
||||
const ObSessionPrivInfo &session_priv,
|
||||
const ObStmt *basic_stmt,
|
||||
ObIArray<ObNeedPriv> &need_privs)
|
||||
{
|
||||
UNUSED(session_priv);
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(basic_stmt)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("Basic stmt should be not be NULL", K(ret));
|
||||
} else if (OB_UNLIKELY(stmt::T_FLASHBACK_DATABASE != basic_stmt->get_stmt_type())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("Stmt type should be T_FLASHBACK_DATABASE",
|
||||
K(ret), "stmt type", basic_stmt->get_stmt_type());
|
||||
} else {
|
||||
ObNeedPriv need_priv;
|
||||
need_priv.priv_set_ = OB_PRIV_SUPER;
|
||||
need_priv.priv_level_ = OB_PRIV_USER_LEVEL;
|
||||
ADD_NEED_PRIV(need_priv);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get_purge_table_stmt_need_privs(
|
||||
const ObSessionPrivInfo& session_priv, const ObStmt* stmt, ObIArray<ObNeedPriv>& need_privs)
|
||||
{
|
||||
@ -1658,6 +1727,34 @@ int get_purge_database_stmt_need_privs(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get_flashback_tenant_stmt_need_privs(
|
||||
const ObSessionPrivInfo &session_priv,
|
||||
const ObStmt *basic_stmt,
|
||||
ObIArray<ObNeedPriv> &need_privs)
|
||||
{
|
||||
UNUSED(session_priv);
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(basic_stmt)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("Basic stmt should be not be NULL", K(ret));
|
||||
} else if (OB_UNLIKELY(stmt::T_FLASHBACK_TENANT != basic_stmt->get_stmt_type())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("Stmt type should be T_FLASHBACK_TENANT",
|
||||
K(ret), "stmt type", basic_stmt->get_stmt_type());
|
||||
} else {
|
||||
ObNeedPriv need_priv;
|
||||
if (OB_SYS_TENANT_ID != session_priv.tenant_id_) {
|
||||
ret = OB_ERR_NO_PRIVILEGE;
|
||||
LOG_WARN("Only sys tenant can do this operation", K(ret));
|
||||
} else {
|
||||
need_priv.priv_set_ = OB_PRIV_SUPER;
|
||||
need_priv.priv_level_ = OB_PRIV_USER_LEVEL;
|
||||
ADD_NEED_PRIV(need_priv);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get_purge_tenant_stmt_need_privs(
|
||||
const ObSessionPrivInfo& session_priv, const ObStmt* stmt, ObIArray<ObNeedPriv>& need_privs)
|
||||
{
|
||||
|
315
src/sql/resolver/ddl/ob_flashback_resolver.cpp
Normal file
315
src/sql/resolver/ddl/ob_flashback_resolver.cpp
Normal file
@ -0,0 +1,315 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#define USING_LOG_PREFIX SQL_RESV
|
||||
#include "share/ob_define.h"
|
||||
#include "sql/resolver/ddl/ob_flashback_resolver.h"
|
||||
#include "sql/resolver/ob_schema_checker.h"
|
||||
#include "sql/session/ob_sql_session_info.h"
|
||||
#include "rootserver/ob_ddl_service.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace common;
|
||||
|
||||
namespace sql
|
||||
{
|
||||
/**
|
||||
* flashback table
|
||||
*/
|
||||
int ObFlashBackTableFromRecyclebinResolver::resolve(const ParseNode &parser_tree)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObFlashBackTableFromRecyclebinStmt *flashback_table_from_recyclebin_stmt = NULL;
|
||||
if (OB_ISNULL(session_info_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("session_info is null", K(ret));
|
||||
} else if (T_FLASHBACK_TABLE_FROM_RECYCLEBIN != parser_tree.type_) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse tree", K(parser_tree.type_));
|
||||
}
|
||||
//create flashback table stmt
|
||||
if (OB_SUCC(ret)) {
|
||||
if (NULL == (flashback_table_from_recyclebin_stmt = create_stmt<ObFlashBackTableFromRecyclebinStmt>())) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_ERROR("failed to create rename table stmt", K(ret));
|
||||
} else {
|
||||
stmt_ = flashback_table_from_recyclebin_stmt;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
flashback_table_from_recyclebin_stmt->set_tenant_id(session_info_->get_effective_tenant_id());
|
||||
//flashback table
|
||||
ParseNode *table_node = parser_tree.children_[ORIGIN_TABLE_NODE];
|
||||
ObString origin_table_name;
|
||||
ObString origin_db_name;
|
||||
if (OB_ISNULL(table_node)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table_node should not be null", K(ret));
|
||||
} else if (OB_FAIL(resolve_table_relation_node(table_node,
|
||||
origin_table_name,
|
||||
origin_db_name,
|
||||
true /*get origin db_name*/))) {
|
||||
LOG_WARN("failed to resolve_table_relation_node", K(ret));
|
||||
} else {
|
||||
OX (flashback_table_from_recyclebin_stmt->set_origin_table_name(origin_table_name));
|
||||
OX (flashback_table_from_recyclebin_stmt->set_origin_table_id(OB_INVALID_ID));
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
//rename to new table_name
|
||||
ParseNode *rename_node = parser_tree.children_[NEW_TABLE_NODE];
|
||||
if (NULL != rename_node) {
|
||||
ObString new_table_name;
|
||||
ObString new_db_name;
|
||||
if (OB_FAIL(resolve_table_relation_node(rename_node,
|
||||
new_table_name,
|
||||
new_db_name))) {
|
||||
LOG_WARN("failed to resolve_table_relation_node", K(ret));
|
||||
} else if (ObString(OB_RECYCLEBIN_SCHEMA_NAME) == new_db_name
|
||||
|| ObString(OB_PUBLIC_SCHEMA_NAME) == new_db_name) {
|
||||
ret = OB_OP_NOT_ALLOW;
|
||||
LOG_WARN("can't not flashback table to recyclebin database", K(ret));
|
||||
} else {
|
||||
flashback_table_from_recyclebin_stmt->set_new_db_name(new_db_name);
|
||||
flashback_table_from_recyclebin_stmt->set_new_table_name(new_table_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// flashback table with origin table name from recyclebin is supported now
|
||||
// reuse the unused origin_db_name to specify the database which the table was drop from
|
||||
if (OB_SUCC(ret)) {
|
||||
if (origin_db_name.empty()) {
|
||||
if (OB_ISNULL(session_info_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("session_info_ is null", K(ret));
|
||||
} else {
|
||||
flashback_table_from_recyclebin_stmt->set_origin_db_name(
|
||||
session_info_->get_database_name());
|
||||
}
|
||||
} else {
|
||||
flashback_table_from_recyclebin_stmt->set_origin_db_name(origin_db_name);
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && ObSchemaChecker::is_ora_priv_check()) {
|
||||
OZ (schema_checker_->check_ora_ddl_priv(
|
||||
session_info_->get_effective_tenant_id(),
|
||||
session_info_->get_priv_user_id(),
|
||||
origin_db_name,
|
||||
stmt::T_FLASHBACK_TABLE_FROM_RECYCLEBIN,
|
||||
session_info_->get_enable_role_array()));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* flashback index
|
||||
*/
|
||||
int ObFlashBackIndexResolver::resolve(const ParseNode &parser_tree)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObFlashBackIndexStmt *flashback_index_stmt = NULL;
|
||||
if (OB_ISNULL(session_info_) || OB_ISNULL(schema_checker_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("session_info or schema_checker is null", K(ret), K(schema_checker_), K(session_info_));
|
||||
} else if (T_FLASHBACK_INDEX != parser_tree.type_) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse tree", K(parser_tree.type_));
|
||||
}
|
||||
//create flashback index stmt
|
||||
if (OB_SUCC(ret)) {
|
||||
if (NULL == (flashback_index_stmt = create_stmt<ObFlashBackIndexStmt>())) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_ERROR("failed to create rename index stmt", K(ret));
|
||||
} else {
|
||||
stmt_ = flashback_index_stmt;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
flashback_index_stmt->set_tenant_id(session_info_->get_effective_tenant_id());
|
||||
//flashback table
|
||||
ParseNode *table_node = parser_tree.children_[ORIGIN_TABLE_NODE];
|
||||
ObString origin_table_name;
|
||||
ObString origin_db_name;
|
||||
const share::schema::ObTableSchema *table_schema = NULL;
|
||||
if (OB_ISNULL(table_node)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table_node should not be null", K(ret));
|
||||
} else if (OB_FAIL(resolve_table_relation_node(table_node,
|
||||
origin_table_name,
|
||||
origin_db_name,
|
||||
true /*get origin db_name*/))) {
|
||||
LOG_WARN("failed to resolve_table_relation_node", K(ret));
|
||||
} else if (!origin_db_name.empty() && origin_db_name != OB_RECYCLEBIN_SCHEMA_NAME) {
|
||||
ret = OB_TABLE_NOT_EXIST;
|
||||
LOG_USER_ERROR(OB_TABLE_NOT_EXIST, to_cstring(origin_db_name), to_cstring(origin_table_name));
|
||||
LOG_WARN("flashback index db.xx should not specified with db name", K(ret));
|
||||
} else {
|
||||
UNUSED(schema_checker_->get_table_schema(flashback_index_stmt->get_tenant_id(),
|
||||
combine_id(flashback_index_stmt->get_tenant_id(), OB_RECYCLEBIN_SCHEMA_ID),
|
||||
origin_table_name,
|
||||
true, /*is_index*/
|
||||
false, /*cte_table_fisrt*/
|
||||
table_schema));
|
||||
flashback_index_stmt->set_origin_table_name(origin_table_name);
|
||||
flashback_index_stmt->set_origin_table_id(OB_NOT_NULL(table_schema) ? table_schema->get_table_id() : OB_INVALID_ID);
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
//rename to new table_name
|
||||
ParseNode *rename_node = parser_tree.children_[NEW_TABLE_NODE];
|
||||
if (NULL != rename_node) {
|
||||
ObString new_index_name;
|
||||
new_index_name.assign_ptr(rename_node->str_value_, static_cast<int32_t>(rename_node->str_len_));
|
||||
flashback_index_stmt->set_new_table_name(new_index_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* flashback database
|
||||
*/
|
||||
int ObFlashBackDatabaseResolver::resolve(const ParseNode &parser_tree)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObFlashBackDatabaseStmt *flashback_database_stmt = NULL;
|
||||
/**
|
||||
* the length of database name should less than 127 bytes because of compatibility
|
||||
*/
|
||||
int32_t max_database_name_length = GET_MIN_CLUSTER_VERSION() < CLUSTER_CURRENT_VERSION ?
|
||||
OB_MAX_DATABASE_NAME_LENGTH - 1 : OB_MAX_DATABASE_NAME_LENGTH;
|
||||
if (OB_ISNULL(session_info_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("session_info is null", K(ret));
|
||||
} else if (T_FLASHBACK_DATABASE != parser_tree.type_) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse tree", K(parser_tree.type_));
|
||||
}
|
||||
//create flashback table stmt
|
||||
if (OB_SUCC(ret)) {
|
||||
if (NULL == (flashback_database_stmt = create_stmt<ObFlashBackDatabaseStmt>())) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_ERROR("failed to create rename table stmt", K(ret));
|
||||
} else {
|
||||
stmt_ = flashback_database_stmt;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
flashback_database_stmt->set_tenant_id(session_info_->get_effective_tenant_id());
|
||||
ObString origin_db_name;
|
||||
ParseNode *origin_dbname_node = parser_tree.children_[ORIGIN_DB_NODE];
|
||||
if (OB_ISNULL(origin_dbname_node) || OB_UNLIKELY(T_IDENT != origin_dbname_node->type_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse tree", K(ret));
|
||||
} else if (OB_UNLIKELY(
|
||||
static_cast<int32_t>(origin_dbname_node->str_len_) > max_database_name_length)) {
|
||||
ret = OB_ERR_TOO_LONG_IDENT;
|
||||
LOG_USER_ERROR(OB_ERR_TOO_LONG_IDENT, (int)origin_dbname_node->str_len_, origin_dbname_node->str_value_);
|
||||
} else {
|
||||
origin_db_name.assign_ptr(origin_dbname_node->str_value_,
|
||||
static_cast<int32_t>(origin_dbname_node->str_len_));
|
||||
flashback_database_stmt->set_origin_db_name(origin_db_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ParseNode *new_db_node = parser_tree.children_[NEW_DB_NODE];
|
||||
if (NULL != new_db_node) {
|
||||
ObString new_db_name;
|
||||
if (OB_UNLIKELY(T_IDENT != new_db_node->type_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse tree", K(ret));
|
||||
} else if (OB_UNLIKELY(
|
||||
static_cast<int32_t>(new_db_node->str_len_) > max_database_name_length)) {
|
||||
ret = OB_ERR_TOO_LONG_IDENT;
|
||||
LOG_USER_ERROR(OB_ERR_TOO_LONG_IDENT, (int)new_db_node->str_len_, new_db_node->str_value_);
|
||||
} else {
|
||||
new_db_name.assign_ptr(new_db_node->str_value_,
|
||||
static_cast<int32_t>(new_db_node->str_len_));
|
||||
flashback_database_stmt->set_new_db_name(new_db_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* flashback tenant
|
||||
*/
|
||||
int ObFlashBackTenantResolver::resolve(const ParseNode &parser_tree)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObFlashBackTenantStmt *flashback_tenant_stmt = NULL;
|
||||
/**
|
||||
* the length of database name should less than 127 bytes because of compatibility
|
||||
*/
|
||||
int32_t max_database_name_length = GET_MIN_CLUSTER_VERSION() < CLUSTER_CURRENT_VERSION ?
|
||||
OB_MAX_DATABASE_NAME_LENGTH - 1 : OB_MAX_DATABASE_NAME_LENGTH;
|
||||
if (OB_ISNULL(session_info_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("session_info is null", K(ret));
|
||||
} else if (T_FLASHBACK_TENANT != parser_tree.type_) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse tree", K(parser_tree.type_));
|
||||
}
|
||||
//create flashback table stmt
|
||||
if (OB_SUCC(ret)) {
|
||||
if (NULL == (flashback_tenant_stmt = create_stmt<ObFlashBackTenantStmt>())) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_ERROR("failed to create flashback tenant stmt", K(ret));
|
||||
} else {
|
||||
stmt_ = flashback_tenant_stmt;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
flashback_tenant_stmt->set_tenant_id(session_info_->get_effective_tenant_id());
|
||||
ObString origin_tenant_name;
|
||||
ParseNode *origin_tenant_node = parser_tree.children_[ORIGIN_TENANT_NODE];
|
||||
if (OB_ISNULL(origin_tenant_node) || OB_UNLIKELY(T_IDENT != origin_tenant_node->type_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid parse tree", K(ret));
|
||||
} else if (OB_UNLIKELY(
|
||||
static_cast<int32_t>(origin_tenant_node->str_len_) > max_database_name_length)) {
|
||||
ret = OB_ERR_TOO_LONG_IDENT;
|
||||
LOG_USER_ERROR(OB_ERR_TOO_LONG_IDENT, (int)origin_tenant_node->str_len_, origin_tenant_node->str_value_);
|
||||
} else {
|
||||
origin_tenant_name.assign_ptr(origin_tenant_node->str_value_,
|
||||
static_cast<int32_t>(origin_tenant_node->str_len_));
|
||||
flashback_tenant_stmt->set_origin_tenant_name(origin_tenant_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ParseNode *new_tenant_node = parser_tree.children_[NEW_TENANT_NODE];
|
||||
ObString new_tenant_name;
|
||||
if (NULL != new_tenant_node) {
|
||||
if (OB_UNLIKELY(
|
||||
static_cast<int32_t>(new_tenant_node->str_len_) > max_database_name_length)) {
|
||||
ret = OB_ERR_TOO_LONG_IDENT;
|
||||
LOG_USER_ERROR(OB_ERR_TOO_LONG_IDENT, (int)new_tenant_node->str_len_, new_tenant_node->str_value_);
|
||||
} else {
|
||||
new_tenant_name.assign_ptr(new_tenant_node->str_value_,
|
||||
static_cast<int32_t>(new_tenant_node->str_len_));
|
||||
flashback_tenant_stmt->set_new_tenant_name(new_tenant_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} //namespace sql
|
||||
} // namespace oceanbase
|
75
src/sql/resolver/ddl/ob_flashback_resolver.h
Normal file
75
src/sql/resolver/ddl/ob_flashback_resolver.h
Normal file
@ -0,0 +1,75 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#ifndef OCEANBASE_SQL_OB_FLASHBACK_RESOLVER_
|
||||
#define OCEANBASE_SQL_OB_FLASHBACK_RESOLVER_
|
||||
#include "sql/resolver/ddl/ob_flashback_stmt.h"
|
||||
#include "sql/resolver/ddl/ob_ddl_resolver.h"
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
class ObFlashBackTableFromRecyclebinResolver : public ObDDLResolver
|
||||
{
|
||||
static const int ORIGIN_TABLE_NODE = 0;
|
||||
static const int NEW_TABLE_NODE = 1;
|
||||
public:
|
||||
explicit ObFlashBackTableFromRecyclebinResolver(ObResolverParams ¶ms)
|
||||
: ObDDLResolver(params){}
|
||||
virtual ~ObFlashBackTableFromRecyclebinResolver() {}
|
||||
virtual int resolve(const ParseNode &parse_tree);
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObFlashBackTableFromRecyclebinResolver);
|
||||
};
|
||||
|
||||
class ObFlashBackIndexResolver : public ObDDLResolver
|
||||
{
|
||||
static const int ORIGIN_TABLE_NODE = 0;
|
||||
static const int NEW_TABLE_NODE = 1;
|
||||
public:
|
||||
explicit ObFlashBackIndexResolver(ObResolverParams ¶ms)
|
||||
: ObDDLResolver(params){}
|
||||
virtual ~ObFlashBackIndexResolver() {}
|
||||
virtual int resolve(const ParseNode &parse_tree);
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObFlashBackIndexResolver);
|
||||
};
|
||||
class ObFlashBackDatabaseResolver : public ObDDLResolver
|
||||
{
|
||||
static const int ORIGIN_DB_NODE = 0;
|
||||
static const int NEW_DB_NODE = 1;
|
||||
public:
|
||||
explicit ObFlashBackDatabaseResolver(ObResolverParams ¶ms)
|
||||
: ObDDLResolver(params){}
|
||||
virtual ~ObFlashBackDatabaseResolver() {}
|
||||
virtual int resolve(const ParseNode &parse_tree);
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObFlashBackDatabaseResolver);
|
||||
};
|
||||
|
||||
class ObFlashBackTenantResolver : public ObDDLResolver
|
||||
{
|
||||
static const int ORIGIN_TENANT_NODE = 0;
|
||||
static const int NEW_TENANT_NODE = 1;
|
||||
public:
|
||||
explicit ObFlashBackTenantResolver(ObResolverParams ¶ms)
|
||||
: ObDDLResolver(params){}
|
||||
virtual ~ObFlashBackTenantResolver() {}
|
||||
virtual int resolve(const ParseNode &parse_tree);
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObFlashBackTenantResolver);
|
||||
};
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
|
||||
#endif //OCEANBASE_SQL_OB_FLASHBACK_RESOLVER_
|
196
src/sql/resolver/ddl/ob_flashback_stmt.h
Normal file
196
src/sql/resolver/ddl/ob_flashback_stmt.h
Normal file
@ -0,0 +1,196 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#ifndef OCEANBASE_SQL_OB_FLASHBACK_STMT_
|
||||
#define OCEANBASE_SQL_OB_FLASHBACK_STMT_
|
||||
#include "share/ob_rpc_struct.h"
|
||||
#include "sql/resolver/ddl/ob_ddl_stmt.h"
|
||||
#include "sql/resolver/ob_stmt_resolver.h"
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
/**
|
||||
* flashback table
|
||||
*/
|
||||
class ObFlashBackTableFromRecyclebinStmt : public ObDDLStmt
|
||||
{
|
||||
public:
|
||||
ObFlashBackTableFromRecyclebinStmt() : ObDDLStmt(stmt::T_FLASHBACK_TABLE_FROM_RECYCLEBIN) {}
|
||||
explicit ObFlashBackTableFromRecyclebinStmt(common::ObIAllocator *name_pool)
|
||||
: ObDDLStmt(name_pool, stmt::T_FLASHBACK_TABLE_FROM_RECYCLEBIN)
|
||||
{}
|
||||
virtual ~ObFlashBackTableFromRecyclebinStmt() {}
|
||||
const obrpc::ObFlashBackTableFromRecyclebinArg& get_flashback_table_arg() const { return flashback_table_arg_; }
|
||||
inline void set_tenant_id(const uint64_t tenant_id);
|
||||
uint64_t get_tenant_id() const { return flashback_table_arg_.tenant_id_; }
|
||||
inline void set_origin_table_id(const uint64_t origin_table);
|
||||
uint64_t get_origin_table_id() const { return flashback_table_arg_.origin_table_id_; }
|
||||
common::ObString get_origin_db_name() const { return flashback_table_arg_.origin_db_name_; };
|
||||
common::ObString get_origin_table_name() const { return flashback_table_arg_.origin_table_name_; };
|
||||
void set_origin_table_name(const common::ObString &origin_table_name);
|
||||
void set_origin_db_name(const common::ObString &origin_db_name);
|
||||
void set_new_table_name(const common::ObString &new_table_name);
|
||||
void set_new_db_name(const common::ObString &new_db_name);
|
||||
virtual obrpc::ObDDLArg &get_ddl_arg() { return flashback_table_arg_; }
|
||||
TO_STRING_KV(K_(stmt_type),K_(flashback_table_arg));
|
||||
private:
|
||||
obrpc::ObFlashBackTableFromRecyclebinArg flashback_table_arg_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObFlashBackTableFromRecyclebinStmt);
|
||||
};
|
||||
inline void ObFlashBackTableFromRecyclebinStmt::set_tenant_id(const uint64_t tenant_id)
|
||||
{
|
||||
flashback_table_arg_.tenant_id_ = tenant_id;
|
||||
}
|
||||
inline void ObFlashBackTableFromRecyclebinStmt::set_origin_db_name(
|
||||
const common::ObString &origin_db_name)
|
||||
{
|
||||
flashback_table_arg_.origin_db_name_ = origin_db_name;
|
||||
}
|
||||
inline void ObFlashBackTableFromRecyclebinStmt::set_origin_table_id(const uint64_t origin_table_id)
|
||||
{
|
||||
flashback_table_arg_.origin_table_id_ = origin_table_id;
|
||||
}
|
||||
inline void ObFlashBackTableFromRecyclebinStmt::set_origin_table_name(const common::ObString &origin_table_name)
|
||||
{
|
||||
flashback_table_arg_.origin_table_name_ = origin_table_name;
|
||||
}
|
||||
inline void ObFlashBackTableFromRecyclebinStmt::set_new_table_name(const common::ObString &new_table_name)
|
||||
{
|
||||
flashback_table_arg_.new_table_name_ = new_table_name;
|
||||
}
|
||||
inline void ObFlashBackTableFromRecyclebinStmt::set_new_db_name(const common::ObString &new_db_name)
|
||||
{
|
||||
flashback_table_arg_.new_db_name_ = new_db_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* flashback index
|
||||
*/
|
||||
class ObFlashBackIndexStmt : public ObDDLStmt
|
||||
{
|
||||
public:
|
||||
ObFlashBackIndexStmt() : ObDDLStmt(stmt::T_FLASHBACK_INDEX) {}
|
||||
explicit ObFlashBackIndexStmt(common::ObIAllocator *name_pool)
|
||||
: ObDDLStmt(name_pool, stmt::T_FLASHBACK_INDEX)
|
||||
{}
|
||||
virtual ~ObFlashBackIndexStmt() {}
|
||||
const obrpc::ObFlashBackIndexArg& get_flashback_index_arg() const { return flashback_index_arg_; }
|
||||
inline void set_tenant_id(const uint64_t tenant_id);
|
||||
uint64_t get_tenant_id() const { return flashback_index_arg_.tenant_id_; }
|
||||
inline void set_origin_table_id(const uint64_t origin_table_id);
|
||||
uint64_t get_origin_table_id() const { return flashback_index_arg_.origin_table_id_; }
|
||||
void set_origin_table_name(const common::ObString &origin_table_name);
|
||||
void set_origin_db_name(const common::ObString origin_db_name);
|
||||
void set_new_table_name(const common::ObString &new_table_name);
|
||||
void set_new_db_name(const common::ObString &new_db_name);
|
||||
virtual obrpc::ObDDLArg &get_ddl_arg() { return flashback_index_arg_; }
|
||||
TO_STRING_KV(K_(stmt_type),K_(flashback_index_arg));
|
||||
private:
|
||||
obrpc::ObFlashBackIndexArg flashback_index_arg_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObFlashBackIndexStmt);
|
||||
};
|
||||
inline void ObFlashBackIndexStmt::set_tenant_id(const uint64_t tenant_id)
|
||||
{
|
||||
flashback_index_arg_.tenant_id_ = tenant_id;
|
||||
}
|
||||
inline void ObFlashBackIndexStmt::set_origin_table_id(const uint64_t origin_table_id)
|
||||
{
|
||||
flashback_index_arg_.origin_table_id_ = origin_table_id;
|
||||
}
|
||||
inline void ObFlashBackIndexStmt::set_origin_table_name(const common::ObString &origin_table_name)
|
||||
{
|
||||
flashback_index_arg_.origin_table_name_ = origin_table_name;
|
||||
}
|
||||
inline void ObFlashBackIndexStmt::set_new_table_name(const common::ObString &new_table_name)
|
||||
{
|
||||
flashback_index_arg_.new_table_name_ = new_table_name;
|
||||
}
|
||||
inline void ObFlashBackIndexStmt::set_new_db_name(const common::ObString &new_db_name)
|
||||
{
|
||||
flashback_index_arg_.new_db_name_ = new_db_name;
|
||||
}
|
||||
/**
|
||||
* flaskback database
|
||||
*/
|
||||
class ObFlashBackDatabaseStmt : public ObDDLStmt
|
||||
{
|
||||
public:
|
||||
ObFlashBackDatabaseStmt() : ObDDLStmt(stmt::T_FLASHBACK_DATABASE) {}
|
||||
explicit ObFlashBackDatabaseStmt(common::ObIAllocator *name_pool)
|
||||
: ObDDLStmt(name_pool, stmt::T_FLASHBACK_DATABASE)
|
||||
{}
|
||||
virtual ~ObFlashBackDatabaseStmt() {}
|
||||
const obrpc::ObFlashBackDatabaseArg& get_flashback_database_arg() const { return flashback_db_arg_; }
|
||||
inline void set_tenant_id(const uint64_t tenant_id);
|
||||
uint64_t get_tenant_id() const { return flashback_db_arg_.tenant_id_; }
|
||||
const common::ObString &get_origin_db_name() const { return flashback_db_arg_.origin_db_name_; }
|
||||
const common::ObString &get_new_db_name() const { return flashback_db_arg_.new_db_name_; }
|
||||
void set_origin_db_name(const common::ObString origin_db_name);
|
||||
void set_new_db_name(const common::ObString &new_db_name);
|
||||
virtual obrpc::ObDDLArg &get_ddl_arg() { return flashback_db_arg_; }
|
||||
TO_STRING_KV(K_(stmt_type),K_(flashback_db_arg));
|
||||
private:
|
||||
obrpc::ObFlashBackDatabaseArg flashback_db_arg_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObFlashBackDatabaseStmt);
|
||||
};
|
||||
inline void ObFlashBackDatabaseStmt::set_tenant_id(const uint64_t tenant_id)
|
||||
{
|
||||
flashback_db_arg_.tenant_id_ = tenant_id;
|
||||
}
|
||||
inline void ObFlashBackDatabaseStmt::set_origin_db_name(const common::ObString origin_db_name)
|
||||
{
|
||||
flashback_db_arg_.origin_db_name_ = origin_db_name;
|
||||
}
|
||||
inline void ObFlashBackDatabaseStmt::set_new_db_name(const common::ObString &new_db_name)
|
||||
{
|
||||
flashback_db_arg_.new_db_name_ = new_db_name;
|
||||
}
|
||||
/**
|
||||
* flaskback tenant
|
||||
*/
|
||||
class ObFlashBackTenantStmt : public ObDDLStmt
|
||||
{
|
||||
public:
|
||||
ObFlashBackTenantStmt() : ObDDLStmt(stmt::T_FLASHBACK_TENANT) {}
|
||||
explicit ObFlashBackTenantStmt(common::ObIAllocator *name_pool)
|
||||
: ObDDLStmt(name_pool, stmt::T_FLASHBACK_TENANT)
|
||||
{}
|
||||
virtual ~ObFlashBackTenantStmt() {}
|
||||
const obrpc::ObFlashBackTenantArg& get_flashback_tenant_arg() const { return flashback_tenant_arg_; }
|
||||
inline void set_tenant_id(const uint64_t tenant_id);
|
||||
virtual obrpc::ObDDLArg &get_ddl_arg() { return flashback_tenant_arg_; }
|
||||
uint64_t get_tenant_id() const { return flashback_tenant_arg_.tenant_id_; }
|
||||
void set_origin_tenant_name(const common::ObString origin_tenant_name);
|
||||
void set_new_tenant_name(const common::ObString &new_tenant_name);
|
||||
TO_STRING_KV(K_(stmt_type),K_(flashback_tenant_arg));
|
||||
private:
|
||||
obrpc::ObFlashBackTenantArg flashback_tenant_arg_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObFlashBackTenantStmt);
|
||||
};
|
||||
inline void ObFlashBackTenantStmt::set_tenant_id(const uint64_t tenant_id)
|
||||
{
|
||||
flashback_tenant_arg_.tenant_id_ = tenant_id;
|
||||
}
|
||||
inline void ObFlashBackTenantStmt::set_origin_tenant_name(const common::ObString origin_tenant_name)
|
||||
{
|
||||
flashback_tenant_arg_.origin_tenant_name_ = origin_tenant_name;
|
||||
}
|
||||
inline void ObFlashBackTenantStmt::set_new_tenant_name(const common::ObString &new_tenant_name)
|
||||
{
|
||||
flashback_tenant_arg_.new_tenant_name_ = new_tenant_name;
|
||||
}
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
|
||||
#endif //OCEANBASE_SQL_OB_RENAME_TABLE_STMT_
|
@ -51,6 +51,7 @@
|
||||
#include "sql/resolver/ddl/ob_alter_outline_resolver.h"
|
||||
#include "sql/resolver/ddl/ob_drop_outline_resolver.h"
|
||||
#include "sql/resolver/ddl/ob_optimize_resolver.h"
|
||||
#include "sql/resolver/ddl/ob_flashback_resolver.h"
|
||||
#include "sql/resolver/ddl/ob_purge_resolver.h"
|
||||
#include "sql/resolver/ddl/ob_alter_baseline_resolver.h"
|
||||
#include "sql/resolver/ddl/ob_purge_resolver.h"
|
||||
@ -481,6 +482,22 @@ int ObResolver::resolve(IsPrepared if_prepared, const ParseNode& parse_tree, ObS
|
||||
REGISTER_STMT_RESOLVER(TruncateTable);
|
||||
break;
|
||||
}
|
||||
case T_FLASHBACK_TABLE_FROM_RECYCLEBIN: {
|
||||
REGISTER_STMT_RESOLVER(FlashBackTableFromRecyclebin);
|
||||
break;
|
||||
}
|
||||
case T_FLASHBACK_INDEX: {
|
||||
REGISTER_STMT_RESOLVER(FlashBackIndex);
|
||||
break;
|
||||
}
|
||||
case T_FLASHBACK_DATABASE: {
|
||||
REGISTER_STMT_RESOLVER(FlashBackDatabase);
|
||||
break;
|
||||
}
|
||||
case T_FLASHBACK_TENANT: {
|
||||
REGISTER_STMT_RESOLVER(FlashBackTenant);
|
||||
break;
|
||||
}
|
||||
case T_PURGE_TABLE: {
|
||||
REGISTER_STMT_RESOLVER(PurgeTable);
|
||||
break;
|
||||
|
@ -348,6 +348,11 @@ stmt::StmtType ObResolverUtils::get_stmt_type_by_item_type(const ObItemType item
|
||||
// index
|
||||
SET_STMT_TYPE(T_CREATE_INDEX);
|
||||
SET_STMT_TYPE(T_DROP_INDEX);
|
||||
// flashback
|
||||
SET_STMT_TYPE(T_FLASHBACK_TENANT);
|
||||
SET_STMT_TYPE(T_FLASHBACK_DATABASE);
|
||||
SET_STMT_TYPE(T_FLASHBACK_TABLE_FROM_RECYCLEBIN);
|
||||
SET_STMT_TYPE(T_FLASHBACK_INDEX);
|
||||
// purge
|
||||
SET_STMT_TYPE(T_PURGE_RECYCLEBIN);
|
||||
SET_STMT_TYPE(T_PURGE_TENANT);
|
||||
|
@ -278,6 +278,11 @@ public:
|
||||
// index
|
||||
|| stmt_type == stmt::T_CREATE_INDEX ||
|
||||
stmt_type == stmt::T_DROP_INDEX
|
||||
// flashback
|
||||
|| stmt_type == stmt::T_FLASHBACK_TENANT
|
||||
|| stmt_type == stmt::T_FLASHBACK_DATABASE
|
||||
|| stmt_type == stmt::T_FLASHBACK_TABLE_FROM_RECYCLEBIN
|
||||
|| stmt_type == stmt::T_FLASHBACK_INDEX
|
||||
// purge
|
||||
|| stmt_type == stmt::T_PURGE_RECYCLEBIN || stmt_type == stmt::T_PURGE_TENANT ||
|
||||
stmt_type == stmt::T_PURGE_DATABASE || stmt_type == stmt::T_PURGE_TABLE ||
|
||||
@ -351,6 +356,11 @@ public:
|
||||
|| stmt_type == stmt::T_DROP_VIEW
|
||||
// index
|
||||
|| stmt_type == stmt::T_DROP_INDEX
|
||||
// flashback
|
||||
|| stmt_type == stmt::T_FLASHBACK_TENANT
|
||||
|| stmt_type == stmt::T_FLASHBACK_DATABASE
|
||||
|| stmt_type == stmt::T_FLASHBACK_TABLE_FROM_RECYCLEBIN
|
||||
|| stmt_type == stmt::T_FLASHBACK_INDEX
|
||||
// purge
|
||||
|| stmt_type == stmt::T_PURGE_RECYCLEBIN || stmt_type == stmt::T_PURGE_TENANT ||
|
||||
stmt_type == stmt::T_PURGE_DATABASE || stmt_type == stmt::T_PURGE_TABLE ||
|
||||
|
@ -139,6 +139,10 @@ OB_STMT_TYPE_DEF(T_DROP_OUTLINE, no_priv_needed, 126)
|
||||
OB_STMT_TYPE_DEF(T_ALTER_BASELINE, get_sys_tenant_alter_system_priv, 127)
|
||||
OB_STMT_TYPE_DEF(T_LOAD_BASELINE, get_sys_tenant_alter_system_priv, 128)
|
||||
OB_STMT_TYPE_DEF(T_SWITCH_RS_ROLE, get_sys_tenant_alter_system_priv, 129)
|
||||
OB_STMT_TYPE_DEF(T_FLASHBACK_TENANT, get_flashback_tenant_stmt_need_privs, 130)
|
||||
OB_STMT_TYPE_DEF(T_FLASHBACK_DATABASE, get_flashback_database_stmt_need_privs, 131)
|
||||
OB_STMT_TYPE_DEF(T_FLASHBACK_TABLE_FROM_RECYCLEBIN, get_flashback_table_stmt_need_privs, 132)
|
||||
OB_STMT_TYPE_DEF(T_FLASHBACK_INDEX, get_flashback_index_stmt_need_privs, 133)
|
||||
OB_STMT_TYPE_DEF(T_PURGE_RECYCLEBIN, get_purge_recyclebin_stmt_need_privs, 134)
|
||||
OB_STMT_TYPE_DEF(T_PURGE_TENANT, get_purge_tenant_stmt_need_privs, 135)
|
||||
OB_STMT_TYPE_DEF(T_PURGE_DATABASE, get_purge_database_stmt_need_privs, 136)
|
||||
|
@ -1,4 +1,86 @@
|
||||
*************** Case 1 ***************
|
||||
flashback table t1 to before drop;
|
||||
{
|
||||
"stmt_type":131,
|
||||
"flashback_table_arg": {
|
||||
"tenant_id":1,
|
||||
"origin_table_name":"t1",
|
||||
"new_db_name":"",
|
||||
"new_table_name":""
|
||||
}
|
||||
}
|
||||
*************** Case 2 ***************
|
||||
flashback table t1 to before drop rename to t2;
|
||||
{
|
||||
"stmt_type":131,
|
||||
"flashback_table_arg": {
|
||||
"tenant_id":1,
|
||||
"origin_table_name":"t1",
|
||||
"new_db_name":"rongxuan",
|
||||
"new_table_name":"t2"
|
||||
}
|
||||
}
|
||||
*************** Case 3 ***************
|
||||
flashback database db1 to before drop;
|
||||
{
|
||||
"stmt_type":130,
|
||||
"flashback_db_arg": {
|
||||
"tenant_id":1,
|
||||
"origin_db_name":"db1",
|
||||
"new_db_name":""
|
||||
}
|
||||
}
|
||||
*************** Case 4 ***************
|
||||
flashback database db1 to before drop rename to db2;
|
||||
{
|
||||
"stmt_type":130,
|
||||
"flashback_db_arg": {
|
||||
"tenant_id":1,
|
||||
"origin_db_name":"db1",
|
||||
"new_db_name":"db2"
|
||||
}
|
||||
}
|
||||
*************** Case 5 ***************
|
||||
flashback schema db1 to before drop;
|
||||
{
|
||||
"stmt_type":130,
|
||||
"flashback_db_arg": {
|
||||
"tenant_id":1,
|
||||
"origin_db_name":"db1",
|
||||
"new_db_name":""
|
||||
}
|
||||
}
|
||||
*************** Case 6 ***************
|
||||
flashback schema db1 to before drop rename to db2;
|
||||
{
|
||||
"stmt_type":130,
|
||||
"flashback_db_arg": {
|
||||
"tenant_id":1,
|
||||
"origin_db_name":"db1",
|
||||
"new_db_name":"db2"
|
||||
}
|
||||
}
|
||||
*************** Case 7 ***************
|
||||
flashback tenant tenant1 to before drop;
|
||||
{
|
||||
"stmt_type":129,
|
||||
"flashback_tenant_arg": {
|
||||
"tenant_id":1,
|
||||
"origin_tenant_name":"tenant1",
|
||||
"new_tenant_name":""
|
||||
}
|
||||
}
|
||||
*************** Case 8 ***************
|
||||
flashback tenant tenant1 to before drop rename to tenant2;
|
||||
{
|
||||
"stmt_type":129,
|
||||
"flashback_tenant_arg": {
|
||||
"tenant_id":1,
|
||||
"origin_tenant_name":"tenant1",
|
||||
"new_tenant_name":"tenant2"
|
||||
}
|
||||
}
|
||||
*************** Case 9 ***************
|
||||
purge table t1;
|
||||
{
|
||||
"stmt_type":136,
|
||||
@ -7,7 +89,7 @@ purge table t1;
|
||||
"table_name":"t1"
|
||||
}
|
||||
}
|
||||
*************** Case 2 ***************
|
||||
*************** Case 10 ***************
|
||||
purge database db1;
|
||||
{
|
||||
"stmt_type":135,
|
||||
@ -16,7 +98,7 @@ purge database db1;
|
||||
"db_name":"db1"
|
||||
}
|
||||
}
|
||||
*************** Case 3 ***************
|
||||
*************** Case 11 ***************
|
||||
purge schema db1;
|
||||
{
|
||||
"stmt_type":135,
|
||||
@ -25,7 +107,7 @@ purge schema db1;
|
||||
"db_name":"db1"
|
||||
}
|
||||
}
|
||||
*************** Case 4 ***************
|
||||
*************** Case 12 ***************
|
||||
purge tenant tenant1;
|
||||
{
|
||||
"stmt_type":134,
|
||||
|
@ -1,4 +1,13 @@
|
||||
|
||||
flashback table t1 to before drop;
|
||||
flashback table t1 to before drop rename to t2;
|
||||
flashback database db1 to before drop;
|
||||
flashback database db1 to before drop rename to db2;
|
||||
flashback schema db1 to before drop;
|
||||
flashback schema db1 to before drop rename to db2;
|
||||
flashback tenant tenant1 to before drop;
|
||||
flashback tenant tenant1 to before drop rename to tenant2;
|
||||
|
||||
purge table t1;
|
||||
|
||||
purge database db1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user