From 03b37d37308da5c8794115f9f711429847825337 Mon Sep 17 00:00:00 2001 From: obdev Date: Thu, 31 Aug 2023 03:10:42 +0000 Subject: [PATCH] [FEAT MERGE] change the semantics of tenant=all --- mittest/simple_server/fast_commit_report.cpp | 4 +- ...ansfer_complete_restart_with_mds_flush.cpp | 6 +- ...fer_complete_restart_without_mds_flush.cpp | 6 +- ...fer_doing_stage_restart_with_mds_flush.cpp | 6 +- ..._doing_stage_restart_without_mds_flush.cpp | 6 +- ..._start_stage_restart_without_mds_flush.cpp | 6 +- .../simple_server/test_tx_ctx_table_mit.cpp | 4 +- .../simple_server/test_tx_data_table_mit.cpp | 4 +- .../freeze/ob_major_freeze_helper.cpp | 53 ++- .../freeze/ob_major_freeze_helper.h | 26 +- src/rootserver/ob_root_service.cpp | 21 + src/rootserver/ob_system_admin_util.cpp | 78 +++- src/share/ob_rpc_struct.cpp | 7 +- src/share/ob_rpc_struct.h | 15 +- .../engine/cmd/ob_alter_system_executor.cpp | 34 +- .../parser/non_reserved_keywords_mysql_mode.c | 2 + src/sql/parser/sql_parser_mysql_mode.y | 4 +- .../resolver/cmd/ob_alter_system_resolver.cpp | 152 +++++-- .../resolver/cmd/ob_alter_system_resolver.h | 4 +- src/sql/resolver/cmd/ob_alter_system_stmt.h | 18 +- .../ddl/ob_create_standby_tenant_resolver.cpp | 8 + .../ddl/ob_create_tenant_resolver.cpp | 8 + .../resolver/ddl/ob_flashback_resolver.cpp | 9 +- .../ddl/ob_modify_tenant_resolver.cpp | 6 + src/sql/resolver/ob_resolver_utils.cpp | 11 + src/sql/resolver/ob_resolver_utils.h | 1 + tools/deploy/init_for_ce.sql | 20 +- .../mysql_test/include/index_quick_major.inc | 4 +- tools/upgrade/actions.py | 48 ++- tools/upgrade/upgrade_checker.py | 11 + tools/upgrade/upgrade_post.py | 59 ++- tools/upgrade/upgrade_pre.py | 59 ++- unittest/sql/parser/print_parser_tree.result | 276 ++++++------ unittest/sql/parser/test_parser.result | 396 ++++++++++++------ unittest/sql/parser/test_parser.sql | 8 +- unittest/sql/parser/test_parser.test | 8 +- 36 files changed, 1042 insertions(+), 346 deletions(-) diff --git a/mittest/simple_server/fast_commit_report.cpp b/mittest/simple_server/fast_commit_report.cpp index 4f4b5a414..58d4bee38 100644 --- a/mittest/simple_server/fast_commit_report.cpp +++ b/mittest/simple_server/fast_commit_report.cpp @@ -293,7 +293,9 @@ public: ObSqlString sql; int64_t affected_rows = 0; - WRITE_SQL_BY_CONN(connection, "alter system minor freeze tenant all;"); + WRITE_SQL_BY_CONN(connection, "alter system minor freeze tenant sys;"); + WRITE_SQL_BY_CONN(connection, "alter system minor freeze tenant all_user;"); + WRITE_SQL_BY_CONN(connection, "alter system minor freeze tenant all_meta;"); fprintf(stdout, "start flush user data\n"); sleep(10); diff --git a/mittest/simple_server/storage_ha/test_transfer_complete_restart_with_mds_flush.cpp b/mittest/simple_server/storage_ha/test_transfer_complete_restart_with_mds_flush.cpp index 40d3b845b..46f81d13a 100644 --- a/mittest/simple_server/storage_ha/test_transfer_complete_restart_with_mds_flush.cpp +++ b/mittest/simple_server/storage_ha/test_transfer_complete_restart_with_mds_flush.cpp @@ -175,7 +175,11 @@ TEST_F(TestTransferHandler, prepare_valid_data) //set transfer service wakup interval ObSqlString sql; int64_t affected_rows = 0; - ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all")); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = sys")); + ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all_user")); + ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all_meta")); ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); sql.reset(); diff --git a/mittest/simple_server/storage_ha/test_transfer_complete_restart_without_mds_flush.cpp b/mittest/simple_server/storage_ha/test_transfer_complete_restart_without_mds_flush.cpp index 0c89b2432..40691225e 100644 --- a/mittest/simple_server/storage_ha/test_transfer_complete_restart_without_mds_flush.cpp +++ b/mittest/simple_server/storage_ha/test_transfer_complete_restart_without_mds_flush.cpp @@ -175,7 +175,11 @@ TEST_F(TestTransferHandler, prepare_valid_data) //set transfer service wakup interval ObSqlString sql; int64_t affected_rows = 0; - ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all")); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = sys")); + ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all_user")); + ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all_meta")); ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); sql.reset(); diff --git a/mittest/simple_server/storage_ha/test_transfer_doing_stage_restart_with_mds_flush.cpp b/mittest/simple_server/storage_ha/test_transfer_doing_stage_restart_with_mds_flush.cpp index 1a521fe3d..04bc64603 100644 --- a/mittest/simple_server/storage_ha/test_transfer_doing_stage_restart_with_mds_flush.cpp +++ b/mittest/simple_server/storage_ha/test_transfer_doing_stage_restart_with_mds_flush.cpp @@ -174,7 +174,11 @@ TEST_F(TestTransferHandler, prepare_valid_data) //set transfer service wakup interval ObSqlString sql; int64_t affected_rows = 0; - ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all")); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = sys")); + ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all_user")); + ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all_meta")); ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); sql.reset(); diff --git a/mittest/simple_server/storage_ha/test_transfer_doing_stage_restart_without_mds_flush.cpp b/mittest/simple_server/storage_ha/test_transfer_doing_stage_restart_without_mds_flush.cpp index fa8e38b8c..c0e843820 100644 --- a/mittest/simple_server/storage_ha/test_transfer_doing_stage_restart_without_mds_flush.cpp +++ b/mittest/simple_server/storage_ha/test_transfer_doing_stage_restart_without_mds_flush.cpp @@ -174,7 +174,11 @@ TEST_F(TestTransferHandler, prepare_valid_data) //set transfer service wakup interval ObSqlString sql; int64_t affected_rows = 0; - ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all")); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = sys")); + ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all_user")); + ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all_meta")); ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); sql.reset(); diff --git a/mittest/simple_server/storage_ha/test_transfer_start_stage_restart_without_mds_flush.cpp b/mittest/simple_server/storage_ha/test_transfer_start_stage_restart_without_mds_flush.cpp index 3b457b02d..85c54bf34 100644 --- a/mittest/simple_server/storage_ha/test_transfer_start_stage_restart_without_mds_flush.cpp +++ b/mittest/simple_server/storage_ha/test_transfer_start_stage_restart_without_mds_flush.cpp @@ -174,7 +174,11 @@ TEST_F(TestTransferHandler, prepare_valid_data) //set transfer service wakup interval ObSqlString sql; int64_t affected_rows = 0; - ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all")); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = sys")); + ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all_user")); + ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); + ASSERT_EQ(OB_SUCCESS, sql.assign_fmt("alter system set _transfer_service_wakeup_interval = '5s' tenant = all_meta")); ASSERT_EQ(OB_SUCCESS, sql_proxy.write(sql.ptr(), affected_rows)); sql.reset(); diff --git a/mittest/simple_server/test_tx_ctx_table_mit.cpp b/mittest/simple_server/test_tx_ctx_table_mit.cpp index 21b3ab8c6..072b96a2d 100644 --- a/mittest/simple_server/test_tx_ctx_table_mit.cpp +++ b/mittest/simple_server/test_tx_ctx_table_mit.cpp @@ -174,7 +174,9 @@ void ObTxCtxTableTest::dump_ctx_with_merged_undo_action() // 执行一次事务上下文表的转储,保证建表语句产生的多源事务能够被转储下去,retain ctx可以被释放 SLEEP_BEFORE_DUMP_TX_CTX = false; - WRITE_SQL_BY_CONN(sys_conn, "alter system minor freeze tenant all;"); + WRITE_SQL_BY_CONN(sys_conn, "alter system minor freeze tenant sys;"); + WRITE_SQL_BY_CONN(sys_conn, "alter system minor freeze tenant all_user;"); + WRITE_SQL_BY_CONN(sys_conn, "alter system minor freeze tenant all_meta;"); sleep(5); diff --git a/mittest/simple_server/test_tx_data_table_mit.cpp b/mittest/simple_server/test_tx_data_table_mit.cpp index 3cf578f1f..ef27484f9 100644 --- a/mittest/simple_server/test_tx_data_table_mit.cpp +++ b/mittest/simple_server/test_tx_data_table_mit.cpp @@ -190,7 +190,9 @@ void ObTxDataTableTest::freeze_tx_data(ObTxDataTable *tx_data_table) ::sleep(1); int64_t affected_rows = 0; ObSqlString sql; - EXE_SQL("alter system minor freeze tenant all;"); + EXE_SQL("alter system minor freeze tenant sys;"); + EXE_SQL("alter system minor freeze tenant all_user;"); + EXE_SQL("alter system minor freeze tenant all_meta;"); } ATOMIC_STORE(&stop, true); STORAGE_LOG(INFO, "freeze done"); diff --git a/src/rootserver/freeze/ob_major_freeze_helper.cpp b/src/rootserver/freeze/ob_major_freeze_helper.cpp index 7b113ea04..b8aaa8208 100644 --- a/src/rootserver/freeze/ob_major_freeze_helper.cpp +++ b/src/rootserver/freeze/ob_major_freeze_helper.cpp @@ -50,8 +50,9 @@ int ObMajorFreezeHelper::major_freeze( { int ret = OB_SUCCESS; ObSEArray freeze_info_array; + bool freeze_all = (param.freeze_all_user_ || param.freeze_all_meta_); if (OB_UNLIKELY(!param.is_valid() - || (!param.freeze_all_ && param.freeze_info_array_.empty()))) { + || (!freeze_all && param.freeze_info_array_.empty()))) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", K(param), KR(ret)); } else if (OB_FAIL(get_freeze_info(param, freeze_info_array))) { @@ -71,9 +72,10 @@ int ObMajorFreezeHelper::get_freeze_info( int ret = OB_SUCCESS; ObArray tmp_info_array; - if (param.freeze_all_) { - if (OB_FAIL(get_all_tenant_freeze_info(tmp_info_array))) { - LOG_WARN("fail to get all tenant freeze info", KR(ret)); + if (param.freeze_all_user_ || param.freeze_all_meta_) { + if (OB_FAIL(get_specific_tenant_freeze_info(tmp_info_array, + param.freeze_all_user_, param.freeze_all_meta_))) { + LOG_WARN("fail to get specific tenant freeze info", KR(ret)); } } else { if (OB_FAIL(tmp_info_array.assign(param.freeze_info_array_))) { @@ -180,6 +182,42 @@ int ObMajorFreezeHelper::get_all_tenant_freeze_info( return ret; } +int ObMajorFreezeHelper::get_specific_tenant_freeze_info( + common::ObIArray &freeze_info_array, + bool freeze_all_user, + bool freeze_all_meta) +{ + int ret = OB_SUCCESS; + if (freeze_all_user == freeze_all_meta) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("freeze_all_user and freeze_all_meta cannot be true or false together", + KR(ret), K(freeze_all_user), K(freeze_all_meta)); + } else { + ObSEArray tmp_freeze_info_array; + if (OB_FAIL(get_all_tenant_freeze_info(tmp_freeze_info_array))) { + LOG_WARN("fail to get all tenant freeze info", KR(ret)); + } else { + using FUNC_TYPE = bool (*) (const uint64_t); + FUNC_TYPE func = nullptr; + if (freeze_all_user) { + func = is_user_tenant; + } else { + func = is_meta_tenant; + } + freeze_info_array.reset(); + for (int64_t i = 0; OB_SUCC(ret) && (i < tmp_freeze_info_array.count()); ++i) { + if (func(tmp_freeze_info_array.at(i).tenant_id_)) { + if (OB_FAIL(freeze_info_array.push_back(tmp_freeze_info_array.at(i)))) { + LOG_WARN("fail to push back freeze info", + KR(ret), K(i), "freeze_info", tmp_freeze_info_array.at(i)); + } + } + } + } + } + return ret; +} + int ObMajorFreezeHelper::do_major_freeze( const rpc::frame::ObReqTransport &transport, const ObIArray &freeze_info_array, @@ -320,9 +358,10 @@ int ObMajorFreezeHelper::do_tenant_admin_merge( ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", K(param), KR(ret)); } else { - if (param.need_all_) { - if (OB_FAIL(get_all_tenant_freeze_info(freeze_info_array))) { - LOG_WARN("fail to get all tenant freeze info", KR(ret)); + if (param.need_all_user_ || param.need_all_meta_) { + if (OB_FAIL(get_specific_tenant_freeze_info(freeze_info_array, + param.need_all_user_, param.need_all_meta_))) { + LOG_WARN("fail to get specific tenant freeze info", KR(ret)); } } else { for (int64_t i = 0; (i < param.tenant_array_.count()) && OB_SUCC(ret); ++i) { diff --git a/src/rootserver/freeze/ob_major_freeze_helper.h b/src/rootserver/freeze/ob_major_freeze_helper.h index 4874e61d5..9f999a749 100644 --- a/src/rootserver/freeze/ob_major_freeze_helper.h +++ b/src/rootserver/freeze/ob_major_freeze_helper.h @@ -29,13 +29,14 @@ struct ObMajorFreezeParam { public: ObMajorFreezeParam() - : freeze_info_array_(), freeze_all_(false), transport_(nullptr) + : freeze_info_array_(), freeze_all_user_(false), freeze_all_meta_(false), transport_(nullptr) {} void reset() { freeze_info_array_.reset(); - freeze_all_ = false; + freeze_all_user_ = false; + freeze_all_meta_ = false; transport_ = nullptr; } @@ -46,10 +47,11 @@ public: int add_freeze_info(const uint64_t tenant_id); - TO_STRING_KV(K_(freeze_info_array), K_(freeze_all), KP_(transport)); + TO_STRING_KV(K_(freeze_info_array), K_(freeze_all_user), K_(freeze_all_meta), KP_(transport)); common::ObArray freeze_info_array_; - bool freeze_all_; + bool freeze_all_user_; + bool freeze_all_meta_; rpc::frame::ObReqTransport *transport_; }; @@ -57,25 +59,27 @@ struct ObTenantAdminMergeParam { public: ObTenantAdminMergeParam() - : tenant_array_(), need_all_(false), transport_(nullptr) + : tenant_array_(), need_all_user_(false), need_all_meta_(false), transport_(nullptr) {} void reset() { tenant_array_.reset(); - need_all_ = false; + need_all_user_ = false; + need_all_meta_ = false; transport_ = nullptr; } bool is_valid() const { - return (nullptr != transport_) && (!tenant_array_.empty() || need_all_); + return (nullptr != transport_) && (!tenant_array_.empty() || (need_all_user_ || need_all_meta_)); } - TO_STRING_KV(K_(tenant_array), K_(need_all), KP_(transport)); + TO_STRING_KV(K_(tenant_array), K_(need_all_user), K_(need_all_meta), KP_(transport)); common::ObArray tenant_array_; - bool need_all_; + bool need_all_user_; + bool need_all_meta_; rpc::frame::ObReqTransport *transport_; }; @@ -109,6 +113,10 @@ private: common::ObIArray &freeze_info_array); static int get_all_tenant_freeze_info( common::ObIArray &freeze_info_array); + static int get_specific_tenant_freeze_info( + common::ObIArray &freeze_info_array, + bool freeze_all_user, + bool freeze_all_meta); static int check_tenant_is_restore(const uint64_t tenant_id, bool &is_restore); static int do_major_freeze( diff --git a/src/rootserver/ob_root_service.cpp b/src/rootserver/ob_root_service.cpp index 0aa650467..a4fb37261 100755 --- a/src/rootserver/ob_root_service.cpp +++ b/src/rootserver/ob_root_service.cpp @@ -2697,9 +2697,15 @@ int ObRootService::create_tenant(const ObCreateTenantArg &arg, UInt64 &tenant_id LOG_INFO("receive create tenant arg", K(arg), "timeout_ts", THIS_WORKER.get_timeout_ts()); int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; + const ObString &tenant_name = arg.tenant_schema_.get_tenant_name_str(); if (!inited_) { ret = OB_NOT_INIT; LOG_WARN("not init", KR(ret)); + } else if (OB_FAIL(ObResolverUtils::check_not_supported_tenant_name(tenant_name))) { + LOG_WARN("since 4.2.1, naming a tenant as all/all_user/all_meta is not supported", + KR(ret), K(tenant_name)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "since 4.2.1, naming a tenant as all/all_user/all_meta is"); } else if (OB_FAIL(ddl_service_.create_tenant(arg, tenant_id))) { LOG_WARN("fail to create tenant", KR(ret), K(arg)); if (OB_TMP_FAIL(submit_reload_unit_manager_task())) { @@ -2774,6 +2780,11 @@ int ObRootService::flashback_tenant(const ObFlashBackTenantArg &arg) } else if (!arg.is_valid()) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", K(arg), K(ret)); + } else if (OB_FAIL(ObResolverUtils::check_not_supported_tenant_name(arg.new_tenant_name_))) { + LOG_WARN("since 4.2.1, renaming a tenant to all/all_user/all_meta is not supported", + KR(ret), "new_tenant_name", arg.new_tenant_name_); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "since 4.2.1, renaming a tenant to all/all_user/all_meta is"); } else if (OB_FAIL(ddl_service_.flashback_tenant(arg))) { LOG_WARN("failed to flash back tenant", K(ret)); } @@ -2807,6 +2818,11 @@ int ObRootService::modify_tenant(const ObModifyTenantArg &arg) } else if (!arg.is_valid()) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid arg", K(arg), K(ret)); + } else if (OB_FAIL(ObResolverUtils::check_not_supported_tenant_name(arg.new_tenant_name_))) { + LOG_WARN("since 4.2.1, renaming a tenant to all/all_user/all_meta is not supported", + KR(ret), "new_tenant_name", arg.new_tenant_name_); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "since 4.2.1, renaming a tenant to all/all_user/all_meta is"); } else if (OB_FAIL(ddl_service_.modify_tenant(arg))) { LOG_WARN("ddl service modify tenant failed", K(arg), K(ret)); } else { @@ -8373,6 +8389,11 @@ int ObRootService::physical_restore_tenant(const obrpc::ObPhysicalRestoreTenantA ret = OB_OP_NOT_ALLOW; LOG_WARN("restore tenant when restore_concurrency is 0 not allowed", KR(ret)); LOG_USER_ERROR(OB_OP_NOT_ALLOW, "restore tenant when restore_concurrency is 0"); + } else if (OB_FAIL(ObResolverUtils::check_not_supported_tenant_name(arg.tenant_name_))) { + LOG_WARN("since 4.2.1, naming a tenant as all/all_user/all_meta is not supported", + KR(ret), "tenant_name", arg.tenant_name_); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "since 4.2.1, naming a tenant as all/all_user/all_meta is"); } else if (OB_FAIL(ddl_service_.get_tenant_schema_guard_with_version_in_inner_table( OB_SYS_TENANT_ID, schema_guard))) { LOG_WARN("fail to get sys tenant's schema guard", KR(ret)); diff --git a/src/rootserver/ob_system_admin_util.cpp b/src/rootserver/ob_system_admin_util.cpp index 8340db9a1..bd6bb0b46 100644 --- a/src/rootserver/ob_system_admin_util.cpp +++ b/src/rootserver/ob_system_admin_util.cpp @@ -509,8 +509,21 @@ int ObAdminClearMergeError::execute(const obrpc::ObAdminMergeArg &arg) } else { ObTenantAdminMergeParam param; param.transport_ = GCTX.net_frame_->get_req_transport(); - if (arg.affect_all_) { - param.need_all_ = true; + if (arg.affect_all_ || arg.affect_all_user_ || arg.affect_all_meta_) { + if ((true == arg.affect_all_ && true == arg.affect_all_user_) || + (true == arg.affect_all_ && true == arg.affect_all_meta_) || + (true == arg.affect_all_user_ && true == arg.affect_all_meta_)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("only one of affect_all,affect_all_user,affect_all_meta can be true", + KR(ret), "affect_all", arg.affect_all_, "affect_all_user", + arg.affect_all_user_, "affect_all_meta", arg.affect_all_meta_); + } else { + if (arg.affect_all_ || arg.affect_all_user_) { + param.need_all_user_ = true; + } else { + param.need_all_meta_ = true; + } + } } else if (OB_FAIL(param.tenant_array_.assign(arg.tenant_ids_))) { LOG_WARN("fail to assign tenant_ids", KR(ret), K(arg)); } @@ -575,8 +588,21 @@ int ObAdminMerge::execute(const obrpc::ObAdminMergeArg &arg) case ObAdminMergeArg::SUSPEND_MERGE: { ObTenantAdminMergeParam param; param.transport_ = GCTX.net_frame_->get_req_transport(); - if (arg.affect_all_) { - param.need_all_ = true; + if (arg.affect_all_ || arg.affect_all_user_ || arg.affect_all_meta_) { + if ((true == arg.affect_all_ && true == arg.affect_all_user_) || + (true == arg.affect_all_ && true == arg.affect_all_meta_) || + (true == arg.affect_all_user_ && true == arg.affect_all_meta_)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("only one of affect_all,affect_all_user,affect_all_meta can be true", + KR(ret), "affect_all", arg.affect_all_, "affect_all_user", + arg.affect_all_user_, "affect_all_meta", arg.affect_all_meta_); + } else { + if (arg.affect_all_ || arg.affect_all_user_) { + param.need_all_user_ = true; + } else { + param.need_all_meta_ = true; + } + } } else if (OB_FAIL(param.tenant_array_.assign(arg.tenant_ids_))) { LOG_WARN("fail to assign tenant_ids", KR(ret), K(arg)); } @@ -588,8 +614,21 @@ int ObAdminMerge::execute(const obrpc::ObAdminMergeArg &arg) case ObAdminMergeArg::RESUME_MERGE: { ObTenantAdminMergeParam param; param.transport_ = GCTX.net_frame_->get_req_transport(); - if (arg.affect_all_) { - param.need_all_ = true; + if (arg.affect_all_ || arg.affect_all_user_ || arg.affect_all_meta_) { + if ((true == arg.affect_all_ && true == arg.affect_all_user_) || + (true == arg.affect_all_ && true == arg.affect_all_meta_) || + (true == arg.affect_all_user_ && true == arg.affect_all_meta_)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("only one of affect_all,affect_all_user,affect_all_meta can be true", + KR(ret), "affect_all", arg.affect_all_, "affect_all_user", + arg.affect_all_user_, "affect_all_meta", arg.affect_all_meta_); + } else { + if (arg.affect_all_ || arg.affect_all_user_) { + param.need_all_user_ = true; + } else { + param.need_all_meta_ = true; + } + } } else if (OB_FAIL(param.tenant_array_.assign(arg.tenant_ids_))) { LOG_WARN("fail to assign tenant_ids", KR(ret), K(arg)); } @@ -760,6 +799,7 @@ int ObAdminSetConfig::verify_config(obrpc::ObAdminSetConfigArg &arg) ObConfigItem *ci = nullptr; if (OB_SYS_TENANT_ID != item->exec_tenant_id_ || item->tenant_name_.size() > 0) { // tenants(user or sys tenants) modify tenant level configuration + item->want_to_set_tenant_config_ = true; if (nullptr == tenant_cfg) { if (OB_ISNULL(cfg_ptr = ob_malloc(sizeof(ObTenantConfigChecker), ObModIds::OB_RS_PARTITION_TABLE_TEMP))) { @@ -782,15 +822,30 @@ int ObAdminSetConfig::verify_config(obrpc::ObAdminSetConfigArg &arg) share::schema::ObSchemaGetterGuard schema_guard; if (OB_FAIL(ctx_.ddl_service_->get_tenant_schema_guard_with_version_in_inner_table(OB_SYS_TENANT_ID, schema_guard))) { LOG_WARN("get_schema_guard failed", KR(ret)); - } else if (OB_SYS_TENANT_ID == item->exec_tenant_id_ - && item->tenant_name_ == ObFixedLengthString("all")) { + } else if (OB_SYS_TENANT_ID == item->exec_tenant_id_ && + (item->tenant_name_ == ObFixedLengthString("all") || + item->tenant_name_ == ObFixedLengthString("all_user"))) { common::ObArray tenant_ids; if (OB_FAIL(schema_guard.get_tenant_ids(tenant_ids))) { LOG_WARN("get_tenant_ids failed", KR(ret)); } else { for (const uint64_t tenant_id: tenant_ids) { - if (!is_virtual_tenant_id(tenant_id) - && OB_FAIL(item->tenant_ids_.push_back(tenant_id))) { + if (is_user_tenant(tenant_id) && + OB_FAIL(item->tenant_ids_.push_back(tenant_id))) { + LOG_WARN("add tenant_id failed", K(tenant_id), KR(ret)); + break; + } + } // for + } + } else if (OB_SYS_TENANT_ID == item->exec_tenant_id_ && + item->tenant_name_ == ObFixedLengthString("all_meta")) { + common::ObArray tenant_ids; + if (OB_FAIL(schema_guard.get_tenant_ids(tenant_ids))) { + LOG_WARN("get_tenant_ids failed", KR(ret)); + } else { + for (const uint64_t tenant_id: tenant_ids) { + if (is_meta_tenant(tenant_id) && + OB_FAIL(item->tenant_ids_.push_back(tenant_id))) { LOG_WARN("add tenant_id failed", K(tenant_id), KR(ret)); break; } @@ -853,6 +908,7 @@ int ObAdminSetConfig::verify_config(obrpc::ObAdminSetConfigArg &arg) ci = *sys_ci_ptr; } else if (OB_NOT_NULL(tenant_ci_ptr)) { ci = *tenant_ci_ptr; + item->want_to_set_tenant_config_ = true; if (OB_FAIL(item->tenant_ids_.push_back(OB_SYS_TENANT_ID))) { LOG_WARN("add tenant_id failed", KR(ret)); } @@ -959,7 +1015,7 @@ int ObAdminSetConfig::update_config(obrpc::ObAdminSetConfigArg &arg, int64_t new } if (OB_FAIL(ret)) { - } else if (item->tenant_ids_.size() > 0) { + } else if (item->tenant_ids_.size() > 0 || item->want_to_set_tenant_config_) { // tenant config ObDMLSqlSplicer dml; share::schema::ObSchemaGetterGuard schema_guard; diff --git a/src/share/ob_rpc_struct.cpp b/src/share/ob_rpc_struct.cpp index bbf5c231a..e608e33b4 100755 --- a/src/share/ob_rpc_struct.cpp +++ b/src/share/ob_rpc_struct.cpp @@ -4602,6 +4602,8 @@ int ObAdminMergeArg::assign(const ObAdminMergeArg &other) if (this != &other) { type_ = other.type_; affect_all_ = other.affect_all_; + affect_all_user_ = other.affect_all_user_; + affect_all_meta_ = other.affect_all_meta_; if (OB_FAIL(tenant_ids_.assign(other.tenant_ids_))) { LOG_WARN("fail to assign tenant_ids", KR(ret), K(other)); } @@ -4611,7 +4613,7 @@ int ObAdminMergeArg::assign(const ObAdminMergeArg &other) } OB_SERIALIZE_MEMBER(ObAdminMergeArg, - type_, affect_all_, tenant_ids_); + type_, affect_all_, tenant_ids_, affect_all_user_, affect_all_meta_); bool ObAdminRecoveryArg::is_valid() const { @@ -4624,7 +4626,8 @@ OB_SERIALIZE_MEMBER(ObAdminClearRoottableArg, tenant_name_); OB_SERIALIZE_MEMBER(ObAdminSetConfigItem, - name_, value_, comment_, zone_, server_, tenant_name_, exec_tenant_id_, tenant_ids_); + name_, value_, comment_, zone_, server_, tenant_name_, exec_tenant_id_, tenant_ids_, + want_to_set_tenant_config_); OB_SERIALIZE_MEMBER(ObAdminSetConfigArg, items_, is_inner_, is_backup_config_); diff --git a/src/share/ob_rpc_struct.h b/src/share/ob_rpc_struct.h index a09397bff..1e3238143 100755 --- a/src/share/ob_rpc_struct.h +++ b/src/share/ob_rpc_struct.h @@ -5317,15 +5317,18 @@ public: }; ObAdminMergeArg() - : type_(START_MERGE), affect_all_(false), tenant_ids_() {} + : type_(START_MERGE), affect_all_(false), tenant_ids_(), affect_all_user_(false), + affect_all_meta_(false) {} bool is_valid() const; - TO_STRING_KV(K_(type), K_(affect_all), K_(tenant_ids)); + TO_STRING_KV(K_(type), K_(affect_all), K_(tenant_ids), K_(affect_all_user), K_(affect_all_meta)); int assign(const ObAdminMergeArg &other); Type type_; - bool affect_all_; + bool affect_all_; // the reason affect_all_ is not removed is for RPC compatibility common::ObSArray tenant_ids_; + bool affect_all_user_; + bool affect_all_meta_; }; class ObAdminRecoveryArg @@ -5366,9 +5369,10 @@ struct ObAdminSetConfigItem OB_UNIS_VERSION(1); public: ObAdminSetConfigItem() : name_(), value_(), comment_(), zone_(), server_(), tenant_name_(), - exec_tenant_id_(common::OB_SYS_TENANT_ID), tenant_ids_() {} + exec_tenant_id_(common::OB_SYS_TENANT_ID), tenant_ids_(), + want_to_set_tenant_config_(false) {} TO_STRING_KV(K_(name), K_(value), K_(comment), K_(zone), K_(server), K_(tenant_name), - K_(exec_tenant_id), K_(tenant_ids)); + K_(exec_tenant_id), K_(tenant_ids), K_(want_to_set_tenant_config)); common::ObFixedLengthString name_; common::ObFixedLengthString value_; @@ -5378,6 +5382,7 @@ public: common::ObFixedLengthString tenant_name_; uint64_t exec_tenant_id_; common::ObSArray tenant_ids_; + bool want_to_set_tenant_config_; }; struct ObAdminSetConfigArg diff --git a/src/sql/engine/cmd/ob_alter_system_executor.cpp b/src/sql/engine/cmd/ob_alter_system_executor.cpp index 2b1a15ef4..4ed382839 100644 --- a/src/sql/engine/cmd/ob_alter_system_executor.cpp +++ b/src/sql/engine/cmd/ob_alter_system_executor.cpp @@ -72,7 +72,7 @@ int ObFreezeExecutor::execute(ObExecContext &ctx, ObFreezeStmt &stmt) } else { if (!stmt.is_major_freeze()) { const uint64_t local_tenant_id = MTL_ID(); - bool freeze_all = stmt.is_freeze_all(); + bool freeze_all = (stmt.is_freeze_all_user() || stmt.is_freeze_all_meta()); ObRootMinorFreezeArg arg; if (OB_FAIL(arg.tenant_ids_.assign(stmt.get_tenant_ids()))) { LOG_WARN("failed to assign tenant_ids", K(ret)); @@ -89,8 +89,33 @@ int ObFreezeExecutor::execute(ObExecContext &ctx, ObFreezeStmt &stmt) if (OB_ISNULL(GCTX.schema_service_)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid GCTX", KR(ret)); - } else if (OB_FAIL(GCTX.schema_service_->get_tenant_ids(arg.tenant_ids_))) { - LOG_WARN("fail to get all tenant ids", KR(ret)); + } else if (stmt.is_freeze_all_user() == stmt.is_freeze_all_meta()) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("freeze_all_user and freeze_all_meta cannot be true together", + KR(ret), "freeze_all_user", stmt.is_freeze_all_user(), + "freeze_all_meta", stmt.is_freeze_all_meta()); + } else { + common::ObSArray tmp_tenant_ids; + if (OB_FAIL(GCTX.schema_service_->get_tenant_ids(tmp_tenant_ids))) { + LOG_WARN("fail to get all tenant ids", KR(ret)); + } else { + using FUNC_TYPE = bool (*) (const uint64_t); + FUNC_TYPE func = nullptr; + if (stmt.is_freeze_all_user()) { + func = is_user_tenant; + } else { + func = is_meta_tenant; + } + arg.tenant_ids_.reset(); + for (int64_t i = 0; OB_SUCC(ret) && (i < tmp_tenant_ids.count()); ++i) { + uint64_t tmp_tenant_id = tmp_tenant_ids.at(i); + if (func(tmp_tenant_id)) { + if (OB_FAIL(arg.tenant_ids_.push_back(tmp_tenant_id))) { + LOG_WARN("failed to push back tenant_id", KR(ret)); + } + } + } + } } // get local tenant to freeze if there is no any parameter except server_list } else if (arg.tenant_ids_.empty() && @@ -130,7 +155,8 @@ int ObFreezeExecutor::execute(ObExecContext &ctx, ObFreezeStmt &stmt) } } else { rootserver::ObMajorFreezeParam param; - param.freeze_all_ = stmt.is_freeze_all(); + param.freeze_all_user_ = stmt.is_freeze_all_user(); + param.freeze_all_meta_ = stmt.is_freeze_all_meta(); param.transport_ = GCTX.net_frame_->get_req_transport(); for (int64_t i = 0; (i < stmt.get_tenant_ids().count()) && OB_SUCC(ret); ++i) { uint64_t tenant_id = stmt.get_tenant_ids().at(i); diff --git a/src/sql/parser/non_reserved_keywords_mysql_mode.c b/src/sql/parser/non_reserved_keywords_mysql_mode.c index f83de2f36..46e30d1ce 100644 --- a/src/sql/parser/non_reserved_keywords_mysql_mode.c +++ b/src/sql/parser/non_reserved_keywords_mysql_mode.c @@ -37,6 +37,8 @@ static const NonReservedKeyword Mysql_none_reserved_keywords[] = {"aggregate", AGGREGATE}, {"algorithm", ALGORITHM}, {"all", ALL}, + {"all_meta", ALL_META}, + {"all_user", ALL_USER}, {"alter", ALTER}, {"always", ALWAYS}, {"analyse", ANALYSE}, diff --git a/src/sql/parser/sql_parser_mysql_mode.y b/src/sql/parser/sql_parser_mysql_mode.y index 7c434b231..3931a4a9f 100755 --- a/src/sql/parser/sql_parser_mysql_mode.y +++ b/src/sql/parser/sql_parser_mysql_mode.y @@ -248,7 +248,7 @@ END_P SET_VAR DELIMITER TABLEGROUP %token - ACCESS ACCOUNT ACTION ACTIVE ADDDATE AFTER AGAINST AGGREGATE ALGORITHM ALWAYS ANALYSE ANY + ACCESS ACCOUNT ACTION ACTIVE ADDDATE AFTER AGAINST AGGREGATE ALGORITHM ALL_META ALL_USER ALWAYS ANALYSE ANY APPROX_COUNT_DISTINCT APPROX_COUNT_DISTINCT_SYNOPSIS APPROX_COUNT_DISTINCT_SYNOPSIS_MERGE ARBITRATION ASCII AT AUTHORS AUTO AUTOEXTEND_SIZE AUTO_INCREMENT AUTO_INCREMENT_MODE AVG AVG_ROW_LENGTH ACTIVATE AVAILABILITY ARCHIVELOG AUDIT @@ -17883,6 +17883,8 @@ ACCOUNT | AGAINST | AGGREGATE | ALGORITHM +| ALL_META +| ALL_USER | ALWAYS | ANALYSE | ANY diff --git a/src/sql/resolver/cmd/ob_alter_system_resolver.cpp b/src/sql/resolver/cmd/ob_alter_system_resolver.cpp index 418927e15..8b9a45207 100644 --- a/src/sql/resolver/cmd/ob_alter_system_resolver.cpp +++ b/src/sql/resolver/cmd/ob_alter_system_resolver.cpp @@ -354,7 +354,9 @@ int ObAlterSystemResolverUtil::resolve_tenant( const ParseNode &tenants_node, const uint64_t tenant_id, common::ObSArray &tenant_ids, - bool &affect_all) + bool &affect_all, + bool &affect_all_user, + bool &affect_all_meta) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; @@ -379,6 +381,8 @@ int ObAlterSystemResolverUtil::resolve_tenant( ObString tenant_name; uint64_t tmp_tenant_id = 0; affect_all = false; + affect_all_user = false; + affect_all_meta = false; for (int64_t i = 0; OB_SUCC(ret) && (i < tenants_node.num_child_); ++i) { ParseNode *node = tenants_node.children_[i]; @@ -392,8 +396,12 @@ int ObAlterSystemResolverUtil::resolve_tenant( if (tenant_name.empty()) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", KR(ret)); - } else if (!strcasecmp(tenant_name.ptr(), "all")) { + } else if (0 == strcasecmp(tenant_name.ptr(), "all")) { affect_all = true; + } else if (0 == strcasecmp(tenant_name.ptr(), "all_user")) { + affect_all_user = true; + } else if (0 == strcasecmp(tenant_name.ptr(), "all_meta")) { + affect_all_meta = true; } else if (OB_FAIL(schema_guard.get_tenant_id(tenant_name, tmp_tenant_id))) { LOG_WARN("tenant not exist", K(tenant_name), KR(ret)); } else { @@ -423,17 +431,20 @@ int ObAlterSystemResolverUtil::resolve_tenant( tenant_name.reset(); } - if (OB_SUCC(ret) && affect_all) { + if (OB_SUCC(ret) && (affect_all || affect_all_user || affect_all_meta)) { if (OB_SYS_TENANT_ID != tenant_id) { ret = OB_ERR_NO_PRIVILEGE; LOG_WARN("Only sys tenant can operate all tenants", KR(ret), K(tenant_id)); } else if (tenants_node.num_child_ > 1) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("use 'tenant = all' syntax to affect all tenants", KR(ret), "tenant list count", - tenants_node.num_child_); + ret = OB_NOT_SUPPORTED; + LOG_WARN("all/all_user/all_meta must be used separately", + KR(ret), "tenant list count", tenants_node.num_child_); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "all/all_user/all_meta in combination with other names is"); } } - FLOG_INFO("resolve tenants", K(affect_all), K(tenant_ids)); + FLOG_INFO("resolve tenants", K(affect_all), K(affect_all_user), + K(affect_all_meta), K(tenant_ids)); } return ret; } @@ -520,10 +531,27 @@ int ObFreezeResolver::resolve_major_freeze_(ObFreezeStmt *freeze_stmt, ParseNode LOG_WARN("children of tenant should not be null", KR(ret)); } else { bool affect_all = false; - if (OB_FAIL(Util::resolve_tenant(*opt_tenant_list_v2, cur_tenant_id, freeze_stmt->get_tenant_ids(), affect_all))) { + bool affect_all_user = false; + bool affect_all_meta = false; + if (OB_FAIL(Util::resolve_tenant(*opt_tenant_list_v2, cur_tenant_id, + freeze_stmt->get_tenant_ids(), affect_all, affect_all_user, affect_all_meta))) { LOG_WARN("fail to resolve tenant", KR(ret)); - } else if (affect_all) { - freeze_stmt->set_freeze_all(affect_all); + } else if (affect_all || affect_all_user || affect_all_meta) { + if ((true == affect_all && true == affect_all_user) || + (true == affect_all && true == affect_all_meta) || + (true == affect_all_user && true == affect_all_meta)) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("only one of affect_all,affect_all_user,affect_all_meta can be true", + KR(ret), K(affect_all), K(affect_all_user), K(affect_all_meta)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "all/all_user/all_meta in combination with other names is"); + } else { + if (affect_all || affect_all_user) { + freeze_stmt->set_freeze_all_user(); + } else { + freeze_stmt->set_freeze_all_meta(); + } + } } } } else { @@ -569,6 +597,8 @@ int ObFreezeResolver::resolve_tenant_ls_tablet_(ObFreezeStmt *freeze_stmt, LOG_WARN("children of tenant should not be null", KR(ret)); } else { bool affect_all = false; + bool affect_all_user = false; + bool affect_all_meta = false; const ParseNode *tenant_list_tuple = nullptr; const ParseNode *opt_tablet_id = nullptr; const ParseNode *ls_id = nullptr; @@ -609,16 +639,31 @@ int ObFreezeResolver::resolve_tenant_ls_tablet_(ObFreezeStmt *freeze_stmt, if (OB_FAIL(ret)) { } else if (OB_NOT_NULL(tenant_list_tuple) && - OB_FAIL(Util::resolve_tenant( - *tenant_list_tuple, cur_tenant_id, freeze_stmt->get_tenant_ids(), affect_all))) { + OB_FAIL(Util::resolve_tenant(*tenant_list_tuple, cur_tenant_id, + freeze_stmt->get_tenant_ids(), + affect_all, affect_all_user, affect_all_meta))) { LOG_WARN("fail to resolve tenant", KR(ret)); } else if (OB_NOT_NULL(ls_id) && OB_FAIL(Util::resolve_ls_id(ls_id, freeze_stmt->get_ls_id()))) { LOG_WARN("fail to resolve tablet id", KR(ret)); } else if (OB_NOT_NULL(opt_tablet_id) && OB_FAIL(Util::resolve_tablet_id(opt_tablet_id, freeze_stmt->get_tablet_id()))) { LOG_WARN("fail to resolve tablet id", KR(ret)); - } else if (affect_all) { - freeze_stmt->set_freeze_all(affect_all); + } else if (affect_all || affect_all_user || affect_all_meta) { + if ((true == affect_all && true == affect_all_user) || + (true == affect_all && true == affect_all_meta) || + (true == affect_all_user && true == affect_all_meta)) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("only one of affect_all,affect_all_user,affect_all_meta can be true", + KR(ret), K(affect_all), K(affect_all_user), K(affect_all_meta)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "all/all_user/all_meta in combination with other names is"); + } else { + if (affect_all || affect_all_user) { + freeze_stmt->set_freeze_all_user(); + } else { + freeze_stmt->set_freeze_all_meta(); + } + } } } @@ -1477,15 +1522,33 @@ int ObAdminMergeResolver::resolve(const ParseNode &parse_tree) LOG_WARN("type is not T_TENANT_LIST", "type", get_type_name(tenants_node->type_)); } else { bool affect_all = false; + bool affect_all_user = false; + bool affect_all_meta = false; const int64_t child_num = tenants_node->num_child_; if (OB_UNLIKELY(nullptr == tenants_node->children_) || OB_UNLIKELY(0 == child_num)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("children of tenant should not be null", KR(ret), K(child_num)); - } else if (OB_FAIL(Util::resolve_tenant(*tenants_node, cur_tenant_id, stmt->get_rpc_arg().tenant_ids_, affect_all))) { + } else if (OB_FAIL(Util::resolve_tenant(*tenants_node, cur_tenant_id, + stmt->get_rpc_arg().tenant_ids_, affect_all, + affect_all_user, affect_all_meta))) { LOG_WARN("fail to resolve tenant", KR(ret), K(cur_tenant_id)); - } else if (affect_all) { - stmt->get_rpc_arg().affect_all_ = true; + } else if (affect_all || affect_all_user || affect_all_meta) { + if ((true == affect_all && true == affect_all_user) || + (true == affect_all && true == affect_all_meta) || + (true == affect_all_user && true == affect_all_meta)) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("only one of affect_all,affect_all_user,affect_all_meta can be true", + KR(ret), K(affect_all), K(affect_all_user), K(affect_all_meta)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "all/all_user/all_meta in combination with other names is"); + } else { + if (affect_all || affect_all_user) { + stmt->get_rpc_arg().affect_all_user_ = true; + } else { + stmt->get_rpc_arg().affect_all_meta_ = true; + } + } } } } else { @@ -2396,15 +2459,33 @@ int ObClearMergeErrorResolver::resolve(const ParseNode &parse_tree) LOG_WARN("type is not T_TENANT_LIST", "type", get_type_name(tenants_node->type_)); } else { bool affect_all = false; + bool affect_all_user = false; + bool affect_all_meta = false; const int64_t child_num = tenants_node->num_child_; if (OB_UNLIKELY(nullptr == tenants_node->children_) || OB_UNLIKELY(0 == child_num)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("children of tenant should not be null", KR(ret), K(child_num)); - } else if (OB_FAIL(Util::resolve_tenant(*tenants_node, cur_tenant_id, stmt->get_rpc_arg().tenant_ids_, affect_all))) { + } else if (OB_FAIL(Util::resolve_tenant(*tenants_node, cur_tenant_id, + stmt->get_rpc_arg().tenant_ids_, affect_all, + affect_all_user, affect_all_meta))) { LOG_WARN("fail to resolve tenant", KR(ret), K(cur_tenant_id)); - } else if (affect_all) { - stmt->get_rpc_arg().affect_all_ = true; + } else if (affect_all || affect_all_user || affect_all_meta) { + if ((true == affect_all && true == affect_all_user) || + (true == affect_all && true == affect_all_meta) || + (true == affect_all_user && true == affect_all_meta)) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("only one of affect_all,affect_all_user,affect_all_meta can be true", + KR(ret), K(affect_all), K(affect_all_user), K(affect_all_meta)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "all/all_user/all_meta in combination with other names is"); + } else { + if (affect_all || affect_all_user) { + stmt->get_rpc_arg().affect_all_user_ = true; + } else { + stmt->get_rpc_arg().affect_all_meta_ = true; + } + } } } } else { @@ -2664,7 +2745,13 @@ int ObPhysicalRestoreTenantResolver::resolve(const ParseNode &parse_tree) stmt->get_rpc_arg().tenant_name_))) { LOG_WARN("resolve tenant_name failed", K(ret)); } else { - if (OB_NOT_NULL(parse_tree.children_[1])) { + const ObString &tenant_name = stmt->get_rpc_arg().tenant_name_; + if (OB_FAIL(ObResolverUtils::check_not_supported_tenant_name(tenant_name))) { + LOG_WARN("since 4.2.1, naming a tenant as all/all_user/all_meta is not supported", + KR(ret), K(tenant_name)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "since 4.2.1, naming a tenant as all/all_user/all_meta is"); + } else if (OB_NOT_NULL(parse_tree.children_[1])) { if (session_info_->user_variable_exists(OB_RESTORE_SOURCE_NAME_SESSION_STR)) { ret = OB_NOT_SUPPORTED; LOG_WARN("invalid sql syntax", KR(ret)); @@ -2989,6 +3076,8 @@ int ObRunUpgradeJobResolver::resolve(const ParseNode &parse_tree) && OB_NOT_NULL(parse_tree.children_[1])) { ParseNode *tenants_node = parse_tree.children_[1]; bool affect_all = false; + bool affect_all_user = false; + bool affect_all_meta = false; const int64_t child_num = tenants_node->num_child_; const uint64_t cur_tenant_id = session_info_->get_effective_tenant_id(); ObSArray &tenant_ids = stmt->get_rpc_arg().tenant_ids_; @@ -3000,9 +3089,15 @@ int ObRunUpgradeJobResolver::resolve(const ParseNode &parse_tree) || OB_UNLIKELY(0 == child_num)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("children of tenant should not be null", KR(ret), K(child_num)); - } else if (OB_FAIL(Util::resolve_tenant( - *tenants_node, cur_tenant_id, tenant_ids, affect_all))) { + } else if (OB_FAIL(Util::resolve_tenant(*tenants_node, cur_tenant_id, tenant_ids, + affect_all, affect_all_user, affect_all_meta))) { LOG_WARN("fail to resolve tenant", KR(ret), K(cur_tenant_id)); + } else if (affect_all_user || affect_all_meta) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("all_user/all_meta is not supported by ALTER SYSTEM RUN UPGRADE JOB", + KR(ret), K(affect_all_user), K(affect_all_meta)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "use all_user/all_meta in 'ALTER SYSTEM RUN UPGRADE JOB' syntax is"); } else if (affect_all && 0 != tenant_ids.count()) { ret = OB_ERR_UNEXPECTED; LOG_WARN("tenant_ids should be empty when specify tenant = all", KR(ret)); @@ -4003,13 +4098,22 @@ int ObArchiveLogResolver::resolve(const ParseNode &parse_tree) LOG_WARN("type is not T_TENANT_LIST", "type", get_type_name(t_node->type_)); } else { bool affect_all = false; + bool affect_all_user = false; + bool affect_all_meta = false; const int64_t child_num = t_node->num_child_; if (OB_UNLIKELY(nullptr == t_node->children_) || OB_UNLIKELY(0 == child_num)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("children of tenant should not be null", KR(ret), K(child_num)); - } else if (OB_FAIL(Util::resolve_tenant(*t_node, tenant_id, archive_tenant_ids, affect_all))) { + } else if (OB_FAIL(Util::resolve_tenant(*t_node, tenant_id, archive_tenant_ids, + affect_all, affect_all_user, affect_all_meta))) { LOG_WARN("fail to resolve tenant", KR(ret), K(tenant_id)); + } else if (affect_all_user || affect_all_meta) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("all_user/all_meta is not supported by ALTER SYSTEM ARCHIVELOG", + KR(ret), K(affect_all_user), K(affect_all_meta)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "use all_user/all_meta in 'ALTER SYSTEM ARCHIVELOG' syntax is"); } else if (affect_all) { } else if (archive_tenant_ids.empty()) { ret = OB_NOT_SUPPORTED; diff --git a/src/sql/resolver/cmd/ob_alter_system_resolver.h b/src/sql/resolver/cmd/ob_alter_system_resolver.h index 412f9cf89..c81332b42 100644 --- a/src/sql/resolver/cmd/ob_alter_system_resolver.h +++ b/src/sql/resolver/cmd/ob_alter_system_resolver.h @@ -62,7 +62,9 @@ public: static int resolve_tenant(const ParseNode &tenants_node, const uint64_t tenant_id, common::ObSArray &tenant_ids, - bool &affect_all); + bool &affect_all, + bool &affect_all_user, + bool &affect_all_meta); }; #define DEF_SIMPLE_CMD_RESOLVER(name) \ diff --git a/src/sql/resolver/cmd/ob_alter_system_stmt.h b/src/sql/resolver/cmd/ob_alter_system_stmt.h index 1eca5b452..7a3586cb6 100644 --- a/src/sql/resolver/cmd/ob_alter_system_stmt.h +++ b/src/sql/resolver/cmd/ob_alter_system_stmt.h @@ -22,13 +22,18 @@ namespace oceanbase { namespace sql { +enum FreezeAllUserOrMeta { + FREEZE_ALL_USER = 0x01, + FREEZE_ALL_META = 0x02 +}; + class ObFreezeStmt : public ObSystemCmdStmt { public: ObFreezeStmt() : ObSystemCmdStmt(stmt::T_FREEZE), major_freeze_(false), - freeze_all_(false), + freeze_all_flag_(0), opt_server_list_(), opt_tenant_ids_(), opt_tablet_id_(), @@ -36,6 +41,7 @@ public: ObFreezeStmt(common::ObIAllocator *name_pool) : ObSystemCmdStmt(name_pool, stmt::T_FREEZE), major_freeze_(false), + freeze_all_flag_(0), opt_server_list_(), opt_tenant_ids_(), opt_tablet_id_(), @@ -44,8 +50,10 @@ public: bool is_major_freeze() const { return major_freeze_; } void set_major_freeze(bool major_freeze) { major_freeze_ = major_freeze; } - bool is_freeze_all() const { return freeze_all_; } - void set_freeze_all(bool freeze_all) { freeze_all_ = freeze_all; } + bool is_freeze_all_user() const { return 0 != (freeze_all_flag_ & FREEZE_ALL_USER); } + void set_freeze_all_user() { freeze_all_flag_ |= FREEZE_ALL_USER; } + bool is_freeze_all_meta() const { return 0 != (freeze_all_flag_ & FREEZE_ALL_META); } + void set_freeze_all_meta() { freeze_all_flag_ |= FREEZE_ALL_META; } inline obrpc::ObServerList &get_ignore_server_list() { return opt_server_list_; } inline obrpc::ObServerList &get_server_list() { return opt_server_list_; } inline common::ObSArray &get_tenant_ids() { return opt_tenant_ids_; } @@ -56,13 +64,13 @@ public: return opt_server_list_.push_back(server); } - TO_STRING_KV(N_STMT_TYPE, ((int)stmt_type_), K_(major_freeze), + TO_STRING_KV(N_STMT_TYPE, ((int)stmt_type_), K_(major_freeze), K(freeze_all_flag_), K(opt_server_list_), K(opt_tenant_ids_), K(opt_tablet_id_), K(opt_ls_id_)); private: bool major_freeze_; // for major_freeze, it is ignore server list // for minor_freeze, it is candidate server list - bool freeze_all_; + int freeze_all_flag_; // for major_freeze only obrpc::ObServerList opt_server_list_; // for minor_freeze only, diff --git a/src/sql/resolver/ddl/ob_create_standby_tenant_resolver.cpp b/src/sql/resolver/ddl/ob_create_standby_tenant_resolver.cpp index 337172a04..16b77bc42 100644 --- a/src/sql/resolver/ddl/ob_create_standby_tenant_resolver.cpp +++ b/src/sql/resolver/ddl/ob_create_standby_tenant_resolver.cpp @@ -80,6 +80,14 @@ int ObCreateStandbyTenantResolver::resolve(const ParseNode &parse_tree) ObTenantResolver resolver; if (OB_FAIL(resolver.resolve_tenant_name(mystmt, parse_tree.children_[1]))) { LOG_WARN("resolve tenant name failed", KR(ret)); + } else { + const ObString &tenant_name = mystmt->get_create_tenant_arg().tenant_schema_.get_tenant_name_str(); + if (OB_FAIL(ObResolverUtils::check_not_supported_tenant_name(tenant_name))) { + LOG_WARN("since 4.2.1, naming a tenant as all/all_user/all_meta is not supported", + KR(ret), K(tenant_name)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "since 4.2.1, naming a tenant as all/all_user/all_meta is"); + } } } diff --git a/src/sql/resolver/ddl/ob_create_tenant_resolver.cpp b/src/sql/resolver/ddl/ob_create_tenant_resolver.cpp index a883e6ecf..6a17253de 100644 --- a/src/sql/resolver/ddl/ob_create_tenant_resolver.cpp +++ b/src/sql/resolver/ddl/ob_create_tenant_resolver.cpp @@ -81,6 +81,14 @@ int ObCreateTenantResolver::resolve(const ParseNode &parse_tree) ObTenantResolver resolver; if (OB_FAIL(resolver.resolve_tenant_name(mystmt, parse_tree.children_[1]))) { LOG_WARN("resolve tenant name failed", KR(ret)); + } else { + const ObString &tenant_name = mystmt->get_create_tenant_arg().tenant_schema_.get_tenant_name_str(); + if (OB_FAIL(ObResolverUtils::check_not_supported_tenant_name(tenant_name))) { + LOG_WARN("since 4.2.1, naming a tenant as all/all_user/all_meta is not supported", + KR(ret), K(tenant_name)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "since 4.2.1, naming a tenant as all/all_user/all_meta is"); + } } } diff --git a/src/sql/resolver/ddl/ob_flashback_resolver.cpp b/src/sql/resolver/ddl/ob_flashback_resolver.cpp index b9430a720..2efad8abc 100644 --- a/src/sql/resolver/ddl/ob_flashback_resolver.cpp +++ b/src/sql/resolver/ddl/ob_flashback_resolver.cpp @@ -398,7 +398,14 @@ int ObFlashBackTenantResolver::resolve(const ParseNode &parser_tree) } else { new_tenant_name.assign_ptr(new_tenant_node->str_value_, static_cast(new_tenant_node->str_len_)); - flashback_tenant_stmt->set_new_tenant_name(new_tenant_name); + if (OB_FAIL(ObResolverUtils::check_not_supported_tenant_name(new_tenant_name))) { + LOG_WARN("since 4.2.1, renaming a tenant to all/all_user/all_meta is not supported", + KR(ret), K(new_tenant_name)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "since 4.2.1, renaming a tenant to all/all_user/all_meta is"); + } else { + flashback_tenant_stmt->set_new_tenant_name(new_tenant_name); + } } } } diff --git a/src/sql/resolver/ddl/ob_modify_tenant_resolver.cpp b/src/sql/resolver/ddl/ob_modify_tenant_resolver.cpp index 17aafd592..55768a23f 100644 --- a/src/sql/resolver/ddl/ob_modify_tenant_resolver.cpp +++ b/src/sql/resolver/ddl/ob_modify_tenant_resolver.cpp @@ -160,6 +160,12 @@ int ObModifyTenantResolver::resolve(const ParseNode &parse_tree) new_tenant_name.assign_ptr( (char *)(parse_tree.children_[3]->str_value_), static_cast(parse_tree.children_[3]->str_len_)); + if (OB_FAIL(ObResolverUtils::check_not_supported_tenant_name(new_tenant_name))) { + LOG_WARN("since 4.2.1, renaming a tenant to all/all_user/all_meta is not supported", + KR(ret), K(new_tenant_name)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, + "since 4.2.1, renaming a tenant to all/all_user/all_meta is"); + } } } else { new_tenant_name.reset(); diff --git a/src/sql/resolver/ob_resolver_utils.cpp b/src/sql/resolver/ob_resolver_utils.cpp index fb6738c67..273a5a22e 100644 --- a/src/sql/resolver/ob_resolver_utils.cpp +++ b/src/sql/resolver/ob_resolver_utils.cpp @@ -8050,6 +8050,17 @@ int ObResolverUtils::check_encryption_name(ObString &encryption_name, bool &need return ret; } +int ObResolverUtils::check_not_supported_tenant_name(const ObString &tenant_name) +{ + int ret = OB_SUCCESS; + if (0 == tenant_name.case_compare("all") || + 0 == tenant_name.case_compare("all_user") || + 0 == tenant_name.case_compare("all_meta")) { + ret = OB_NOT_SUPPORTED; + } + return ret; +} + int ObResolverUtils::rm_space_for_neg_num(ParseNode *param_node, ObIAllocator &allocator) { int ret = OB_SUCCESS; diff --git a/src/sql/resolver/ob_resolver_utils.h b/src/sql/resolver/ob_resolver_utils.h index d88c68336..5778e8e6d 100644 --- a/src/sql/resolver/ob_resolver_utils.h +++ b/src/sql/resolver/ob_resolver_utils.h @@ -768,6 +768,7 @@ public: bool &is_param); static int check_keystore_status(const uint64_t tenant_id, ObSchemaChecker &schema_checker); static int check_encryption_name(common::ObString &encryption_name, bool &need_encrypt); + static int check_not_supported_tenant_name(const common::ObString &tenant_name); private: static int try_convert_to_unsiged(const ObExprResType restype, ObRawExpr& src_expr, diff --git a/tools/deploy/init_for_ce.sql b/tools/deploy/init_for_ce.sql index d8c49682a..bfb24454e 100644 --- a/tools/deploy/init_for_ce.sql +++ b/tools/deploy/init_for_ce.sql @@ -17,6 +17,10 @@ source init_create_tenant_routines.sql; call adjust_sys_resource(); call create_tenant_by_memory_resource('mysql', 'mysql'); +/****************************** ATTENTION ******************************/ +/* The tenant=all will be deprecated. If you want all tenants to be */ +/* modified, use tenant=sys & tenant=all_user & tenant=all_meta. */ +/***********************************************************************/ set @@session.ob_query_timeout = 10000000; system sleep 5; alter tenant sys set variables recyclebin = 'on'; @@ -24,10 +28,18 @@ alter tenant sys set variables ob_enable_truncate_flashback = 'on'; alter tenant mysql set variables ob_tcp_invited_nodes='%'; alter tenant mysql set variables recyclebin = 'on'; alter tenant mysql set variables ob_enable_truncate_flashback = 'on'; -alter system set ob_compaction_schedule_interval = '10s' tenant all; -alter system set merger_check_interval = '10s' tenant all; -alter system set enable_sql_extension=true tenant all; -alter system set _enable_adaptive_compaction = false tenant all; +alter system set ob_compaction_schedule_interval = '10s' tenant sys; +alter system set ob_compaction_schedule_interval = '10s' tenant all_user; +alter system set ob_compaction_schedule_interval = '10s' tenant all_meta; +alter system set merger_check_interval = '10s' tenant sys; +alter system set merger_check_interval = '10s' tenant all_user; +alter system set merger_check_interval = '10s' tenant all_meta; +alter system set enable_sql_extension=true tenant sys; +alter system set enable_sql_extension=true tenant all_user; +alter system set enable_sql_extension=true tenant all_meta; +alter system set _enable_adaptive_compaction = false tenant sys; +alter system set _enable_adaptive_compaction = false tenant all_user; +alter system set _enable_adaptive_compaction = false tenant all_meta; alter system set_tp tp_no = 1200, error_code = 4001, frequency = 1; alter system set_tp tp_no = 509, error_code = 4016, frequency = 1; alter system set_tp tp_no = 368, error_code = 4016, frequency = 1; diff --git a/tools/deploy/mysql_test/include/index_quick_major.inc b/tools/deploy/mysql_test/include/index_quick_major.inc index 1c1fa8ce7..9a00c0441 100644 --- a/tools/deploy/mysql_test/include/index_quick_major.inc +++ b/tools/deploy/mysql_test/include/index_quick_major.inc @@ -1,6 +1,8 @@ connect (obsys_idm,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT); connection obsys_idm; set ob_enable_index_direct_select=1; -alter system set merger_check_interval = '10s' tenant all; +alter system set merger_check_interval = '10s' tenant sys; +alter system set merger_check_interval = '10s' tenant all_user; +alter system set merger_check_interval = '10s' tenant all_meta; disconnect obsys_idm; connection default; diff --git a/tools/upgrade/actions.py b/tools/upgrade/actions.py index 3026a5ffd..848c9bb80 100755 --- a/tools/upgrade/actions.py +++ b/tools/upgrade/actions.py @@ -105,6 +105,22 @@ def check_is_update_sql(sql): and word_list[1].lower().startswith('@') and ':=' == word_list[2].lower()): raise MyError('sql must be update, key_word="{0}", sql="{1}"'.format(key_word, sql)) +def get_min_cluster_version(cur): + min_cluster_version = 0 + sql = """select distinct value from oceanbase.GV$OB_PARAMETERS where name='min_observer_version'""" + logging.info(sql) + cur.execute(sql) + results = cur.fetchall() + if len(results) != 1: + logging.exception('min_observer_version is not sync') + raise e + elif len(results[0]) != 1: + logging.exception('column cnt not match') + raise e + else: + min_cluster_version = get_version(results[0][0]) + return min_cluster_version + def set_parameter(cur, parameter, value, timeout = 0): sql = """alter system set {0} = '{1}'""".format(parameter, value) logging.info(sql) @@ -112,9 +128,15 @@ def set_parameter(cur, parameter, value, timeout = 0): wait_parameter_sync(cur, False, parameter, value, timeout) def set_tenant_parameter(cur, parameter, value, timeout = 0): - sql = """alter system set {0} = '{1}' tenant = 'all'""".format(parameter, value) - logging.info(sql) - cur.execute(sql) + tenants_list = [] + if get_min_cluster_version(cur) < get_version("4.2.1.0"): + tenants_list = ['all'] + else: + tenants_list = ['sys', 'all_user', 'all_meta'] + for tenants in tenants_list: + sql = """alter system set {0} = '{1}' tenant = '{2}'""".format(parameter, value, tenants) + logging.info(sql) + cur.execute(sql) wait_parameter_sync(cur, True, parameter, value, timeout) def get_ori_enable_ddl(cur, timeout): @@ -289,14 +311,26 @@ def do_end_upgrade(cur, timeout): wait_parameter_sync(cur, False, "enable_upgrade_mode", "False", timeout) def do_suspend_merge(cur, timeout): - action_sql = "alter system suspend merge tenant = all" - rollback_sql = "alter system resume merge tenant = all" + tenants_list = [] + if get_min_cluster_version(cur) < get_version("4.2.1.0"): + tenants_list = ['all'] + else: + tenants_list = ['sys', 'all_user', 'all_meta'] + for tenants in tenants_list: + action_sql = "alter system suspend merge tenant = {0}".format(tenants) + rollback_sql = "alter system resume merge tenant = {0}".format(tenants) logging.info(action_sql) cur.execute(action_sql) def do_resume_merge(cur, timeout): - action_sql = "alter system resume merge tenant = all" - rollback_sql = "alter system suspend merge tenant = all" + tenants_list = [] + if get_min_cluster_version(cur) < get_version("4.2.1.0"): + tenants_list = ['all'] + else: + tenants_list = ['sys', 'all_user', 'all_meta'] + for tenants in tenants_list: + action_sql = "alter system resume merge tenant = {0}".format(tenants) + rollback_sql = "alter system suspend merge tenant = {0}".format(tenants) logging.info(action_sql) cur.execute(action_sql) diff --git a/tools/upgrade/upgrade_checker.py b/tools/upgrade/upgrade_checker.py index b5339197d..03e93bf6a 100755 --- a/tools/upgrade/upgrade_checker.py +++ b/tools/upgrade/upgrade_checker.py @@ -580,6 +580,16 @@ def check_schema_status(query_cur): fail_list.append('{0} schema not available, please check'.format(results[0][0])) logging.info('check schema status success') +# 16. 检查是否存在名为all/all_user/all_meta的租户 +def check_not_supported_tenant_name(query_cur): + names = ["all", "all_user", "all_meta"] + (desc, results) = query_cur.exec_query("""select tenant_name from oceanbase.DBA_OB_TENANTS""") + for i in range(len(results)): + if results[i][0].lower() in names: + fail_list.append('a tenant named all/all_user/all_meta (case insensitive) cannot exist in the cluster, please rename the tenant') + break + logging.info('check special tenant name success') + # last check of do_check, make sure no function execute after check_fail_list def check_fail_list(): if len(fail_list) != 0 : @@ -621,6 +631,7 @@ def do_check(my_host, my_port, my_user, my_passwd, timeout, upgrade_params): check_observer_status(query_cur) check_schema_status(query_cur) check_server_version(query_cur) + check_not_supported_tenant_name(query_cur) # all check func should execute before check_fail_list check_fail_list() modify_server_permanent_offline_time(cur) diff --git a/tools/upgrade/upgrade_post.py b/tools/upgrade/upgrade_post.py index a931a21dd..dde9e38a5 100755 --- a/tools/upgrade/upgrade_post.py +++ b/tools/upgrade/upgrade_post.py @@ -113,6 +113,22 @@ # and word_list[1].lower().startswith('@') and ':=' == word_list[2].lower()): # raise MyError('sql must be update, key_word="{0}", sql="{1}"'.format(key_word, sql)) # +#def get_min_cluster_version(cur): +# min_cluster_version = 0 +# sql = """select distinct value from oceanbase.GV$OB_PARAMETERS where name='min_observer_version'""" +# logging.info(sql) +# cur.execute(sql) +# results = cur.fetchall() +# if len(results) != 1: +# logging.exception('min_observer_version is not sync') +# raise e +# elif len(results[0]) != 1: +# logging.exception('column cnt not match') +# raise e +# else: +# min_cluster_version = get_version(results[0][0]) +# return min_cluster_version +# #def set_parameter(cur, parameter, value, timeout = 0): # sql = """alter system set {0} = '{1}'""".format(parameter, value) # logging.info(sql) @@ -120,9 +136,15 @@ # wait_parameter_sync(cur, False, parameter, value, timeout) # #def set_tenant_parameter(cur, parameter, value, timeout = 0): -# sql = """alter system set {0} = '{1}' tenant = 'all'""".format(parameter, value) -# logging.info(sql) -# cur.execute(sql) +# tenants_list = [] +# if get_min_cluster_version(cur) < get_version("4.2.1.0"): +# tenants_list = ['all'] +# else: +# tenants_list = ['sys', 'all_user', 'all_meta'] +# for tenants in tenants_list: +# sql = """alter system set {0} = '{1}' tenant = '{2}'""".format(parameter, value, tenants) +# logging.info(sql) +# cur.execute(sql) # wait_parameter_sync(cur, True, parameter, value, timeout) # #def get_ori_enable_ddl(cur, timeout): @@ -297,14 +319,26 @@ # wait_parameter_sync(cur, False, "enable_upgrade_mode", "False", timeout) # #def do_suspend_merge(cur, timeout): -# action_sql = "alter system suspend merge tenant = all" -# rollback_sql = "alter system resume merge tenant = all" +# tenants_list = [] +# if get_min_cluster_version(cur) < get_version("4.2.1.0"): +# tenants_list = ['all'] +# else: +# tenants_list = ['sys', 'all_user', 'all_meta'] +# for tenants in tenants_list: +# action_sql = "alter system suspend merge tenant = {0}".format(tenants) +# rollback_sql = "alter system resume merge tenant = {0}".format(tenants) # logging.info(action_sql) # cur.execute(action_sql) # #def do_resume_merge(cur, timeout): -# action_sql = "alter system resume merge tenant = all" -# rollback_sql = "alter system suspend merge tenant = all" +# tenants_list = [] +# if get_min_cluster_version(cur) < get_version("4.2.1.0"): +# tenants_list = ['all'] +# else: +# tenants_list = ['sys', 'all_user', 'all_meta'] +# for tenants in tenants_list: +# action_sql = "alter system resume merge tenant = {0}".format(tenants) +# rollback_sql = "alter system suspend merge tenant = {0}".format(tenants) # logging.info(action_sql) # cur.execute(action_sql) # @@ -2110,6 +2144,16 @@ # fail_list.append('{0} schema not available, please check'.format(results[0][0])) # logging.info('check schema status success') # +## 16. 检查是否存在名为all/all_user/all_meta的租户 +#def check_not_supported_tenant_name(query_cur): +# names = ["all", "all_user", "all_meta"] +# (desc, results) = query_cur.exec_query("""select tenant_name from oceanbase.DBA_OB_TENANTS""") +# for i in range(len(results)): +# if results[i][0].lower() in names: +# fail_list.append('a tenant named all/all_user/all_meta (case insensitive) cannot exist in the cluster, please rename the tenant') +# break +# logging.info('check special tenant name success') +# ## last check of do_check, make sure no function execute after check_fail_list #def check_fail_list(): # if len(fail_list) != 0 : @@ -2151,6 +2195,7 @@ # check_observer_status(query_cur) # check_schema_status(query_cur) # check_server_version(query_cur) +# check_not_supported_tenant_name(query_cur) # # all check func should execute before check_fail_list # check_fail_list() # modify_server_permanent_offline_time(cur) diff --git a/tools/upgrade/upgrade_pre.py b/tools/upgrade/upgrade_pre.py index 737284b54..d67efac5d 100755 --- a/tools/upgrade/upgrade_pre.py +++ b/tools/upgrade/upgrade_pre.py @@ -113,6 +113,22 @@ # and word_list[1].lower().startswith('@') and ':=' == word_list[2].lower()): # raise MyError('sql must be update, key_word="{0}", sql="{1}"'.format(key_word, sql)) # +#def get_min_cluster_version(cur): +# min_cluster_version = 0 +# sql = """select distinct value from oceanbase.GV$OB_PARAMETERS where name='min_observer_version'""" +# logging.info(sql) +# cur.execute(sql) +# results = cur.fetchall() +# if len(results) != 1: +# logging.exception('min_observer_version is not sync') +# raise e +# elif len(results[0]) != 1: +# logging.exception('column cnt not match') +# raise e +# else: +# min_cluster_version = get_version(results[0][0]) +# return min_cluster_version +# #def set_parameter(cur, parameter, value, timeout = 0): # sql = """alter system set {0} = '{1}'""".format(parameter, value) # logging.info(sql) @@ -120,9 +136,15 @@ # wait_parameter_sync(cur, False, parameter, value, timeout) # #def set_tenant_parameter(cur, parameter, value, timeout = 0): -# sql = """alter system set {0} = '{1}' tenant = 'all'""".format(parameter, value) -# logging.info(sql) -# cur.execute(sql) +# tenants_list = [] +# if get_min_cluster_version(cur) < get_version("4.2.1.0"): +# tenants_list = ['all'] +# else: +# tenants_list = ['sys', 'all_user', 'all_meta'] +# for tenants in tenants_list: +# sql = """alter system set {0} = '{1}' tenant = '{2}'""".format(parameter, value, tenants) +# logging.info(sql) +# cur.execute(sql) # wait_parameter_sync(cur, True, parameter, value, timeout) # #def get_ori_enable_ddl(cur, timeout): @@ -297,14 +319,26 @@ # wait_parameter_sync(cur, False, "enable_upgrade_mode", "False", timeout) # #def do_suspend_merge(cur, timeout): -# action_sql = "alter system suspend merge tenant = all" -# rollback_sql = "alter system resume merge tenant = all" +# tenants_list = [] +# if get_min_cluster_version(cur) < get_version("4.2.1.0"): +# tenants_list = ['all'] +# else: +# tenants_list = ['sys', 'all_user', 'all_meta'] +# for tenants in tenants_list: +# action_sql = "alter system suspend merge tenant = {0}".format(tenants) +# rollback_sql = "alter system resume merge tenant = {0}".format(tenants) # logging.info(action_sql) # cur.execute(action_sql) # #def do_resume_merge(cur, timeout): -# action_sql = "alter system resume merge tenant = all" -# rollback_sql = "alter system suspend merge tenant = all" +# tenants_list = [] +# if get_min_cluster_version(cur) < get_version("4.2.1.0"): +# tenants_list = ['all'] +# else: +# tenants_list = ['sys', 'all_user', 'all_meta'] +# for tenants in tenants_list: +# action_sql = "alter system resume merge tenant = {0}".format(tenants) +# rollback_sql = "alter system suspend merge tenant = {0}".format(tenants) # logging.info(action_sql) # cur.execute(action_sql) # @@ -2110,6 +2144,16 @@ # fail_list.append('{0} schema not available, please check'.format(results[0][0])) # logging.info('check schema status success') # +## 16. 检查是否存在名为all/all_user/all_meta的租户 +#def check_not_supported_tenant_name(query_cur): +# names = ["all", "all_user", "all_meta"] +# (desc, results) = query_cur.exec_query("""select tenant_name from oceanbase.DBA_OB_TENANTS""") +# for i in range(len(results)): +# if results[i][0].lower() in names: +# fail_list.append('a tenant named all/all_user/all_meta (case insensitive) cannot exist in the cluster, please rename the tenant') +# break +# logging.info('check special tenant name success') +# ## last check of do_check, make sure no function execute after check_fail_list #def check_fail_list(): # if len(fail_list) != 0 : @@ -2151,6 +2195,7 @@ # check_observer_status(query_cur) # check_schema_status(query_cur) # check_server_version(query_cur) +# check_not_supported_tenant_name(query_cur) # # all check func should execute before check_fail_list # check_fail_list() # modify_server_permanent_offline_time(cur) diff --git a/unittest/sql/parser/print_parser_tree.result b/unittest/sql/parser/print_parser_tree.result index 0d127980c..17b765c22 100644 --- a/unittest/sql/parser/print_parser_tree.result +++ b/unittest/sql/parser/print_parser_tree.result @@ -1284,16 +1284,36 @@ question_mask_size: 0 |--[0],[T_INT], str_value_=[], value=[2] ************** Case 71 *************** -alter system suspend merge tenant = all; +alter system suspend merge tenant = sys; question_mask_size: 0 |--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807] |--[0],[T_MERGE_CONTROL], str_value_=[], value=[0] |--[0],[T_INT], str_value_=[], value=[2] |--[1],[T_TENANT_LIST], str_value_=[], value=[9223372036854775807] - |--[0],[T_IDENT], str_value_=[all], value=[9223372036854775807] + |--[0],[T_VARCHAR], str_value_=[sys], value=[9223372036854775807] ************** Case 72 *************** +alter system suspend merge tenant = all_user; +question_mask_size: 0 + +|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807] + |--[0],[T_MERGE_CONTROL], str_value_=[], value=[0] + |--[0],[T_INT], str_value_=[], value=[2] + |--[1],[T_TENANT_LIST], str_value_=[], value=[9223372036854775807] + |--[0],[T_VARCHAR], str_value_=[all_user], value=[9223372036854775807] + +************** Case 73 *************** +alter system suspend merge tenant = all_meta; +question_mask_size: 0 + +|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807] + |--[0],[T_MERGE_CONTROL], str_value_=[], value=[0] + |--[0],[T_INT], str_value_=[], value=[2] + |--[1],[T_TENANT_LIST], str_value_=[], value=[9223372036854775807] + |--[0],[T_VARCHAR], str_value_=[all_meta], value=[9223372036854775807] + +************** Case 74 *************** alter system resume merge; question_mask_size: 0 @@ -1301,24 +1321,44 @@ question_mask_size: 0 |--[0],[T_MERGE_CONTROL], str_value_=[], value=[0] |--[0],[T_INT], str_value_=[], value=[3] -************** Case 73 *************** -alter system resume merge tenant = all; +************** Case 75 *************** +alter system resume merge tenant = sys; question_mask_size: 0 |--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807] |--[0],[T_MERGE_CONTROL], str_value_=[], value=[0] |--[0],[T_INT], str_value_=[], value=[3] |--[1],[T_TENANT_LIST], str_value_=[], value=[9223372036854775807] - |--[0],[T_IDENT], str_value_=[all], value=[9223372036854775807] + |--[0],[T_VARCHAR], str_value_=[sys], value=[9223372036854775807] -************** Case 74 *************** +************** Case 76 *************** +alter system resume merge tenant = all_user; +question_mask_size: 0 + +|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807] + |--[0],[T_MERGE_CONTROL], str_value_=[], value=[0] + |--[0],[T_INT], str_value_=[], value=[3] + |--[1],[T_TENANT_LIST], str_value_=[], value=[9223372036854775807] + |--[0],[T_VARCHAR], str_value_=[all_user], value=[9223372036854775807] + +************** Case 77 *************** +alter system resume merge tenant = all_meta; +question_mask_size: 0 + +|--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807] + |--[0],[T_MERGE_CONTROL], str_value_=[], value=[0] + |--[0],[T_INT], str_value_=[], value=[3] + |--[1],[T_TENANT_LIST], str_value_=[], value=[9223372036854775807] + |--[0],[T_VARCHAR], str_value_=[all_meta], value=[9223372036854775807] + +************** Case 78 *************** alter system clear roottable; question_mask_size: 0 |--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807] |--[0],[T_CLEAR_ROOT_TABLE], str_value_=[], value=[0] -************** Case 75 *************** +************** Case 79 *************** alter system clear roottable tenant = 'xxx'; question_mask_size: 0 @@ -1327,7 +1367,7 @@ question_mask_size: 0 |--[0],[T_TENANT_NAME], str_value_=[], value=[9223372036854775807] |--[0],[T_VARCHAR], str_value_=[xxx], value=[9223372036854775807] -************** Case 76 *************** +************** Case 80 *************** alter system modify zone 'z1' set region 'r1' question_mask_size: 0 @@ -1338,9 +1378,9 @@ question_mask_size: 0 |--[2],[T_LINK_NODE], str_value_=[], value=[9223372036854775807] |--[0],[T_REGION], str_value_=[r1], value=[9223372036854775807] -************** Case 77 *************** +************** Case 81 *************** alter system start zone 'z1' region 'r1' -************** Case 78 *************** +************** Case 82 *************** alter system modify zone 'z1' IDC 'idc1' question_mask_size: 0 @@ -1351,7 +1391,7 @@ question_mask_size: 0 |--[2],[T_LINK_NODE], str_value_=[], value=[9223372036854775807] |--[0],[T_IDC], str_value_=[idc1], value=[9223372036854775807] -************** Case 79 *************** +************** Case 83 *************** alter system modify zone 'z1' set IDC 'idc1', region 'r1' question_mask_size: 0 @@ -1363,7 +1403,7 @@ question_mask_size: 0 |--[0],[T_IDC], str_value_=[idc1], value=[9223372036854775807] |--[1],[T_REGION], str_value_=[r1], value=[9223372036854775807] -************** Case 80 *************** +************** Case 84 *************** alter system add zone 'z1' idc 'idc1', region 'r1' question_mask_size: 0 @@ -1375,7 +1415,7 @@ question_mask_size: 0 |--[0],[T_IDC], str_value_=[idc1], value=[9223372036854775807] |--[1],[T_REGION], str_value_=[r1], value=[9223372036854775807] -************** Case 81 *************** +************** Case 85 *************** alter system add zone 'z1' idc 'idc1' question_mask_size: 0 @@ -1386,7 +1426,7 @@ question_mask_size: 0 |--[2],[T_LINK_NODE], str_value_=[], value=[9223372036854775807] |--[0],[T_IDC], str_value_=[idc1], value=[9223372036854775807] -************** Case 82 *************** +************** Case 86 *************** alter system modify zone 'z1' question_mask_size: 0 @@ -1395,11 +1435,11 @@ question_mask_size: 0 |--[0],[T_INT], str_value_=[], value=[5] |--[1],[T_VARCHAR], str_value_=[z1], value=[9223372036854775807] -************** Case 83 *************** +************** Case 87 *************** alter system start zone 'z1' IDC 'idc1' -************** Case 84 *************** +************** Case 88 *************** alter system start zone 'z1' zone_type 'ReadWrite' -************** Case 85 *************** +************** Case 89 *************** alter system add zone 'z1' zone_type 'ReadWrite', idc 'idc1', region 'r1' question_mask_size: 0 @@ -1412,7 +1452,7 @@ question_mask_size: 0 |--[1],[T_IDC], str_value_=[idc1], value=[9223372036854775807] |--[2],[T_REGION], str_value_=[r1], value=[9223372036854775807] -************** Case 86 *************** +************** Case 90 *************** alter system add zone 'z1' zone_type 'ReadWrite', idc 'idc1' question_mask_size: 0 @@ -1424,7 +1464,7 @@ question_mask_size: 0 |--[0],[T_ZONE_TYPE], str_value_=[ReadWrite], value=[9223372036854775807] |--[1],[T_IDC], str_value_=[idc1], value=[9223372036854775807] -************** Case 87 *************** +************** Case 91 *************** alter system add zone 'z1' zone_type 'ReadWrite', region 'r1' question_mask_size: 0 @@ -1436,7 +1476,7 @@ question_mask_size: 0 |--[0],[T_ZONE_TYPE], str_value_=[ReadWrite], value=[9223372036854775807] |--[1],[T_REGION], str_value_=[r1], value=[9223372036854775807] -************** Case 88 *************** +************** Case 92 *************** alter system add zone 'z1' zone_type 'ReadWrite' question_mask_size: 0 @@ -1447,7 +1487,7 @@ question_mask_size: 0 |--[2],[T_LINK_NODE], str_value_=[], value=[9223372036854775807] |--[0],[T_ZONE_TYPE], str_value_=[ReadWrite], value=[9223372036854775807] -************** Case 89 *************** +************** Case 93 *************** alter system modify zone 'z1' zone_type 'ReadWrite', idc 'idc1', region 'r1' question_mask_size: 0 @@ -1460,7 +1500,7 @@ question_mask_size: 0 |--[1],[T_IDC], str_value_=[idc1], value=[9223372036854775807] |--[2],[T_REGION], str_value_=[r1], value=[9223372036854775807] -************** Case 90 *************** +************** Case 94 *************** alter system modify zone 'z1' zone_type 'ReadWrite', idc 'idc1' question_mask_size: 0 @@ -1472,7 +1512,7 @@ question_mask_size: 0 |--[0],[T_ZONE_TYPE], str_value_=[ReadWrite], value=[9223372036854775807] |--[1],[T_IDC], str_value_=[idc1], value=[9223372036854775807] -************** Case 91 *************** +************** Case 95 *************** alter system modify zone 'z1' zone_type 'ReadWrite', region 'r1' question_mask_size: 0 @@ -1484,7 +1524,7 @@ question_mask_size: 0 |--[0],[T_ZONE_TYPE], str_value_=[ReadWrite], value=[9223372036854775807] |--[1],[T_REGION], str_value_=[r1], value=[9223372036854775807] -************** Case 92 *************** +************** Case 96 *************** alter system modify zone 'z1' zone_type 'ReadWrite' question_mask_size: 0 @@ -1495,7 +1535,7 @@ question_mask_size: 0 |--[2],[T_LINK_NODE], str_value_=[], value=[9223372036854775807] |--[0],[T_ZONE_TYPE], str_value_=[ReadWrite], value=[9223372036854775807] -************** Case 93 *************** +************** Case 97 *************** select * from t1 where c1>ANY(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1528,7 +1568,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 94 *************** +************** Case 98 *************** select * from t1 where c1>SOME(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1561,7 +1601,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 95 *************** +************** Case 99 *************** select * from t1 where c1>ALL(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1594,7 +1634,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 96 *************** +************** Case 100 *************** select * from t1 where c1>(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1626,7 +1666,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 97 *************** +************** Case 101 *************** select * from t1 where c11); question_mask_size: 0 @@ -1659,7 +1699,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 98 *************** +************** Case 102 *************** select * from t1 where c11); question_mask_size: 0 @@ -1692,7 +1732,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 99 *************** +************** Case 103 *************** select * from t1 where c11); question_mask_size: 0 @@ -1725,7 +1765,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 100 *************** +************** Case 104 *************** select * from t1 where c1<(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1757,7 +1797,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 101 *************** +************** Case 105 *************** select * from t1 where c1>=ANY(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1790,7 +1830,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 102 *************** +************** Case 106 *************** select * from t1 where c1>=SOME(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1823,7 +1863,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 103 *************** +************** Case 107 *************** select * from t1 where c1>=ALL(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1856,7 +1896,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 104 *************** +************** Case 108 *************** select * from t1 where c1>=(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1888,7 +1928,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 105 *************** +************** Case 109 *************** select * from t1 where c1<=ANY(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1921,7 +1961,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 106 *************** +************** Case 110 *************** select * from t1 where c1<=SOME(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1954,7 +1994,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 107 *************** +************** Case 111 *************** select * from t1 where c1<=ALL(select c1 from t2 where c2>1); question_mask_size: 0 @@ -1987,7 +2027,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 108 *************** +************** Case 112 *************** select * from t1 where c1<=(select c1 from t2 where c2>1); question_mask_size: 0 @@ -2019,7 +2059,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 109 *************** +************** Case 113 *************** select * from t1 where c1=ANY(select c1 from t2 where c2>1); question_mask_size: 0 @@ -2052,7 +2092,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 110 *************** +************** Case 114 *************** select * from t1 where c1=SOME(select c1 from t2 where c2>1); question_mask_size: 0 @@ -2085,7 +2125,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 111 *************** +************** Case 115 *************** select * from t1 where c1=ALL(select c1 from t2 where c2>1); question_mask_size: 0 @@ -2118,7 +2158,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 112 *************** +************** Case 116 *************** select * from t1 where c1=(select c1 from t2 where c2>1); question_mask_size: 0 @@ -2150,7 +2190,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 113 *************** +************** Case 117 *************** select * from t1 where c1!=ANY(select c1 from t2 where c2>1); question_mask_size: 0 @@ -2183,7 +2223,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 114 *************** +************** Case 118 *************** select * from t1 where c1!=SOME(select c1 from t2 where c2>1); question_mask_size: 0 @@ -2216,7 +2256,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 115 *************** +************** Case 119 *************** select * from t1 where c1!=ALL(select c1 from t2 where c2>1); question_mask_size: 0 @@ -2249,7 +2289,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 116 *************** +************** Case 120 *************** select * from t1 where c1!=(select c1 from t2 where c2>1); question_mask_size: 0 @@ -2281,7 +2321,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 117 *************** +************** Case 121 *************** select * from t1 where c1 in (select c1 from t2 where c2>1); question_mask_size: 0 @@ -2313,7 +2353,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 118 *************** +************** Case 122 *************** select * from t1 where c1 not in (select c1 from t2 where c2>1); question_mask_size: 0 @@ -2345,7 +2385,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 119 *************** +************** Case 123 *************** select * from t1 where exists (select c1 from t2 where c2>1); question_mask_size: 0 @@ -2375,7 +2415,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 120 *************** +************** Case 124 *************** select * from t1 where not exists (select c1 from t2 where c2>1); question_mask_size: 0 @@ -2406,7 +2446,7 @@ question_mask_size: 0 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_INT], str_value_=[1], value=[1] -************** Case 121 *************** +************** Case 125 *************** select * from t1 where (select c1 from t1) like (select c2 from t2); question_mask_size: 0 @@ -2440,7 +2480,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t2], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t2], value=[9223372036854775807] -************** Case 122 *************** +************** Case 126 *************** select * from t1 where (select c1 from t1) not like (select c2 from t2); question_mask_size: 0 @@ -2474,7 +2514,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t2], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t2], value=[9223372036854775807] -************** Case 123 *************** +************** Case 127 *************** select * from t1 where (c1) in (select c1 from t2); question_mask_size: 0 @@ -2501,7 +2541,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t2], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t2], value=[9223372036854775807] -************** Case 124 *************** +************** Case 128 *************** select * from t1 where (c1, c2) in (select c1, c2 from t2); question_mask_size: 0 @@ -2534,7 +2574,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t2], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t2], value=[9223372036854775807] -************** Case 125 *************** +************** Case 129 *************** select * from t1 where ROW(c1, c2) in (select c1, c2 from t2); question_mask_size: 0 @@ -2567,7 +2607,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t2], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t2], value=[9223372036854775807] -************** Case 126 *************** +************** Case 130 *************** set names latin1; question_mask_size: 0 @@ -2575,7 +2615,7 @@ question_mask_size: 0 |--[0],[T_SET_NAMES], str_value_=[], value=[0] |--[0],[T_CHAR_CHARSET], str_value_=[latin1], value=[9223372036854775807] -************** Case 127 *************** +************** Case 131 *************** set names 'latin1'; question_mask_size: 0 @@ -2583,7 +2623,7 @@ question_mask_size: 0 |--[0],[T_SET_NAMES], str_value_=[], value=[0] |--[0],[T_VARCHAR], str_value_=[latin1], value=[9223372036854775807] -************** Case 128 *************** +************** Case 132 *************** set names utf8 collate 'utf8_general_ci'; question_mask_size: 0 @@ -2592,7 +2632,7 @@ question_mask_size: 0 |--[0],[T_CHAR_CHARSET], str_value_=[utf8], value=[9223372036854775807] |--[1],[T_COLLATION], str_value_=[utf8_general_ci], value=[9223372036854775807] -************** Case 129 *************** +************** Case 133 *************** set names utf8 collate utf8_general_ci; question_mask_size: 0 @@ -2601,7 +2641,7 @@ question_mask_size: 0 |--[0],[T_CHAR_CHARSET], str_value_=[utf8], value=[9223372036854775807] |--[1],[T_COLLATION], str_value_=[utf8_general_ci], value=[9223372036854775807] -************** Case 130 *************** +************** Case 134 *************** set character set utf8; question_mask_size: 0 @@ -2609,7 +2649,7 @@ question_mask_size: 0 |--[0],[T_SET_CHARSET], str_value_=[], value=[0] |--[0],[T_CHAR_CHARSET], str_value_=[utf8], value=[9223372036854775807] -************** Case 131 *************** +************** Case 135 *************** set character set 'utf8'; question_mask_size: 0 @@ -2617,7 +2657,7 @@ question_mask_size: 0 |--[0],[T_SET_CHARSET], str_value_=[], value=[0] |--[0],[T_VARCHAR], str_value_=[utf8], value=[9223372036854775807] -************** Case 132 *************** +************** Case 136 *************** set charset utf8; question_mask_size: 0 @@ -2625,7 +2665,7 @@ question_mask_size: 0 |--[0],[T_SET_CHARSET], str_value_=[], value=[0] |--[0],[T_CHAR_CHARSET], str_value_=[utf8], value=[9223372036854775807] -************** Case 133 *************** +************** Case 137 *************** select _utf8 'abc', _utf8mb4 'def' collate utf8mb4_general_ci from t1 where c1 collate utf8_bin = 'xyz' collate utf8_bin; question_mask_size: 0 @@ -2663,7 +2703,7 @@ question_mask_size: 0 |--[1],[T_VARCHAR], str_value_=[xyz], value=[9223372036854775807] |--[1],[T_COLLATION], str_value_=[utf8_bin], value=[9223372036854775807] -************** Case 134 *************** +************** Case 138 *************** select * from t1 where c1=?; question_mask_size: 1 @@ -2682,7 +2722,7 @@ question_mask_size: 1 |--[2],[T_IDENT], str_value_=[c1], value=[9223372036854775807] |--[1],[T_QUESTIONMARK], str_value_=[], value=[0] -************** Case 135 *************** +************** Case 139 *************** select * from t1 where c1>?; question_mask_size: 1 @@ -2701,7 +2741,7 @@ question_mask_size: 1 |--[2],[T_IDENT], str_value_=[c1], value=[9223372036854775807] |--[1],[T_QUESTIONMARK], str_value_=[], value=[0] -************** Case 136 *************** +************** Case 140 *************** select * from t1 where (select c1 from t1 where c1 = ?) not like (select c2 from t2 where c2=?); question_mask_size: 2 @@ -2745,7 +2785,7 @@ question_mask_size: 2 |--[2],[T_IDENT], str_value_=[c2], value=[9223372036854775807] |--[1],[T_QUESTIONMARK], str_value_=[], value=[1] -************** Case 137 *************** +************** Case 141 *************** select * from t1 join t2; question_mask_size: 0 @@ -2764,7 +2804,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t2], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t2], value=[9223372036854775807] -************** Case 138 *************** +************** Case 142 *************** select * from t1 inner join t2; question_mask_size: 0 @@ -2783,7 +2823,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t2], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t2], value=[9223372036854775807] -************** Case 139 *************** +************** Case 143 *************** select * from t1 cross join t2; question_mask_size: 0 @@ -2802,7 +2842,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t2], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t2], value=[9223372036854775807] -************** Case 140 *************** +************** Case 144 *************** select * from t1 cross join t2 join t3; question_mask_size: 0 @@ -2826,7 +2866,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t3], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t3], value=[9223372036854775807] -************** Case 141 *************** +************** Case 145 *************** select "1234"; question_mask_size: 0 @@ -2837,7 +2877,7 @@ question_mask_size: 0 |--[0],[T_VARCHAR], str_value_=[1234], value=[9223372036854775807] |--[1],[T_VARCHAR], str_value_=[1234], value=[9223372036854775807] -************** Case 142 *************** +************** Case 146 *************** select '1234'; question_mask_size: 0 @@ -2848,7 +2888,7 @@ question_mask_size: 0 |--[0],[T_VARCHAR], str_value_=[1234], value=[9223372036854775807] |--[1],[T_VARCHAR], str_value_=[1234], value=[9223372036854775807] -************** Case 143 *************** +************** Case 147 *************** create table test(c1 varchar(3) binary charset utf8mb4); question_mask_size: 0 @@ -2864,7 +2904,7 @@ question_mask_size: 0 |--[0],[T_CHARSET], str_value_=[utf8mb4], value=[9223372036854775807] |--[2],[T_BINARY], str_value_=[], value=[1] -************** Case 144 *************** +************** Case 148 *************** replace into test values(1,2); question_mask_size: 0 @@ -2881,7 +2921,7 @@ question_mask_size: 0 |--[1],[T_INT], str_value_=[2], value=[2] |--[1],[T_REPLACE], str_value_=[], value=[9223372036854775807] -************** Case 145 *************** +************** Case 149 *************** replace ignore into test values(1,2); question_mask_size: 0 @@ -2899,7 +2939,7 @@ question_mask_size: 0 |--[1],[T_REPLACE], str_value_=[], value=[9223372036854775807] |--[3],[T_IGNORE], str_value_=[], value=[9223372036854775807] -************** Case 146 *************** +************** Case 150 *************** insert ignore into test values(1,2); question_mask_size: 0 @@ -2917,7 +2957,7 @@ question_mask_size: 0 |--[1],[T_INSERT], str_value_=[], value=[9223372036854775807] |--[3],[T_IGNORE], str_value_=[], value=[9223372036854775807] -************** Case 147 *************** +************** Case 151 *************** insert ignore into test values(1,2) on duplicate key update c2 = c1 + 1; question_mask_size: 0 @@ -2943,7 +2983,7 @@ question_mask_size: 0 |--[1],[T_INSERT], str_value_=[], value=[9223372036854775807] |--[3],[T_IGNORE], str_value_=[], value=[9223372036854775807] -************** Case 148 *************** +************** Case 152 *************** create outline out_name on select * from t1; question_mask_size: 0 @@ -2961,7 +3001,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t1], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t1], value=[9223372036854775807] -************** Case 149 *************** +************** Case 153 *************** create or replace outline out_name on select * from t1; question_mask_size: 0 @@ -2980,7 +3020,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t1], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t1], value=[9223372036854775807] -************** Case 150 *************** +************** Case 154 *************** create outline out_name on select * from t1; question_mask_size: 0 @@ -2998,7 +3038,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t1], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t1], value=[9223372036854775807] -************** Case 151 *************** +************** Case 155 *************** create outline out_name on select /*+ssssss*/* from t1; question_mask_size: 0 @@ -3016,7 +3056,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t1], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t1], value=[9223372036854775807] -************** Case 152 *************** +************** Case 156 *************** create outline out_name on select /*+ssssss*/* from t1 to select /*+ssssss*/* from t1; question_mask_size: 0 @@ -3042,7 +3082,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t1], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t1], value=[9223372036854775807] -************** Case 153 *************** +************** Case 157 *************** create outline out_name on select /*+ssssss*/* from t1 to select * from t1; question_mask_size: 0 @@ -3068,7 +3108,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t1], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t1], value=[9223372036854775807] -************** Case 154 *************** +************** Case 158 *************** create outline out_name on insert /*+ssssss*/ into t1 values(1, 2) to insert /*+ssssss*/ into t1 values(1, 2); question_mask_size: 0 @@ -3100,7 +3140,7 @@ question_mask_size: 0 |--[1],[T_INT], str_value_=[2], value=[2] |--[1],[T_INSERT], str_value_=[], value=[9223372036854775807] -************** Case 155 *************** +************** Case 159 *************** drop outline out_name; question_mask_size: 0 @@ -3109,7 +3149,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[out_name], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[out_name], value=[9223372036854775807] -************** Case 156 *************** +************** Case 160 *************** drop outline db_name.out_name; question_mask_size: 0 @@ -3119,7 +3159,7 @@ question_mask_size: 0 |--[0],[T_IDENT], str_value_=[db_name], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[out_name], value=[9223372036854775807] -************** Case 157 *************** +************** Case 161 *************** create tenant tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1') set ob_tcp_invited_nodes='%'; question_mask_size: 0 @@ -3139,7 +3179,7 @@ question_mask_size: 0 |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] -************** Case 158 *************** +************** Case 162 *************** create tenant if not exists tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1') set ob_tcp_invited_nodes='%'; question_mask_size: 0 @@ -3160,7 +3200,7 @@ question_mask_size: 0 |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] -************** Case 159 *************** +************** Case 163 *************** create tenant tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), locality = 'auto_locality_strategy' set ob_tcp_invited_nodes='%'; question_mask_size: 0 @@ -3182,7 +3222,7 @@ question_mask_size: 0 |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] -************** Case 160 *************** +************** Case 164 *************** create tenant if not exists tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), locality = 'auto_locality_strategy' set ob_tcp_invited_nodes='%'; question_mask_size: 0 @@ -3205,7 +3245,7 @@ question_mask_size: 0 |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] -************** Case 161 *************** +************** Case 165 *************** create tenant tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), logonly_replica_num = 1 set ob_tcp_invited_nodes='%'; question_mask_size: 0 @@ -3227,7 +3267,7 @@ question_mask_size: 0 |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] -************** Case 162 *************** +************** Case 166 *************** create tenant if not exists tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), logonly_replica_num = 1 set ob_tcp_invited_nodes='%'; question_mask_size: 0 @@ -3250,7 +3290,7 @@ question_mask_size: 0 |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] |--[1],[T_VARCHAR], str_value_=[%], value=[9223372036854775807] -************** Case 163 *************** +************** Case 167 *************** select /*+max_concurrent(-10)*/* from t1; question_mask_size: 0 @@ -3265,7 +3305,7 @@ question_mask_size: 0 |--[1],[T_IDENT], str_value_=[t1], value=[9223372036854775807] |--[17],[T_HINT_OPTION_LIST], str_value_=[], value=[9223372036854775807] -************** Case 164 *************** +************** Case 168 *************** select /*+max_concurrent(10)*/* from t1; question_mask_size: 0 @@ -3282,32 +3322,32 @@ question_mask_size: 0 |--[0],[T_MAX_CONCURRENT], str_value_=[], value=[9223372036854775807] |--[0],[T_INT], str_value_=[10], value=[10] -************** Case 165 *************** +************** Case 169 *************** alter system refresh time_zone_info; question_mask_size: 0 |--[0],[T_STMT_LIST], str_value_=[], value=[9223372036854775807] |--[0],[T_REFRESH_TIME_ZONE_INFO], str_value_=[], value=[0] -************** Case 166 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); -************** Case 167 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales where t2.id!= t1.id when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); -************** Case 168 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales where t1.id < 3 delete where t1.id < 5 when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); -************** Case 169 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales delete where t1.sales =2 when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); ************** Case 170 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales) where t2.id > 0; +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); ************** Case 171 *************** -merge into targetTable t1 using sourceTable t2 on (1 = 2) when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales) where t2.id > 0; +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales where t2.id!= t1.id when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); ************** Case 172 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales; +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales where t1.id < 3 delete where t1.id < 5 when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); ************** Case 173 *************** -merge into targetTable using sourceTable on (targetTable.id = sourceTable.id) when matched then update set targetTable.sales = sourceTable.sales; +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales delete where t1.sales =2 when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); ************** Case 174 *************** -merge into targetTable using (select * from t1 ) sourceTable on (targetTable.id = sourceTable.id) when matched then update set targetTable.sales = sourceTable.sales; +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales) where t2.id > 0; ************** Case 175 *************** +merge into targetTable t1 using sourceTable t2 on (1 = 2) when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales) where t2.id > 0; +************** Case 176 *************** +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales; +************** Case 177 *************** +merge into targetTable using sourceTable on (targetTable.id = sourceTable.id) when matched then update set targetTable.sales = sourceTable.sales; +************** Case 178 *************** +merge into targetTable using (select * from t1 ) sourceTable on (targetTable.id = sourceTable.id) when matched then update set targetTable.sales = sourceTable.sales; +************** Case 179 *************** select unique(c1), c2 from t1; question_mask_size: 0 @@ -3327,7 +3367,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t1], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t1], value=[9223372036854775807] -************** Case 176 *************** +************** Case 180 *************** select unique(c1+1), c2 from t1; question_mask_size: 0 @@ -3349,7 +3389,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t1], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t1], value=[9223372036854775807] -************** Case 177 *************** +************** Case 181 *************** select distinct unique( max(c1)), c2 from t1; question_mask_size: 0 @@ -3371,7 +3411,7 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t1], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t1], value=[9223372036854775807] -************** Case 178 *************** +************** Case 182 *************** select unique distinct( max(c1)), c2 from t1; question_mask_size: 0 @@ -3393,9 +3433,9 @@ question_mask_size: 0 |--[0],[T_RELATION_FACTOR], str_value_=[t1], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t1], value=[9223372036854775807] -************** Case 179 *************** +************** Case 183 *************** select unique(*) from t1; -************** Case 180 *************** +************** Case 184 *************** alter tablegroup tg2 add table t1,t2; question_mask_size: 0 @@ -3408,7 +3448,7 @@ question_mask_size: 0 |--[1],[T_RELATION_FACTOR], str_value_=[t2], value=[9223372036854775807] |--[1],[T_IDENT], str_value_=[t2], value=[9223372036854775807] -************** Case 181 *************** +************** Case 185 *************** insert into t1 values(X''); question_mask_size: 0 @@ -3424,7 +3464,7 @@ question_mask_size: 0 |--[0],[T_HEX_STRING], str_value_=[], value=[9223372036854775807] |--[1],[T_INSERT], str_value_=[], value=[9223372036854775807] -************** Case 182 *************** +************** Case 186 *************** create table t1(`thedate` date NOT NULL COMMENT '日期'); question_mask_size: 0 @@ -3442,7 +3482,7 @@ question_mask_size: 0 |--[1],[T_COMMENT], str_value_=[], value=[9223372036854775807] |--[0],[T_VARCHAR], str_value_=[日期], value=[9223372036854775807] -************** Case 183 *************** +************** Case 187 *************** alter system bootstrap REGION 'sys_region' ZONE 'zone1' SERVER '10.101.74.122:41425'; question_mask_size: 0 diff --git a/unittest/sql/parser/test_parser.result b/unittest/sql/parser/test_parser.result index 5bde04cee..591659ee9 100644 --- a/unittest/sql/parser/test_parser.result +++ b/unittest/sql/parser/test_parser.result @@ -7543,7 +7543,7 @@ question_mask_size: 0 ] } ************** Case 71 *************** -alter system suspend merge tenant = all; +alter system suspend merge tenant = sys; question_mask_size: 0 { "type":"T_STMT_LIST", @@ -7570,10 +7570,10 @@ question_mask_size: 0 "str_val":"", "children": [ { - "type":"T_IDENT", + "type":"T_VARCHAR", "int_val":9223372036854775807, "str_len":3, - "str_val":"all" + "str_val":"sys" } ] } @@ -7582,6 +7582,84 @@ question_mask_size: 0 ] } ************** Case 72 *************** +alter system suspend merge tenant = all_user; +question_mask_size: 0 +{ + "type":"T_STMT_LIST", + "int_val":9223372036854775807, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_MERGE_CONTROL", + "int_val":0, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_INT", + "int_val":2, + "str_len":0, + "str_val":"" + }, + { + "type":"T_TENANT_LIST", + "int_val":9223372036854775807, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_VARCHAR", + "int_val":9223372036854775807, + "str_len":8, + "str_val":"all_user" + } + ] + } + ] + } + ] +} +************** Case 73 *************** +alter system suspend merge tenant = all_meta; +question_mask_size: 0 +{ + "type":"T_STMT_LIST", + "int_val":9223372036854775807, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_MERGE_CONTROL", + "int_val":0, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_INT", + "int_val":2, + "str_len":0, + "str_val":"" + }, + { + "type":"T_TENANT_LIST", + "int_val":9223372036854775807, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_VARCHAR", + "int_val":9223372036854775807, + "str_len":8, + "str_val":"all_meta" + } + ] + } + ] + } + ] +} +************** Case 74 *************** alter system resume merge; question_mask_size: 0 { @@ -7607,8 +7685,8 @@ question_mask_size: 0 } ] } -************** Case 73 *************** -alter system resume merge tenant = all; +************** Case 75 *************** +alter system resume merge tenant = sys; question_mask_size: 0 { "type":"T_STMT_LIST", @@ -7635,10 +7713,10 @@ question_mask_size: 0 "str_val":"", "children": [ { - "type":"T_IDENT", + "type":"T_VARCHAR", "int_val":9223372036854775807, "str_len":3, - "str_val":"all" + "str_val":"sys" } ] } @@ -7646,7 +7724,85 @@ question_mask_size: 0 } ] } -************** Case 74 *************** +************** Case 76 *************** +alter system resume merge tenant = all_user; +question_mask_size: 0 +{ + "type":"T_STMT_LIST", + "int_val":9223372036854775807, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_MERGE_CONTROL", + "int_val":0, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_INT", + "int_val":3, + "str_len":0, + "str_val":"" + }, + { + "type":"T_TENANT_LIST", + "int_val":9223372036854775807, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_VARCHAR", + "int_val":9223372036854775807, + "str_len":8, + "str_val":"all_user" + } + ] + } + ] + } + ] +} +************** Case 77 *************** +alter system resume merge tenant = all_meta; +question_mask_size: 0 +{ + "type":"T_STMT_LIST", + "int_val":9223372036854775807, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_MERGE_CONTROL", + "int_val":0, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_INT", + "int_val":3, + "str_len":0, + "str_val":"" + }, + { + "type":"T_TENANT_LIST", + "int_val":9223372036854775807, + "str_len":0, + "str_val":"", + "children": [ + { + "type":"T_VARCHAR", + "int_val":9223372036854775807, + "str_len":8, + "str_val":"all_meta" + } + ] + } + ] + } + ] +} +************** Case 78 *************** alter system clear roottable; question_mask_size: 0 { @@ -7666,7 +7822,7 @@ question_mask_size: 0 } ] } -************** Case 75 *************** +************** Case 79 *************** alter system clear roottable tenant = 'xxx'; question_mask_size: 0 { @@ -7699,7 +7855,7 @@ question_mask_size: 0 } ] } -************** Case 76 *************** +************** Case 80 *************** alter system modify zone 'z1' set region 'r1' question_mask_size: 0 { @@ -7744,9 +7900,9 @@ question_mask_size: 0 } ] } -************** Case 77 *************** +************** Case 81 *************** alter system start zone 'z1' region 'r1' -************** Case 78 *************** +************** Case 82 *************** alter system modify zone 'z1' IDC 'idc1' question_mask_size: 0 { @@ -7791,7 +7947,7 @@ question_mask_size: 0 } ] } -************** Case 79 *************** +************** Case 83 *************** alter system modify zone 'z1' set IDC 'idc1', region 'r1' question_mask_size: 0 { @@ -7842,7 +7998,7 @@ question_mask_size: 0 } ] } -************** Case 80 *************** +************** Case 84 *************** alter system add zone 'z1' idc 'idc1', region 'r1' question_mask_size: 0 { @@ -7893,7 +8049,7 @@ question_mask_size: 0 } ] } -************** Case 81 *************** +************** Case 85 *************** alter system add zone 'z1' idc 'idc1' question_mask_size: 0 { @@ -7938,7 +8094,7 @@ question_mask_size: 0 } ] } -************** Case 82 *************** +************** Case 86 *************** alter system modify zone 'z1' question_mask_size: 0 { @@ -7970,11 +8126,11 @@ question_mask_size: 0 } ] } -************** Case 83 *************** +************** Case 87 *************** alter system start zone 'z1' IDC 'idc1' -************** Case 84 *************** +************** Case 88 *************** alter system start zone 'z1' zone_type 'ReadWrite' -************** Case 85 *************** +************** Case 89 *************** alter system add zone 'z1' zone_type 'ReadWrite', idc 'idc1', region 'r1' question_mask_size: 0 { @@ -8031,7 +8187,7 @@ question_mask_size: 0 } ] } -************** Case 86 *************** +************** Case 90 *************** alter system add zone 'z1' zone_type 'ReadWrite', idc 'idc1' question_mask_size: 0 { @@ -8082,7 +8238,7 @@ question_mask_size: 0 } ] } -************** Case 87 *************** +************** Case 91 *************** alter system add zone 'z1' zone_type 'ReadWrite', region 'r1' question_mask_size: 0 { @@ -8133,7 +8289,7 @@ question_mask_size: 0 } ] } -************** Case 88 *************** +************** Case 92 *************** alter system add zone 'z1' zone_type 'ReadWrite' question_mask_size: 0 { @@ -8178,7 +8334,7 @@ question_mask_size: 0 } ] } -************** Case 89 *************** +************** Case 93 *************** alter system modify zone 'z1' zone_type 'ReadWrite', idc 'idc1', region 'r1' question_mask_size: 0 { @@ -8235,7 +8391,7 @@ question_mask_size: 0 } ] } -************** Case 90 *************** +************** Case 94 *************** alter system modify zone 'z1' zone_type 'ReadWrite', idc 'idc1' question_mask_size: 0 { @@ -8286,7 +8442,7 @@ question_mask_size: 0 } ] } -************** Case 91 *************** +************** Case 95 *************** alter system modify zone 'z1' zone_type 'ReadWrite', region 'r1' question_mask_size: 0 { @@ -8337,7 +8493,7 @@ question_mask_size: 0 } ] } -************** Case 92 *************** +************** Case 96 *************** alter system modify zone 'z1' zone_type 'ReadWrite' question_mask_size: 0 { @@ -8382,7 +8538,7 @@ question_mask_size: 0 } ] } -************** Case 93 *************** +************** Case 97 *************** select * from t1 where c1>ANY(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -8653,7 +8809,7 @@ question_mask_size: 0 } ] } -************** Case 94 *************** +************** Case 98 *************** select * from t1 where c1>SOME(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -8924,7 +9080,7 @@ question_mask_size: 0 } ] } -************** Case 95 *************** +************** Case 99 *************** select * from t1 where c1>ALL(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -9195,7 +9351,7 @@ question_mask_size: 0 } ] } -************** Case 96 *************** +************** Case 100 *************** select * from t1 where c1>(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -9458,7 +9614,7 @@ question_mask_size: 0 } ] } -************** Case 97 *************** +************** Case 101 *************** select * from t1 where c11); question_mask_size: 0 { @@ -9729,7 +9885,7 @@ question_mask_size: 0 } ] } -************** Case 98 *************** +************** Case 102 *************** select * from t1 where c11); question_mask_size: 0 { @@ -10000,7 +10156,7 @@ question_mask_size: 0 } ] } -************** Case 99 *************** +************** Case 103 *************** select * from t1 where c11); question_mask_size: 0 { @@ -10271,7 +10427,7 @@ question_mask_size: 0 } ] } -************** Case 100 *************** +************** Case 104 *************** select * from t1 where c1<(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -10534,7 +10690,7 @@ question_mask_size: 0 } ] } -************** Case 101 *************** +************** Case 105 *************** select * from t1 where c1>=ANY(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -10805,7 +10961,7 @@ question_mask_size: 0 } ] } -************** Case 102 *************** +************** Case 106 *************** select * from t1 where c1>=SOME(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -11076,7 +11232,7 @@ question_mask_size: 0 } ] } -************** Case 103 *************** +************** Case 107 *************** select * from t1 where c1>=ALL(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -11347,7 +11503,7 @@ question_mask_size: 0 } ] } -************** Case 104 *************** +************** Case 108 *************** select * from t1 where c1>=(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -11610,7 +11766,7 @@ question_mask_size: 0 } ] } -************** Case 105 *************** +************** Case 109 *************** select * from t1 where c1<=ANY(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -11881,7 +12037,7 @@ question_mask_size: 0 } ] } -************** Case 106 *************** +************** Case 110 *************** select * from t1 where c1<=SOME(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -12152,7 +12308,7 @@ question_mask_size: 0 } ] } -************** Case 107 *************** +************** Case 111 *************** select * from t1 where c1<=ALL(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -12423,7 +12579,7 @@ question_mask_size: 0 } ] } -************** Case 108 *************** +************** Case 112 *************** select * from t1 where c1<=(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -12686,7 +12842,7 @@ question_mask_size: 0 } ] } -************** Case 109 *************** +************** Case 113 *************** select * from t1 where c1=ANY(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -12957,7 +13113,7 @@ question_mask_size: 0 } ] } -************** Case 110 *************** +************** Case 114 *************** select * from t1 where c1=SOME(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -13228,7 +13384,7 @@ question_mask_size: 0 } ] } -************** Case 111 *************** +************** Case 115 *************** select * from t1 where c1=ALL(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -13499,7 +13655,7 @@ question_mask_size: 0 } ] } -************** Case 112 *************** +************** Case 116 *************** select * from t1 where c1=(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -13762,7 +13918,7 @@ question_mask_size: 0 } ] } -************** Case 113 *************** +************** Case 117 *************** select * from t1 where c1!=ANY(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -14033,7 +14189,7 @@ question_mask_size: 0 } ] } -************** Case 114 *************** +************** Case 118 *************** select * from t1 where c1!=SOME(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -14304,7 +14460,7 @@ question_mask_size: 0 } ] } -************** Case 115 *************** +************** Case 119 *************** select * from t1 where c1!=ALL(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -14575,7 +14731,7 @@ question_mask_size: 0 } ] } -************** Case 116 *************** +************** Case 120 *************** select * from t1 where c1!=(select c1 from t2 where c2>1); question_mask_size: 0 { @@ -14838,7 +14994,7 @@ question_mask_size: 0 } ] } -************** Case 117 *************** +************** Case 121 *************** select * from t1 where c1 in (select c1 from t2 where c2>1); question_mask_size: 0 { @@ -15101,7 +15257,7 @@ question_mask_size: 0 } ] } -************** Case 118 *************** +************** Case 122 *************** select * from t1 where c1 not in (select c1 from t2 where c2>1); question_mask_size: 0 { @@ -15364,7 +15520,7 @@ question_mask_size: 0 } ] } -************** Case 119 *************** +************** Case 123 *************** select * from t1 where exists (select c1 from t2 where c2>1); question_mask_size: 0 { @@ -15611,7 +15767,7 @@ question_mask_size: 0 } ] } -************** Case 120 *************** +************** Case 124 *************** select * from t1 where not exists (select c1 from t2 where c2>1); question_mask_size: 0 { @@ -15866,7 +16022,7 @@ question_mask_size: 0 } ] } -************** Case 121 *************** +************** Case 125 *************** select * from t1 where (select c1 from t1) like (select c2 from t2); question_mask_size: 0 { @@ -16171,7 +16327,7 @@ question_mask_size: 0 } ] } -************** Case 122 *************** +************** Case 126 *************** select * from t1 where (select c1 from t1) not like (select c2 from t2); question_mask_size: 0 { @@ -16476,7 +16632,7 @@ question_mask_size: 0 } ] } -************** Case 123 *************** +************** Case 127 *************** select * from t1 where (c1) in (select c1 from t2); question_mask_size: 0 { @@ -16701,7 +16857,7 @@ question_mask_size: 0 } ] } -************** Case 124 *************** +************** Case 128 *************** select * from t1 where (c1, c2) in (select c1, c2 from t2); question_mask_size: 0 { @@ -16974,7 +17130,7 @@ question_mask_size: 0 } ] } -************** Case 125 *************** +************** Case 129 *************** select * from t1 where ROW(c1, c2) in (select c1, c2 from t2); question_mask_size: 0 { @@ -17247,7 +17403,7 @@ question_mask_size: 0 } ] } -************** Case 126 *************** +************** Case 130 *************** set names latin1; question_mask_size: 0 { @@ -17273,7 +17429,7 @@ question_mask_size: 0 } ] } -************** Case 127 *************** +************** Case 131 *************** set names 'latin1'; question_mask_size: 0 { @@ -17299,7 +17455,7 @@ question_mask_size: 0 } ] } -************** Case 128 *************** +************** Case 132 *************** set names utf8 collate 'utf8_general_ci'; question_mask_size: 0 { @@ -17330,7 +17486,7 @@ question_mask_size: 0 } ] } -************** Case 129 *************** +************** Case 133 *************** set names utf8 collate utf8_general_ci; question_mask_size: 0 { @@ -17361,7 +17517,7 @@ question_mask_size: 0 } ] } -************** Case 130 *************** +************** Case 134 *************** set character set utf8; question_mask_size: 0 { @@ -17386,7 +17542,7 @@ question_mask_size: 0 } ] } -************** Case 131 *************** +************** Case 135 *************** set character set 'utf8'; question_mask_size: 0 { @@ -17411,7 +17567,7 @@ question_mask_size: 0 } ] } -************** Case 132 *************** +************** Case 136 *************** set charset utf8; question_mask_size: 0 { @@ -17436,7 +17592,7 @@ question_mask_size: 0 } ] } -************** Case 133 *************** +************** Case 137 *************** select _utf8 'abc', _utf8mb4 'def' collate utf8mb4_general_ci from t1 where c1 collate utf8_bin = 'xyz' collate utf8_bin; question_mask_size: 0 { @@ -17706,7 +17862,7 @@ question_mask_size: 0 } ] } -************** Case 134 *************** +************** Case 138 *************** select * from t1 where c1=?; question_mask_size: 1 { @@ -17841,7 +17997,7 @@ question_mask_size: 1 } ] } -************** Case 135 *************** +************** Case 139 *************** select * from t1 where c1>?; question_mask_size: 1 { @@ -17976,7 +18132,7 @@ question_mask_size: 1 } ] } -************** Case 136 *************** +************** Case 140 *************** select * from t1 where (select c1 from t1 where c1 = ?) not like (select c2 from t2 where c2=?); question_mask_size: 2 { @@ -18357,7 +18513,7 @@ question_mask_size: 2 } ] } -************** Case 137 *************** +************** Case 141 *************** select * from t1 join t2; question_mask_size: 0 { @@ -18497,7 +18653,7 @@ question_mask_size: 0 } ] } -************** Case 138 *************** +************** Case 142 *************** select * from t1 inner join t2; question_mask_size: 0 { @@ -18637,7 +18793,7 @@ question_mask_size: 0 } ] } -************** Case 139 *************** +************** Case 143 *************** select * from t1 cross join t2; question_mask_size: 0 { @@ -18777,7 +18933,7 @@ question_mask_size: 0 } ] } -************** Case 140 *************** +************** Case 144 *************** select * from t1 cross join t2 join t3; question_mask_size: 0 { @@ -18960,7 +19116,7 @@ question_mask_size: 0 } ] } -************** Case 141 *************** +************** Case 145 *************** select "1234"; question_mask_size: 0 { @@ -19032,7 +19188,7 @@ question_mask_size: 0 } ] } -************** Case 142 *************** +************** Case 146 *************** select '1234'; question_mask_size: 0 { @@ -19104,7 +19260,7 @@ question_mask_size: 0 } ] } -************** Case 143 *************** +************** Case 147 *************** create table test(c1 varchar(3) binary charset utf8mb4); question_mask_size: 0 { @@ -19199,7 +19355,7 @@ question_mask_size: 0 } ] } -************** Case 144 *************** +************** Case 148 *************** replace into test values(1,2); question_mask_size: 0 { @@ -19299,7 +19455,7 @@ question_mask_size: 0 } ] } -************** Case 145 *************** +************** Case 149 *************** replace ignore into test values(1,2); question_mask_size: 0 { @@ -19404,7 +19560,7 @@ question_mask_size: 0 } ] } -************** Case 146 *************** +************** Case 150 *************** insert ignore into test values(1,2); question_mask_size: 0 { @@ -19509,7 +19665,7 @@ question_mask_size: 0 } ] } -************** Case 147 *************** +************** Case 151 *************** insert ignore into test values(1,2) on duplicate key update c2 = c1 + 1; question_mask_size: 0 { @@ -19675,7 +19831,7 @@ question_mask_size: 0 } ] } -************** Case 148 *************** +************** Case 152 *************** create outline out_name on select * from t1; question_mask_size: 0 { @@ -19803,7 +19959,7 @@ question_mask_size: 0 } ] } -************** Case 149 *************** +************** Case 153 *************** create or replace outline out_name on select * from t1; question_mask_size: 0 { @@ -19936,7 +20092,7 @@ question_mask_size: 0 } ] } -************** Case 150 *************** +************** Case 154 *************** create outline out_name on select * from t1; question_mask_size: 0 { @@ -20064,7 +20220,7 @@ question_mask_size: 0 } ] } -************** Case 151 *************** +************** Case 155 *************** create outline out_name on select /*+ssssss*/* from t1; question_mask_size: 0 { @@ -20192,7 +20348,7 @@ question_mask_size: 0 } ] } -************** Case 152 *************** +************** Case 156 *************** create outline out_name on select /*+ssssss*/* from t1 to select /*+ssssss*/* from t1; question_mask_size: 0 { @@ -20405,7 +20561,7 @@ question_mask_size: 0 } ] } -************** Case 153 *************** +************** Case 157 *************** create outline out_name on select /*+ssssss*/* from t1 to select * from t1; question_mask_size: 0 { @@ -20618,7 +20774,7 @@ question_mask_size: 0 } ] } -************** Case 154 *************** +************** Case 158 *************** create outline out_name on insert /*+ssssss*/ into t1 values(1, 2) to insert /*+ssssss*/ into t1 values(1, 2); question_mask_size: 0 { @@ -20837,7 +20993,7 @@ question_mask_size: 0 } ] } -************** Case 155 *************** +************** Case 159 *************** drop outline out_name; question_mask_size: 0 { @@ -20872,7 +21028,7 @@ question_mask_size: 0 } ] } -************** Case 156 *************** +************** Case 160 *************** drop outline db_name.out_name; question_mask_size: 0 { @@ -20912,7 +21068,7 @@ question_mask_size: 0 } ] } -************** Case 157 *************** +************** Case 161 *************** create tenant tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1') set ob_tcp_invited_nodes='%'; question_mask_size: 0 { @@ -21025,7 +21181,7 @@ question_mask_size: 0 } ] } -************** Case 158 *************** +************** Case 162 *************** create tenant if not exists tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1') set ob_tcp_invited_nodes='%'; question_mask_size: 0 { @@ -21143,7 +21299,7 @@ question_mask_size: 0 } ] } -************** Case 159 *************** +************** Case 163 *************** create tenant tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), locality = 'auto_locality_strategy' set ob_tcp_invited_nodes='%'; question_mask_size: 0 { @@ -21271,7 +21427,7 @@ question_mask_size: 0 } ] } -************** Case 160 *************** +************** Case 164 *************** create tenant if not exists tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), locality = 'auto_locality_strategy' set ob_tcp_invited_nodes='%'; question_mask_size: 0 { @@ -21404,7 +21560,7 @@ question_mask_size: 0 } ] } -************** Case 161 *************** +************** Case 165 *************** create tenant tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), logonly_replica_num = 1 set ob_tcp_invited_nodes='%'; question_mask_size: 0 { @@ -21531,7 +21687,7 @@ question_mask_size: 0 } ] } -************** Case 162 *************** +************** Case 166 *************** create tenant if not exists tt1 replica_num = 1, primary_zone = 'zone1', resource_pool_list = ('zone1'), logonly_replica_num = 1 set ob_tcp_invited_nodes='%'; question_mask_size: 0 { @@ -21663,7 +21819,7 @@ question_mask_size: 0 } ] } -************** Case 163 *************** +************** Case 167 *************** select /*+max_concurrent(-10)*/* from t1; question_mask_size: 0 { @@ -21765,7 +21921,7 @@ question_mask_size: 0 } ] } -************** Case 164 *************** +************** Case 168 *************** select /*+max_concurrent(10)*/* from t1; question_mask_size: 0 { @@ -21883,7 +22039,7 @@ question_mask_size: 0 } ] } -************** Case 165 *************** +************** Case 169 *************** alter system refresh time_zone_info; question_mask_size: 0 { @@ -21900,25 +22056,25 @@ question_mask_size: 0 } ] } -************** Case 166 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); -************** Case 167 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales where t2.id!= t1.id when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); -************** Case 168 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales where t1.id < 3 delete where t1.id < 5 when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); -************** Case 169 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales delete where t1.sales =2 when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); ************** Case 170 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales) where t2.id > 0; +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); ************** Case 171 *************** -merge into targetTable t1 using sourceTable t2 on (1 = 2) when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales) where t2.id > 0; +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales where t2.id!= t1.id when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); ************** Case 172 *************** -merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales; +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales where t1.id < 3 delete where t1.id < 5 when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); ************** Case 173 *************** -merge into targetTable using sourceTable on (targetTable.id = sourceTable.id) when matched then update set targetTable.sales = sourceTable.sales; +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales delete where t1.sales =2 when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales); ************** Case 174 *************** -merge into targetTable using (select * from t1 ) sourceTable on (targetTable.id = sourceTable.id) when matched then update set targetTable.sales = sourceTable.sales; +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales) where t2.id > 0; ************** Case 175 *************** +merge into targetTable t1 using sourceTable t2 on (1 = 2) when not matched then insert(t1.id, t1.sales) values(t2.id, t2.sales) where t2.id > 0; +************** Case 176 *************** +merge into targetTable t1 using sourceTable t2 on (t1.id = t2.id) when matched then update set t1.sales = t2.sales; +************** Case 177 *************** +merge into targetTable using sourceTable on (targetTable.id = sourceTable.id) when matched then update set targetTable.sales = sourceTable.sales; +************** Case 178 *************** +merge into targetTable using (select * from t1 ) sourceTable on (targetTable.id = sourceTable.id) when matched then update set targetTable.sales = sourceTable.sales; +************** Case 179 *************** select unique(c1), c2 from t1; question_mask_size: 0 { @@ -22062,7 +22218,7 @@ question_mask_size: 0 } ] } -************** Case 176 *************** +************** Case 180 *************** select unique(c1+1), c2 from t1; question_mask_size: 0 { @@ -22220,7 +22376,7 @@ question_mask_size: 0 } ] } -************** Case 177 *************** +************** Case 181 *************** select distinct unique( max(c1)), c2 from t1; question_mask_size: 0 { @@ -22379,7 +22535,7 @@ question_mask_size: 0 } ] } -************** Case 178 *************** +************** Case 182 *************** select unique distinct( max(c1)), c2 from t1; question_mask_size: 0 { @@ -22538,9 +22694,9 @@ question_mask_size: 0 } ] } -************** Case 179 *************** +************** Case 183 *************** select unique(*) from t1; -************** Case 180 *************** +************** Case 184 *************** alter tablegroup tg2 add table t1,t2; question_mask_size: 0 { @@ -22605,7 +22761,7 @@ question_mask_size: 0 } ] } -************** Case 181 *************** +************** Case 185 *************** insert into t1 values(X''); question_mask_size: 0 { @@ -22699,7 +22855,7 @@ question_mask_size: 0 } ] } -************** Case 182 *************** +************** Case 186 *************** create table t1(`thedate` date NOT NULL COMMENT '日期'); question_mask_size: 0 { @@ -22806,7 +22962,7 @@ question_mask_size: 0 } ] } -************** Case 183 *************** +************** Case 187 *************** alter system bootstrap REGION 'sys_region' ZONE 'zone1' SERVER '10.101.74.122:41425'; question_mask_size: 0 { diff --git a/unittest/sql/parser/test_parser.sql b/unittest/sql/parser/test_parser.sql index 246da0dd7..3e0915f9e 100644 --- a/unittest/sql/parser/test_parser.sql +++ b/unittest/sql/parser/test_parser.sql @@ -63,9 +63,13 @@ alter system recycle replica zone 'z1'; alter system major freeze; alter system start merge zone = 'z1'; alter system suspend merge; -alter system suspend merge tenant = all; +alter system suspend merge tenant = sys; +alter system suspend merge tenant = all_user; +alter system suspend merge tenant = all_meta; alter system resume merge; -alter system resume merge tenant = all; +alter system resume merge tenant = sys; +alter system resume merge tenant = all_user; +alter system resume merge tenant = all_meta; alter system clear roottable; alter system clear roottable tenant = 'xxx'; select * from t1 where c1>ANY(select c1 from t2 where c2>1); diff --git a/unittest/sql/parser/test_parser.test b/unittest/sql/parser/test_parser.test index 501818786..696e4d2cb 100644 --- a/unittest/sql/parser/test_parser.test +++ b/unittest/sql/parser/test_parser.test @@ -81,9 +81,13 @@ alter system recycle replica zone 'z1'; alter system major freeze; alter system start merge zone = 'z1'; alter system suspend merge; -alter system suspend merge tenant = all; +alter system suspend merge tenant = sys; +alter system suspend merge tenant = all_user; +alter system suspend merge tenant = all_meta; alter system resume merge; -alter system resume merge tenant = all; +alter system resume merge tenant = sys; +alter system resume merge tenant = all_user; +alter system resume merge tenant = all_meta; alter system clear roottable; alter system clear roottable tenant = 'xxx'; alter system modify zone 'z1' set region 'r1'