From 7d8c4a42fc8f33c77bb1946b4933bacccd43c7d2 Mon Sep 17 00:00:00 2001 From: tino247 Date: Mon, 21 Nov 2022 07:29:40 +0000 Subject: [PATCH] [UPGRADE] Remove unused compatible code --- .../libobcdc/src/ob_log_all_svr_cache.cpp | 21 +- .../src/ob_log_sys_ls_task_handler.cpp | 1 - .../libobcdc/src/ob_log_systable_helper.cpp | 39 +--- .../libobcdc/src/ob_log_systable_helper.h | 4 - .../libobcdc/src/ob_log_tenant_mgr.cpp | 4 +- .../src/ob_log_timezone_info_getter.cpp | 2 +- .../tests/ob_binlog_record_printer.cpp | 3 +- src/observer/mysql/obmp_connect.cpp | 13 +- src/observer/mysql/obmp_query.cpp | 3 +- src/observer/ob_server.cpp | 4 +- src/observer/ob_server_reload_config.cpp | 5 +- src/observer/ob_srv_network_frame.cpp | 9 +- .../ob_show_create_procedure.cpp | 6 - .../virtual_table/ob_show_create_table.cpp | 21 +- src/pl/ob_pl_user_type.cpp | 22 +- src/pl/sys_package/ob_dbms_application.cpp | 45 ++-- src/pl/sys_package/ob_dbms_stats.cpp | 3 +- .../backup/ob_backup_data_scheduler.cpp | 2 +- .../backup/ob_backup_data_set_task_mgr.cpp | 2 +- .../backup/ob_backup_lease_service.cpp | 5 - src/rootserver/ob_ddl_operator.cpp | 119 ++++------- src/rootserver/ob_ddl_service.cpp | 161 ++++++-------- src/rootserver/ob_root_service.cpp | 7 +- src/rootserver/ob_server_manager.cpp | 4 +- src/rootserver/ob_system_admin_util.cpp | 2 +- src/rootserver/ob_unit_manager.cpp | 7 - src/rootserver/ob_zone_manager.cpp | 6 +- src/share/ob_cluster_info_proxy.cpp | 4 +- src/share/ob_cluster_version.h | 10 - src/share/ob_simple_batch.h | 2 +- src/share/ob_zone_table_operation.cpp | 38 ---- src/share/ob_zone_table_operation.h | 2 - .../ob_resource_manager_proxy.cpp | 6 - src/share/rpc/ob_batch_proxy.cpp | 16 +- src/share/rpc/ob_batch_rpc.cpp | 18 +- src/share/rpc/ob_batch_rpc.h | 18 +- src/share/schema/ob_column_schema.cpp | 3 +- src/share/schema/ob_dependency_info.cpp | 185 ++++++++-------- src/share/schema/ob_keystore_sql_service.cpp | 17 +- src/share/schema/ob_profile_sql_service.cpp | 6 +- src/share/schema/ob_schema_getter_guard.cpp | 110 ++++------ src/share/schema/ob_schema_mgr.cpp | 96 ++++----- src/share/schema/ob_schema_retrieve_utils.ipp | 57 +---- .../schema/ob_schema_service_sql_impl.cpp | 198 ++++++------------ src/share/schema/ob_schema_struct.cpp | 1 - src/share/schema/ob_schema_utils.cpp | 19 +- src/share/schema/ob_sequence_sql_service.cpp | 5 +- src/share/schema/ob_table_schema.cpp | 12 +- src/share/schema/ob_table_sql_service.cpp | 186 +++++----------- src/share/schema/ob_udt_sql_service.cpp | 12 +- src/share/stat/ob_opt_stat_sql_service.cpp | 9 - src/sql/engine/cmd/ob_table_executor.cpp | 138 ------------ src/sql/engine/cmd/ob_table_executor.h | 8 - src/sql/engine/ob_exec_context.cpp | 2 +- src/sql/engine/sort/ob_base_sort.h | 4 +- src/sql/ob_sql_utils.cpp | 8 +- .../resolver/ddl/ob_drop_index_resolver.cpp | 8 +- .../resolver/ddl/ob_flashback_resolver.cpp | 16 +- src/sql/resolver/ddl/ob_purge_resolver.cpp | 16 +- src/sql/resolver/ob_schema_checker.cpp | 33 --- .../ob_physical_copy_task.cpp | 2 +- .../memtable/ob_memtable_compact_writer.cpp | 4 +- src/storage/memtable/ob_memtable_context.cpp | 1 - src/storage/memtable/ob_memtable_mutator.cpp | 2 - src/storage/tx/ob_trans_ctx.h | 8 - src/storage/tx/wrs/ob_weak_read_util.cpp | 1 - .../encoding/test_micro_block_encoder.cpp | 47 ++--- 67 files changed, 509 insertions(+), 1339 deletions(-) diff --git a/src/logservice/libobcdc/src/ob_log_all_svr_cache.cpp b/src/logservice/libobcdc/src/ob_log_all_svr_cache.cpp index f6d1cad3d..124d8847d 100644 --- a/src/logservice/libobcdc/src/ob_log_all_svr_cache.cpp +++ b/src/logservice/libobcdc/src/ob_log_all_svr_cache.cpp @@ -220,18 +220,13 @@ int ObLogAllSvrCache::get_agent_svr(const common::ObAddrWithSeq &principal_svr, { int ret = OB_SUCCESS; agent_svr.reset(); - // agent_cache available if ob cluster versin equal/greater than 3_2_0 - if (is_cluster_version_be_equal_or_greater_than_320()) { - AgentSvrItem item; - if (OB_FAIL(get_agent_item_(principal_svr, item))) { - if (OB_ENTRY_NOT_EXIST != ret) { - LOG_ERROR("get_agent_svr from cache fail", KR(ret), K(principal_svr), K(item)); - } - } else { - agent_svr = item.agent_svr_; + AgentSvrItem item; + if (OB_FAIL(get_agent_item_(principal_svr, item))) { + if (OB_ENTRY_NOT_EXIST != ret) { + LOG_ERROR("get_agent_svr from cache fail", KR(ret), K(principal_svr), K(item)); } } else { - ret = OB_ENTRY_NOT_EXIST; + agent_svr = item.agent_svr_; } return ret; } @@ -600,10 +595,8 @@ bool ObLogAllSvrCache::need_update_agent_() bool bool_ret = false; const int64_t all_svr_agent_cache_update_interval = ATOMIC_LOAD(&g_all_svr_agent_cache_update_interval); const int64_t update_delta_time = get_timestamp() - agent_last_update_tstamp_; - // update policy: 0. cluster version should be at least 3_2_0; 1. nerver updated; 2. periodicity update - if (! is_cluster_version_be_equal_or_greater_than_320()) { - bool_ret = false; - } else if (OB_INVALID_TIMESTAMP == agent_last_update_tstamp_) { + // update policy: 1. nerver updated; 2. periodicity update + if (OB_INVALID_TIMESTAMP == agent_last_update_tstamp_) { bool_ret = true; } else if (update_delta_time >= all_svr_agent_cache_update_interval) { bool_ret = true; diff --git a/src/logservice/libobcdc/src/ob_log_sys_ls_task_handler.cpp b/src/logservice/libobcdc/src/ob_log_sys_ls_task_handler.cpp index e9a0a4c35..4880a8cf3 100644 --- a/src/logservice/libobcdc/src/ob_log_sys_ls_task_handler.cpp +++ b/src/logservice/libobcdc/src/ob_log_sys_ls_task_handler.cpp @@ -21,7 +21,6 @@ #include "ob_log_schema_getter.h" // IObLogSchemaGetter #include "ob_log_tenant_mgr.h" // IObLogTenantMgr #include "ob_log_config.h" // TCONF -#include "share/ob_cluster_version.h" // GET_MIN_CLUSTER_VERSION #define _STAT(level, fmt, args...) _OBLOG_LOG(level, "[STAT] [SYS_LS_HANDLER] " fmt, ##args) #define STAT(level, fmt, args...) OBLOG_LOG(level, "[STAT] [SYS_LS_HANDLER] " fmt, ##args) diff --git a/src/logservice/libobcdc/src/ob_log_systable_helper.cpp b/src/logservice/libobcdc/src/ob_log_systable_helper.cpp index 24768677e..f4a84a80c 100644 --- a/src/logservice/libobcdc/src/ob_log_systable_helper.cpp +++ b/src/logservice/libobcdc/src/ob_log_systable_helper.cpp @@ -20,7 +20,6 @@ #include "common/ob_role.h" // LEADER #include "share/inner_table/ob_inner_table_schema_constants.h" // OB_***_TNAME -#include "share/ob_cluster_version.h" // GET_MIN_CLUSTER_VERSION #include "share/schema/ob_schema_struct.h" // TenantStatus #include "ob_log_config.h" // ObLogConfig, TCONF #include "ob_log_utils.h" @@ -47,36 +46,6 @@ namespace libobcdc bool ISQLStrategy::g_is_replica_type_info_valid = true; -bool is_cluster_version_be_equal_or_greater_than_200_() -{ - bool bool_ret = true; - - // ob version: 2_0_0 - bool_ret = (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2000); - - return bool_ret; -} - -bool is_cluster_version_be_equal_or_greater_than_220_() -{ - bool bool_ret = true; - - // ob version: 2_2_0 - bool_ret = (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2200); - - return bool_ret; -} - -bool is_cluster_version_be_equal_or_greater_than_320() -{ - bool bool_ret = true; - - // ob version: 3_2_0 - bool_ret = (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3200); - - return bool_ret; -} - ////////////////////////////////////// QueryClusterId ///////////////////////////////// int QueryClusterIdStrategy::build_sql_statement(char *sql_buf, const int64_t mul_statement_buf_len, @@ -129,13 +98,9 @@ int QueryTimeZoneInfoVersionStrategy::build_sql_statement(char *sql_buf, int ret = OB_SUCCESS; pos = 0; const char *query_sql = NULL; - const bool need_query_tenant_timezone_version = (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2260); + const bool need_query_tenant_timezone_version = true; - if (need_query_tenant_timezone_version) { - query_sql = "select value from __all_virtual_sys_stat where name='current_timezone_version' and tenant_id="; - } else { - query_sql = "select value from __all_zone where name='time_zone_info_version';"; - } + query_sql = "select value from __all_virtual_sys_stat where name='current_timezone_version' and tenant_id="; if (OB_ISNULL(sql_buf) || OB_UNLIKELY(mul_statement_buf_len <=0)) { LOG_ERROR("invalid argument", K(sql_buf), K(mul_statement_buf_len)); ret = OB_INVALID_ARGUMENT; diff --git a/src/logservice/libobcdc/src/ob_log_systable_helper.h b/src/logservice/libobcdc/src/ob_log_systable_helper.h index 1938f0277..6b2b75265 100644 --- a/src/logservice/libobcdc/src/ob_log_systable_helper.h +++ b/src/logservice/libobcdc/src/ob_log_systable_helper.h @@ -52,10 +52,6 @@ public: virtual int build_sql_statement(char *sql_buf, const int64_t mul_statement_buf_len, int64_t &pos) = 0; }; -bool is_cluster_version_be_equal_or_greater_than_200_(); -bool is_cluster_version_be_equal_or_greater_than_220_(); -bool is_cluster_version_be_equal_or_greater_than_320(); - ///////////////////////// QueryClusterIdStrategy ///////////////////////// // 查询cluster id class QueryClusterIdStrategy: public ISQLStrategy diff --git a/src/logservice/libobcdc/src/ob_log_tenant_mgr.cpp b/src/logservice/libobcdc/src/ob_log_tenant_mgr.cpp index e19677006..cee41f7db 100644 --- a/src/logservice/libobcdc/src/ob_log_tenant_mgr.cpp +++ b/src/logservice/libobcdc/src/ob_log_tenant_mgr.cpp @@ -1178,7 +1178,7 @@ int ObLogTenantMgr::get_tenant_tz_wrap(const uint64_t tenant_id, ObTimeZoneInfoW { int ret = OB_SUCCESS; ObLogTenantGuard guard; - const uint64_t tz_tenant_id = GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2260 ? tenant_id : OB_SYS_TENANT_ID; + const uint64_t tz_tenant_id = tenant_id; if (OB_SYS_TENANT_ID == tz_tenant_id) { tz_info_wrap = &TCTX.tz_info_wrap_; @@ -1208,7 +1208,7 @@ int ObLogTenantMgr::get_tenant_tz_map(const uint64_t tenant_id, { int ret = OB_SUCCESS; ObLogTenantGuard guard; - //const uint64_t tz_tenant_id = GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2260 ? tenant_id : OB_SYS_TENANT_ID; + //TODO:(madoll.tw) should use tenant_id as tz_tenant_id const uint64_t tz_tenant_id = OB_SYS_TENANT_ID; if (OB_SYS_TENANT_ID == tz_tenant_id) { diff --git a/src/logservice/libobcdc/src/ob_log_timezone_info_getter.cpp b/src/logservice/libobcdc/src/ob_log_timezone_info_getter.cpp index 6e0a97ef3..957bb7f9a 100644 --- a/src/logservice/libobcdc/src/ob_log_timezone_info_getter.cpp +++ b/src/logservice/libobcdc/src/ob_log_timezone_info_getter.cpp @@ -213,7 +213,7 @@ int ObLogTimeZoneInfoGetter::refresh_timezone_info_() bool ObLogTimeZoneInfoGetter::need_fetch_timezone_info_by_tennat_() const { - return GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2260; + return true; } int ObLogTimeZoneInfoGetter::refresh_tenant_timezone_info_based_on_version_(const uint64_t tenant_id) diff --git a/src/logservice/libobcdc/tests/ob_binlog_record_printer.cpp b/src/logservice/libobcdc/tests/ob_binlog_record_printer.cpp index 0f642e09d..74016cca3 100644 --- a/src/logservice/libobcdc/tests/ob_binlog_record_printer.cpp +++ b/src/logservice/libobcdc/tests/ob_binlog_record_printer.cpp @@ -441,8 +441,7 @@ int ObBinlogRecordPrinter::parse_major_version_(const binlogBuf *filter_rv, int3 int ret = OB_SUCCESS; major_version = -1; // default -1, invalid value // Get major version, major version is only output if version 1.x is configured and the corresponding configuration item is configured - bool need_major_version = common::ObClusterVersion::get_instance().get_cluster_version() < CLUSTER_VERSION_2000 - && TCONF.test_mode_on && TCONF.test_output_major_version; + bool need_major_version = false; if (need_major_version) { const binlogBuf *major_version_buf = filter_rv + 3; major_version = (int32_t) atoi(major_version_buf->buf); diff --git a/src/observer/mysql/obmp_connect.cpp b/src/observer/mysql/obmp_connect.cpp index a4cd5afda..32f1d53f1 100644 --- a/src/observer/mysql/obmp_connect.cpp +++ b/src/observer/mysql/obmp_connect.cpp @@ -532,14 +532,12 @@ int ObMPConnect::load_privilege_info(ObSQLSessionInfo &session) int inner_ret = OB_SUCCESS; bool is_unlocked = false; if (ORACLE_MODE == session.get_compatibility_mode() - && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3000 && OB_ERR_USER_IS_LOCKED == ret) { if (OB_SUCCESS != (inner_ret = unlock_user_if_time_is_up(conn->tenant_id_, schema_guard, is_unlocked))) { LOG_WARN("fail to check user unlock", K(inner_ret)); } } if (MYSQL_MODE == session.get_compatibility_mode() - && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3200 && OB_ERR_USER_IS_LOCKED == ret) { if (OB_SUCCESS != (inner_ret = unlock_user_if_time_is_up_mysql(conn->tenant_id_, session_priv.user_id_, @@ -598,7 +596,6 @@ int ObMPConnect::load_privilege_info(ObSQLSessionInfo &session) if (ORACLE_MODE == session.get_compatibility_mode() - && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3000 && (OB_SUCC(ret) || OB_PASSWORD_WRONG == ret)) { int login_ret = ret; if (OB_FAIL(update_login_stat_in_trans(conn->tenant_id_, OB_SUCCESS == login_ret, schema_guard))) { @@ -609,7 +606,6 @@ int ObMPConnect::load_privilege_info(ObSQLSessionInfo &session) } if (MYSQL_MODE == session.get_compatibility_mode() - && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3200 && (OB_SUCC(ret) || OB_PASSWORD_WRONG == ret || OB_ERR_USER_IS_LOCKED == ret)) { int login_ret = ret; bool is_unlocked_now = false; @@ -625,7 +621,7 @@ int ObMPConnect::load_privilege_info(ObSQLSessionInfo &session) } } - if ((OB_SUCC(ret) && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2276)) { + if (OB_SUCC(ret)) { if (OB_FAIL(check_password_expired(conn->tenant_id_, schema_guard, session))) { LOG_WARN("fail to check password expired", K(ret)); } @@ -1908,12 +1904,7 @@ int ObMPConnect::verify_ip_white_list(const uint64_t tenant_id) const ret = OB_ERR_UNEXPECTED; LOG_WARN("sys variable schema is null", K(ret)); } else if (OB_FAIL(sys_variable_schema->get_sysvar_schema(var_name, sysvar))) { - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_1470) { - LOG_INFO("maybe server is upgrading, ignore verified", "version", GET_MIN_CLUSTER_VERSION(), K(ret)); - } else { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("fail to get_sysvar_schema", K(ret)); - } + LOG_WARN("fail to get_sysvar_schema", K(ret)); } else { ObString var_value = sysvar->get_value(); if (!ObHostnameStuct::is_in_white_list(client_ip_, var_value)) { diff --git a/src/observer/mysql/obmp_query.cpp b/src/observer/mysql/obmp_query.cpp index 46aba7c85..e363d8aa3 100644 --- a/src/observer/mysql/obmp_query.cpp +++ b/src/observer/mysql/obmp_query.cpp @@ -445,8 +445,7 @@ int ObMPQuery::try_batched_multi_stmt_optimization(sql::ObSQLSessionInfo &sessio bool enable_batch_opt = session.is_enable_batched_multi_statement(); bool use_plan_cache = session.get_local_ob_enable_plan_cache(); optimization_done = false; - if (queries.count() <= 1 || parse_stat.parse_fail_ || - GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2230) { + if (queries.count() <= 1 || parse_stat.parse_fail_) { /*do nothing*/ } else if (!enable_batch_opt) { // 未打开batch开关 diff --git a/src/observer/ob_server.cpp b/src/observer/ob_server.cpp index 36e4f07f4..44f2d5533 100644 --- a/src/observer/ob_server.cpp +++ b/src/observer/ob_server.cpp @@ -1364,9 +1364,7 @@ int ObServer::init_config() } get_unis_global_compat_version() = GET_MIN_CLUSTER_VERSION(); - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2100) { - lib::g_runtime_enabled = true; - } + lib::g_runtime_enabled = true; return ret; } diff --git a/src/observer/ob_server_reload_config.cpp b/src/observer/ob_server_reload_config.cpp index 26737dcf7..ecf0ccd0b 100644 --- a/src/observer/ob_server_reload_config.cpp +++ b/src/observer/ob_server_reload_config.cpp @@ -251,9 +251,8 @@ int ObServerReloadConfig::operator()() } get_unis_global_compat_version() = GET_MIN_CLUSTER_VERSION(); - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2100) { - lib::g_runtime_enabled = true; - } + lib::g_runtime_enabled = true; + common::ObKVGlobalCache::get_instance().reload_wash_interval(); { int tmp_ret = OB_SUCCESS; diff --git a/src/observer/ob_srv_network_frame.cpp b/src/observer/ob_srv_network_frame.cpp index b9edde636..eb4e5d0b2 100644 --- a/src/observer/ob_srv_network_frame.cpp +++ b/src/observer/ob_srv_network_frame.cpp @@ -105,13 +105,8 @@ int ObSrvNetworkFrame::init() } else { opts.enable_tcp_keepalive_ = 0; } - if (IS_CLUSTER_VERSION_BEFORE_4_0_0_0) { - LOG_INFO("io thread connection negotiation not enabled!"); - negotiation_enable = 0; - } else { - LOG_INFO("io thread connection negotiation enabled!"); - negotiation_enable = 1; - } + LOG_INFO("io thread connection negotiation enabled!"); + negotiation_enable = 1; deliver_.set_host(gctx_.self_addr()); diff --git a/src/observer/virtual_table/ob_show_create_procedure.cpp b/src/observer/virtual_table/ob_show_create_procedure.cpp index 4db774718..cbb1d2aa7 100644 --- a/src/observer/virtual_table/ob_show_create_procedure.cpp +++ b/src/observer/virtual_table/ob_show_create_procedure.cpp @@ -163,12 +163,6 @@ int ObShowCreateProcedure::fill_row_cells(uint64_t show_procedure_id, const ObRo } if (OB_FAIL(ret)) { // do nothing - } else if (GET_MIN_CLUSTER_VERSION() <= CLUSTER_VERSION_2271) { - // 这个字段的类型会在在2272版本从varchar改为longtext,但升级过程中会在一个时间窗口内 - // 不确定当前节点是否已经刷到最新的schema,所以只能以实际column_schema信息为准。 - ObString value_str(static_cast(pos), - static_cast(pos), routine_def_buf); - cur_row_.cells_[cell_idx].set_varchar(value_str); } else { cur_row_.cells_[cell_idx].set_lob_value(ObLongTextType, routine_def_buf, static_cast(pos)); diff --git a/src/observer/virtual_table/ob_show_create_table.cpp b/src/observer/virtual_table/ob_show_create_table.cpp index 3b2bf57c7..72e13d153 100644 --- a/src/observer/virtual_table/ob_show_create_table.cpp +++ b/src/observer/virtual_table/ob_show_create_table.cpp @@ -195,26 +195,7 @@ int ObShowCreateTable::fill_row_cells(uint64_t show_table_id, } } if (OB_SUCC(ret)) { - // This column type is changed from varchar to longtext in ver 3.1.0. - // For compatibility, column type should be determined by schema before cluster is in upgrade mode. - bool type_is_lob = true; - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3100) { - const ObColumnSchemaV2 *column_schema = NULL; - if (OB_ISNULL(table_schema_) || - OB_ISNULL(column_schema = table_schema_->get_column_schema(col_id))) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("table or column schema is null", K(ret), KP(table_schema_), KP(column_schema)); - } else { - type_is_lob = column_schema->get_meta_type().is_lob(); - } - } - if (OB_FAIL(ret)) { - } else if (type_is_lob) { - cur_row_.cells_[cell_idx].set_lob_value(ObLongTextType, table_def_buf, static_cast(pos)); - } else { - ObString value_str(static_cast(pos), static_cast(pos), table_def_buf); - cur_row_.cells_[cell_idx].set_varchar(value_str); - } + cur_row_.cells_[cell_idx].set_lob_value(ObLongTextType, table_def_buf, static_cast(pos)); cur_row_.cells_[cell_idx].set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); } break; diff --git a/src/pl/ob_pl_user_type.cpp b/src/pl/ob_pl_user_type.cpp index b5cdcc074..177fd63fe 100644 --- a/src/pl/ob_pl_user_type.cpp +++ b/src/pl/ob_pl_user_type.cpp @@ -1125,10 +1125,8 @@ int ObRecordType::get_serialize_size( int ret = OB_SUCCESS; ObPLRecord *record = reinterpret_cast(src); CK (OB_NOT_NULL(record)); - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0) { - OX (size += record->get_serialize_size()); - OX (size += serialization::encoded_length(record->get_count())); - } + OX (size += record->get_serialize_size()); + OX (size += serialization::encoded_length(record->get_count())); char *data = reinterpret_cast(record->get_element()); for (int64_t i = 0; OB_SUCC(ret) && i < record_members_.count(); ++i) { @@ -1146,10 +1144,8 @@ int ObRecordType::serialize( int ret = OB_SUCCESS; ObPLRecord *record = reinterpret_cast(src); CK (OB_NOT_NULL(record)); - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0) { - OX (record->serialize(dst, dst_len, dst_pos)); - OZ (serialization::encode(dst, dst_len, dst_pos, record->get_count())); - } + OX (record->serialize(dst, dst_len, dst_pos)); + OZ (serialization::encode(dst, dst_len, dst_pos, record->get_count())); char *data = reinterpret_cast(record->get_element()); for (int64_t i = 0; OB_SUCC(ret) && i < record_members_.count(); ++i) { @@ -1168,12 +1164,10 @@ int ObRecordType::deserialize( int ret = OB_SUCCESS; ObPLRecord *record = reinterpret_cast(dst); CK (OB_NOT_NULL(record)); - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0) { - int64_t count = OB_INVALID_COUNT; - OX (record->deserialize(src, src_len, src_pos)); - OZ (serialization::decode(src, src_len, src_pos, count)); - OX (record->set_count(count)); - } + int64_t count = OB_INVALID_COUNT; + OX (record->deserialize(src, src_len, src_pos)); + OZ (serialization::decode(src, src_len, src_pos, count)); + OX (record->set_count(count)); dst = reinterpret_cast(record->get_element()); for (int64_t i = 0; OB_SUCC(ret) && i < record_members_.count(); ++i) { diff --git a/src/pl/sys_package/ob_dbms_application.cpp b/src/pl/sys_package/ob_dbms_application.cpp index 804139350..b7cd84142 100644 --- a/src/pl/sys_package/ob_dbms_application.cpp +++ b/src/pl/sys_package/ob_dbms_application.cpp @@ -30,16 +30,11 @@ int ObDBMSAppInfo::read_client_info(sql::ObExecContext &ctx, sql::ParamStore &pa int ret = OB_SUCCESS; ObString client_info; UNUSED(result); - if (OB_UNLIKELY(GET_MIN_CLUSTER_VERSION() <= CLUSTER_VERSION_3_2_3_0)) { - ret = OB_OP_NOT_ALLOW; - LOG_USER_ERROR(OB_OP_NOT_ALLOW, "cluster is not ready, and dbms_application_info not support"); - } else { - CK (OB_NOT_NULL(ctx.get_my_session())); - CK (OB_LIKELY(1 == params.count())); - OV (params.at(0).get_param_meta().is_varchar(), OB_INVALID_ARGUMENT); - client_info = ctx.get_my_session()->get_client_info(); - params.at(0).set_varchar(client_info); - } + CK (OB_NOT_NULL(ctx.get_my_session())); + CK (OB_LIKELY(1 == params.count())); + OV (params.at(0).get_param_meta().is_varchar(), OB_INVALID_ARGUMENT); + client_info = ctx.get_my_session()->get_client_info(); + params.at(0).set_varchar(client_info); return ret; } // this is a procedure, and not need to return result @@ -49,19 +44,14 @@ int ObDBMSAppInfo::read_module(sql::ObExecContext &ctx, sql::ParamStore ¶ms, ObString module_name; ObString action_name; UNUSED(result); - if (OB_UNLIKELY(GET_MIN_CLUSTER_VERSION() <= CLUSTER_VERSION_3_2_3_0)) { - ret = OB_OP_NOT_ALLOW; - LOG_USER_ERROR(OB_OP_NOT_ALLOW, "cluster is not ready, and dbms_application_info not support"); - } else { - CK (OB_NOT_NULL(ctx.get_my_session())); - CK (OB_LIKELY(2 == params.count())); - OV (params.at(0).get_param_meta().is_varchar(), OB_INVALID_ARGUMENT); - OV (params.at(1).get_param_meta().is_varchar(), OB_INVALID_ARGUMENT); - module_name = ctx.get_my_session()->get_module_name(); - action_name = ctx.get_my_session()->get_action_name(); - params.at(0).set_varchar(module_name); - params.at(1).set_varchar(action_name); - } + CK (OB_NOT_NULL(ctx.get_my_session())); + CK (OB_LIKELY(2 == params.count())); + OV (params.at(0).get_param_meta().is_varchar(), OB_INVALID_ARGUMENT); + OV (params.at(1).get_param_meta().is_varchar(), OB_INVALID_ARGUMENT); + module_name = ctx.get_my_session()->get_module_name(); + action_name = ctx.get_my_session()->get_action_name(); + params.at(0).set_varchar(module_name); + params.at(1).set_varchar(action_name); return ret; } // this is a procedure, and not need to return result @@ -74,9 +64,6 @@ int ObDBMSAppInfo::set_action(sql::ObExecContext &ctx, sql::ParamStore ¶ms, ObSQLSessionInfo* sess = const_cast(ctx.get_my_session()); if (OB_FAIL(ret)) { // do nothing - } else if (OB_UNLIKELY(GET_MIN_CLUSTER_VERSION() <= CLUSTER_VERSION_3_2_3_0)) { - ret = OB_OP_NOT_ALLOW; - LOG_USER_ERROR(OB_OP_NOT_ALLOW, "cluster is not ready, and dbms_application_info not support"); } else if (sess->is_obproxy_mode() && !sess->is_ob20_protocol()) { ret = OB_OP_NOT_ALLOW; LOG_USER_ERROR(OB_OP_NOT_ALLOW, "oceanbase 2.0 protocol is not ready, and dbms_application_info not support"); @@ -110,9 +97,6 @@ int ObDBMSAppInfo::set_client_info(sql::ObExecContext &ctx, sql::ParamStore &par ObSQLSessionInfo* sess = const_cast(ctx.get_my_session()); if (OB_FAIL(ret)) { // do nothing - } else if (OB_UNLIKELY(GET_MIN_CLUSTER_VERSION() <= CLUSTER_VERSION_3_2_3_0)) { - ret = OB_OP_NOT_ALLOW; - LOG_USER_ERROR(OB_OP_NOT_ALLOW, "cluster is not ready, and dbms_application_info not support"); } else if (sess->is_obproxy_mode() && !sess->is_ob20_protocol()) { ret = OB_OP_NOT_ALLOW; LOG_USER_ERROR(OB_OP_NOT_ALLOW, "oceanbase 2.0 protocol is not ready, and dbms_application_info not support"); @@ -151,9 +135,6 @@ int ObDBMSAppInfo::set_module(sql::ObExecContext &ctx, sql::ParamStore ¶ms, ObSQLSessionInfo* sess = const_cast(ctx.get_my_session()); if (OB_FAIL(ret)) { // do nothing - } else if (OB_UNLIKELY(GET_MIN_CLUSTER_VERSION() <= CLUSTER_VERSION_3_2_3_0)) { - ret = OB_OP_NOT_ALLOW; - LOG_USER_ERROR(OB_OP_NOT_ALLOW, "cluster is not ready, and dbms_application_info not support"); } else if (sess->is_obproxy_mode() && !sess->is_ob20_protocol()) { ret = OB_OP_NOT_ALLOW; LOG_USER_ERROR(OB_OP_NOT_ALLOW, "oceanbase 2.0 protocol is not ready, and dbms_application_info not support"); diff --git a/src/pl/sys_package/ob_dbms_stats.cpp b/src/pl/sys_package/ob_dbms_stats.cpp index 6d7474c7d..0bc93bb74 100644 --- a/src/pl/sys_package/ob_dbms_stats.cpp +++ b/src/pl/sys_package/ob_dbms_stats.cpp @@ -4890,8 +4890,7 @@ int ObDbmsStats::check_statistic_table_writeable(sql::ObExecContext &ctx) in_restore))) { LOG_WARN("failed to check tenant is restore", K(ret)); } else if (OB_UNLIKELY(in_restore) || - GCTX.is_standby_cluster() || - GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_321) { + GCTX.is_standby_cluster()) { ret = OB_NOT_SUPPORTED; LOG_USER_ERROR(OB_NOT_SUPPORTED, "use dbms_stats during restore or standby cluster"); } diff --git a/src/rootserver/backup/ob_backup_data_scheduler.cpp b/src/rootserver/backup/ob_backup_data_scheduler.cpp index 2e2575406..9ffd6fe30 100644 --- a/src/rootserver/backup/ob_backup_data_scheduler.cpp +++ b/src/rootserver/backup/ob_backup_data_scheduler.cpp @@ -1481,7 +1481,7 @@ int ObUserTenantBackupJobMgr::fill_backup_set_desc_( backup_set_desc.start_replay_scn_ = 0; backup_set_desc.min_restore_scn_ = 0; backup_set_desc.backup_compatible_ = ObBackupSetFileDesc::Compatible::COMPATIBLE_VERSION_1; - backup_set_desc.tenant_compatible_ = ObClusterVersion::get_instance().get_cluster_version(); + backup_set_desc.tenant_compatible_ = GET_MIN_CLUSTER_VERSION(); backup_set_desc.plus_archivelog_ = job_attr.plus_archivelog_; } return ret; diff --git a/src/rootserver/backup/ob_backup_data_set_task_mgr.cpp b/src/rootserver/backup/ob_backup_data_set_task_mgr.cpp index bd582ff40..112c187b4 100644 --- a/src/rootserver/backup/ob_backup_data_set_task_mgr.cpp +++ b/src/rootserver/backup/ob_backup_data_set_task_mgr.cpp @@ -1522,7 +1522,7 @@ int ObBackupSetTaskMgr::write_backup_set_info_( { int ret = OB_SUCCESS; int64_t dest_id = 0; - uint64_t cluster_version = ObClusterVersion::get_instance().get_cluster_version(); + uint64_t cluster_version = GET_MIN_CLUSTER_VERSION(); ObBackupSetFileDesc &backup_set_file = backup_set_info.backup_set_file_; ObBackupDest backup_dest; if (OB_FAIL(ObBackupStorageInfoOperator::get_backup_dest(*sql_proxy_, job_attr_->tenant_id_, set_task_attr.backup_path_, backup_dest))) { diff --git a/src/rootserver/backup/ob_backup_lease_service.cpp b/src/rootserver/backup/ob_backup_lease_service.cpp index a9762fc4f..9f83ee0bf 100644 --- a/src/rootserver/backup/ob_backup_lease_service.cpp +++ b/src/rootserver/backup/ob_backup_lease_service.cpp @@ -464,16 +464,11 @@ int ObBackupLeaseService::check_sys_backup_info_() { int ret = OB_SUCCESS; ObBackupInfoChecker checker; - const uint64_t cluster_observer_version = GET_MIN_CLUSTER_VERSION(); ObBackupInnerTableVersion inner_table_version = OB_BACKUP_INNER_TABLE_VMAX; if (!is_inited_) { ret = OB_NOT_INIT; LOG_ERROR("not inited", K(ret)); - } else if (cluster_observer_version < CLUSTER_VERSION_2277 - || (cluster_observer_version >= CLUSTER_VERSION_3000 && cluster_observer_version <= CLUSTER_VERSION_3100)) { - inner_table_version = OB_BACKUP_INNER_TABLE_V1; - LOG_INFO("no need update meta table", K(cluster_observer_version)); } else if (OB_FAIL(share::ObBackupInfoOperator::get_inner_table_version(*sql_proxy_, inner_table_version))) { LOG_WARN("failed to get backup inner table version", K(ret)); } diff --git a/src/rootserver/ob_ddl_operator.cpp b/src/rootserver/ob_ddl_operator.cpp index 4111b1aea..d0630d858 100644 --- a/src/rootserver/ob_ddl_operator.cpp +++ b/src/rootserver/ob_ddl_operator.cpp @@ -1176,7 +1176,6 @@ int ObDDLOperator::drop_database_to_recyclebin(const ObDatabaseSchema &database_ ret = OB_ERR_UNEXPECTED; LOG_WARN("table is NULL", K(ret)); } else if (table_schema->is_view_table() - && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_322 && OB_FAIL(ObDependencyInfo::delete_schema_object_dependency( trans, tenant_id, @@ -1612,11 +1611,6 @@ int ObDDLOperator::create_sequence_in_create_table(ObTableSchema &table_schema, ObColumnSchemaV2 &column_schema = (**iter); if (!column_schema.is_identity_column()) { continue; - } - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3200) { - ret = OB_NOT_SUPPORTED; - LOG_WARN("create identity column on table is not allowed now", K(ret)); - LOG_USER_ERROR(OB_OP_NOT_ALLOW, "create identity column on table"); } else { ObSequenceDDLProxy ddl_operator(schema_service_); char temp_sequence_name[OB_MAX_SEQUENCE_NAME_LENGTH + 1] = { 0 }; @@ -1728,56 +1722,50 @@ int ObDDLOperator::create_sequence_in_add_column(const ObTableSchema &table_sche { int ret = OB_SUCCESS; if (column_schema.is_identity_column()) { - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3200) { - ret = OB_NOT_SUPPORTED; - LOG_WARN("create identity column on table is not allowed now", K(ret)); - LOG_USER_ERROR(OB_OP_NOT_ALLOW, "create identity column on table"); + ObSequenceDDLProxy ddl_operator(schema_service_); + ObSequenceSchema sequence_schema = sequence_ddl_arg.sequence_schema(); + char temp_sequence_name[OB_MAX_SEQUENCE_NAME_LENGTH + 1] = { 0 }; + int32_t len = snprintf(temp_sequence_name, sizeof(temp_sequence_name), "%s%lu%c%lu", + "ISEQ$$_", + ObSchemaUtils::get_extract_schema_id(column_schema.get_tenant_id(), column_schema.get_table_id()), + '_', + column_schema.get_column_id()); + if (OB_UNLIKELY(len < 0)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("create sequence name fail", K(ret), K(column_schema)); } else { - ObSequenceDDLProxy ddl_operator(schema_service_); - ObSequenceSchema sequence_schema = sequence_ddl_arg.sequence_schema(); - char temp_sequence_name[OB_MAX_SEQUENCE_NAME_LENGTH + 1] = { 0 }; - int32_t len = snprintf(temp_sequence_name, sizeof(temp_sequence_name), "%s%lu%c%lu", - "ISEQ$$_", - ObSchemaUtils::get_extract_schema_id(column_schema.get_tenant_id(), column_schema.get_table_id()), - '_', - column_schema.get_column_id()); - if (OB_UNLIKELY(len < 0)) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("create sequence name fail", K(ret), K(column_schema)); + ObString sequence_name = ObString::make_string(temp_sequence_name); + sequence_schema.set_database_id(table_schema.get_database_id()); + sequence_schema.set_sequence_name(sequence_name); + if (OB_FAIL(ddl_operator.create_sequence(sequence_schema, + sequence_ddl_arg.option_bitset_, + trans, + schema_guard, + NULL))) { + LOG_WARN("create sequence fail", K(ret)); } else { - ObString sequence_name = ObString::make_string(temp_sequence_name); - sequence_schema.set_database_id(table_schema.get_database_id()); - sequence_schema.set_sequence_name(sequence_name); - if (OB_FAIL(ddl_operator.create_sequence(sequence_schema, - sequence_ddl_arg.option_bitset_, - trans, - schema_guard, - NULL))) { - LOG_WARN("create sequence fail", K(ret)); + column_schema.set_sequence_id(sequence_schema.get_sequence_id()); + char sequence_string[OB_MAX_SEQUENCE_NAME_LENGTH + 1] = { 0 }; + uint64_t pure_sequence_id = ObSchemaUtils::get_extract_schema_id(column_schema.get_tenant_id(), column_schema.get_sequence_id()); + len = snprintf(sequence_string, sizeof(sequence_string), "%lu", pure_sequence_id); + if (OB_UNLIKELY(len < 0)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("create sequence name fail", K(ret), K(column_schema)); } else { - column_schema.set_sequence_id(sequence_schema.get_sequence_id()); - char sequence_string[OB_MAX_SEQUENCE_NAME_LENGTH + 1] = { 0 }; - uint64_t pure_sequence_id = ObSchemaUtils::get_extract_schema_id(column_schema.get_tenant_id(), column_schema.get_sequence_id()); - len = snprintf(sequence_string, sizeof(sequence_string), "%lu", pure_sequence_id); - if (OB_UNLIKELY(len < 0)) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("create sequence name fail", K(ret), K(column_schema)); - } else { - ObObjParam cur_default_value; // for desc table - ObObjParam orig_default_value; // for store pure_sequence_id - cur_default_value.set_varchar("SEQUENCE.NEXTVAL"); - cur_default_value.set_collation_type(ObCharset::get_system_collation()); - cur_default_value.set_collation_level(CS_LEVEL_IMPLICIT); - cur_default_value.set_param_meta(); - orig_default_value.set_varchar(sequence_string); - orig_default_value.set_collation_type(ObCharset::get_system_collation()); - orig_default_value.set_collation_level(CS_LEVEL_IMPLICIT); - orig_default_value.set_param_meta(); - if (OB_FAIL(column_schema.set_cur_default_value(cur_default_value))) { - LOG_WARN("set current default value fail", K(ret)); - } else if (OB_FAIL(column_schema.set_orig_default_value(orig_default_value))) { - LOG_WARN("set origin default value fail", K(ret), K(column_schema)); - } + ObObjParam cur_default_value; // for desc table + ObObjParam orig_default_value; // for store pure_sequence_id + cur_default_value.set_varchar("SEQUENCE.NEXTVAL"); + cur_default_value.set_collation_type(ObCharset::get_system_collation()); + cur_default_value.set_collation_level(CS_LEVEL_IMPLICIT); + cur_default_value.set_param_meta(); + orig_default_value.set_varchar(sequence_string); + orig_default_value.set_collation_type(ObCharset::get_system_collation()); + orig_default_value.set_collation_level(CS_LEVEL_IMPLICIT); + orig_default_value.set_param_meta(); + if (OB_FAIL(column_schema.set_cur_default_value(cur_default_value))) { + LOG_WARN("set current default value fail", K(ret)); + } else if (OB_FAIL(column_schema.set_orig_default_value(orig_default_value))) { + LOG_WARN("set origin default value fail", K(ret), K(column_schema)); } } } @@ -4072,7 +4060,6 @@ int ObDDLOperator::drop_table( drop_table_set, is_drop_db))) { LOG_WARN("drop table for not dropped shema failed", K(ret)); } else if (table_schema.is_view_table() - && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_322 && OB_FAIL(ObDependencyInfo::delete_schema_object_dependency( trans, tenant_id, @@ -4299,7 +4286,6 @@ int ObDDLOperator::drop_table_to_recyclebin(const ObTableSchema &table_schema, } else if (OB_FAIL(cleanup_autoinc_cache(table_schema))) { LOG_WARN("fail cleanup auto inc global cache", K(ret)); } else if (table_schema.is_view_table() - && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_322 && OB_FAIL(ObDependencyInfo::delete_schema_object_dependency( trans, tenant_id, @@ -10331,21 +10317,11 @@ int ObDDLOperator::handle_profile_function( if (schema.get_password_lock_time() == ObProfileSchema::INVALID_VALUE) { schema.set_password_lock_time(old_schema->get_password_lock_time()); } - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2276) { - if (schema.get_password_life_time() != ObProfileSchema::INVALID_VALUE) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, "Password_life_time of profile"); - } else if (schema.get_password_grace_time() != ObProfileSchema::INVALID_VALUE) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, "Password_grace_time of profile"); - } - } else { - if (schema.get_password_life_time() == ObProfileSchema::INVALID_VALUE) { - schema.set_password_life_time(old_schema->get_password_life_time()); - } - if (schema.get_password_grace_time() == ObProfileSchema::INVALID_VALUE) { - schema.set_password_grace_time(old_schema->get_password_grace_time()); - } + if (schema.get_password_life_time() == ObProfileSchema::INVALID_VALUE) { + schema.set_password_life_time(old_schema->get_password_life_time()); + } + if (schema.get_password_grace_time() == ObProfileSchema::INVALID_VALUE) { + schema.set_password_grace_time(old_schema->get_password_grace_time()); } } break; @@ -10553,9 +10529,6 @@ int ObDDLOperator::insert_dependency_infos(common::ObMySQLTransaction &trans, ret = OB_ERR_UNEXPECTED; LOG_WARN("illegal schema version or owner id", K(ret), K(schema_version), K(owner_id), K(dep_obj_id)); - } else if (IS_CLUSTER_VERSION_BEFORE_3100) { - // do nothing - LOG_DEBUG("all_dependency schema only support after version 3.1"); } else { for (int64_t i = 0 ; OB_SUCC(ret) && i < dep_infos.count(); ++i) { ObDependencyInfo & dep = dep_infos.at(i); diff --git a/src/rootserver/ob_ddl_service.cpp b/src/rootserver/ob_ddl_service.cpp index 3f21472e7..59aa2faba 100644 --- a/src/rootserver/ob_ddl_service.cpp +++ b/src/rootserver/ob_ddl_service.cpp @@ -1791,8 +1791,7 @@ int ObDDLService::create_tables_in_trans(const bool if_not_exist, LOG_WARN("failed to create table schema, ", K(ret)); } else if (OB_FAIL(ddl_operator.insert_temp_table_info(trans, table_schema))) { LOG_WARN("failed to insert_temp_table_info!", K(ret)); - } else if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_322 - && table_schema.is_view_table() && dep_infos != nullptr && 0 == i) { + } else if (table_schema.is_view_table() && dep_infos != nullptr && 0 == i) { for (int64_t i = 0 ; OB_SUCC(ret) && i < dep_infos->count(); ++i) { ObDependencyInfo dep; if (OB_FAIL(dep.assign(dep_infos->at(i)))) { @@ -2156,10 +2155,7 @@ int ObDDLService::set_new_table_options( if (OB_SUCC(ret) && (alter_collation || alter_charset)) { ObCharsetType charset_type = alter_table_schema.get_charset_type(); ObCollationType collation_type = alter_table_schema.get_collation_type(); - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, "modify character or collation"); - } else if (alter_collation && alter_charset) { + if (alter_collation && alter_charset) { if (!ObCharset::is_valid_collation(charset_type, collation_type)) { ret = OB_ERR_COLLATION_MISMATCH; const char *cs_name = ObCharset::charset_name(charset_type); @@ -3131,23 +3127,18 @@ int ObDDLService::check_alter_table_column(obrpc::ObAlterTableArg &alter_table_a orig_table_schema, schema_guard, *orig_column_schema, *alter_column_schema, is_offline))) { LOG_WARN("failed to check is offline", K(ret)); } else if (is_offline) { - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, "Unsupported type modification"); - } else { - if (alter_column_schema->is_primary_key_) { - if (orig_table_schema.get_rowkey_column_num() > 0) { - if (!orig_table_schema.is_heap_table()) { - ret = OB_ERR_MULTIPLE_PRI_KEY; - RS_LOG(WARN, "multiple primary key defined", K(ret)); - } else { - add_pk = true; - } + if (alter_column_schema->is_primary_key_) { + if (orig_table_schema.get_rowkey_column_num() > 0) { + if (!orig_table_schema.is_heap_table()) { + ret = OB_ERR_MULTIPLE_PRI_KEY; + RS_LOG(WARN, "multiple primary key defined", K(ret)); } else { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("rowkey_column_num must be greater than 0", K(ret), - K(orig_table_schema.get_rowkey_column_num())); + add_pk = true; } + } else { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("rowkey_column_num must be greater than 0", K(ret), + K(orig_table_schema.get_rowkey_column_num())); } } } @@ -3323,19 +3314,14 @@ int ObDDLService::check_alter_table_index(const obrpc::ObAlterTableArg &alter_ta break; } case ObIndexArg::ALTER_PRIMARY_KEY: { - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0) { + if (!is_invalid_ddl_type(ddl_type)) { ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, "alter primary key"); + (void)snprintf(err_msg, sizeof(err_msg), "%s and %s in single statment", + ObIndexArg::to_type_str(last_type), ObIndexArg::to_type_str(type)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, err_msg); } else { - if (!is_invalid_ddl_type(ddl_type)) { - ret = OB_NOT_SUPPORTED; - (void)snprintf(err_msg, sizeof(err_msg), "%s and %s in single statment", - ObIndexArg::to_type_str(last_type), ObIndexArg::to_type_str(type)); - LOG_USER_ERROR(OB_NOT_SUPPORTED, err_msg); - } else { - ddl_type = DDL_ALTER_PRIMARY_KEY; - last_type = type; - } + ddl_type = DDL_ALTER_PRIMARY_KEY; + last_type = type; } break; } @@ -3410,10 +3396,7 @@ int ObDDLService::check_convert_to_character(obrpc::ObAlterTableArg &alter_table AlterTableSchema &alter_table_schema = alter_table_arg.alter_table_schema_; ObCharsetType charset_type = alter_table_schema.get_charset_type(); ObCollationType collation_type = alter_table_schema.get_collation_type(); - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, "modify character or collation"); - } else if (CS_TYPE_INVALID == collation_type) { + if (CS_TYPE_INVALID == collation_type) { // If collation_type is not given, the default collation_type of charset_type is used collation_type = ObCharset::get_default_collation(charset_type); alter_table_schema.set_collation_type(collation_type); @@ -3513,8 +3496,7 @@ int ObDDLService::check_alter_table_partition(const obrpc::ObAlterTableArg &alte const uint64_t tablegroup_id = orig_table_schema.get_tablegroup_id(); const ObPartitionLevel part_level = orig_table_schema.get_part_level(); if (obrpc::ObAlterTableArg::REPARTITION_TABLE == alter_table_arg.alter_part_type_) { - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0 - || (is_oracle_mode && PARTITION_LEVEL_ZERO != part_level)) { + if (is_oracle_mode && PARTITION_LEVEL_ZERO != part_level) { ret = OB_NOT_SUPPORTED; LOG_USER_ERROR(OB_NOT_SUPPORTED, "re-partition a patitioned table"); } else if (OB_INVALID_ID != tablegroup_id) { @@ -3756,49 +3738,43 @@ int ObDDLService::alter_table_primary_key(obrpc::ObAlterTableArg &alter_table_ar } case ObIndexArg::ADD_PRIMARY_KEY: case ObIndexArg::ALTER_PRIMARY_KEY: { - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0) { - ret = OB_NOT_SUPPORTED; - LOG_WARN("alter primary key not support yet", KR(ret)); - LOG_USER_ERROR(OB_NOT_SUPPORTED, "alter primary key "); + if (ObIndexArg::ADD_PRIMARY_KEY == type) { + if (OB_MAX_INDEX_PER_TABLE <= index_count) { + ret = OB_ERR_TOO_MANY_KEYS; + LOG_USER_ERROR(OB_ERR_TOO_MANY_KEYS, OB_MAX_INDEX_PER_TABLE); + LOG_WARN("too many index for table!", K(index_count), K(OB_MAX_INDEX_PER_TABLE)); + } else if (!new_table_schema.is_heap_table()) { + ret = OB_ERR_MULTIPLE_PRI_KEY; + LOG_WARN("multiple primary key defined", K(ret)); + } } else { - if (ObIndexArg::ADD_PRIMARY_KEY == type) { - if (OB_MAX_INDEX_PER_TABLE <= index_count) { - ret = OB_ERR_TOO_MANY_KEYS; - LOG_USER_ERROR(OB_ERR_TOO_MANY_KEYS, OB_MAX_INDEX_PER_TABLE); - LOG_WARN("too many index for table!", K(index_count), K(OB_MAX_INDEX_PER_TABLE)); - } else if (!new_table_schema.is_heap_table()) { - ret = OB_ERR_MULTIPLE_PRI_KEY; - LOG_WARN("multiple primary key defined", K(ret)); - } - } else { - if (new_table_schema.is_heap_table()) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("primary key does not exist!", K(ret)); + if (new_table_schema.is_heap_table()) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("primary key does not exist!", K(ret)); + } + } + if (OB_SUCC(ret)) { + ObCreateIndexArg *create_index_arg = static_cast(index_arg); + ObSArray index_columns; + for (int32_t i = 0; OB_SUCC(ret) + && i < create_index_arg->index_columns_.count(); ++i) { + const ObColumnSortItem &col_item = create_index_arg->index_columns_.at(i); + if (OB_FAIL(index_columns.push_back(col_item.column_name_))) { + LOG_WARN("failed to add index column name", K(ret)); } } - if (OB_SUCC(ret)) { - ObCreateIndexArg *create_index_arg = static_cast(index_arg); - ObSArray index_columns; - for (int32_t i = 0; OB_SUCC(ret) - && i < create_index_arg->index_columns_.count(); ++i) { - const ObColumnSortItem &col_item = create_index_arg->index_columns_.at(i); - if (OB_FAIL(index_columns.push_back(col_item.column_name_))) { - LOG_WARN("failed to add index column name", K(ret)); - } - } - if (OB_SUCC(ret) && - OB_FAIL(create_hidden_table_with_pk_changed(alter_table_arg, - index_columns, - origin_table_schema, - new_table_schema, - frozen_version, - schema_guard, - ddl_operator, - trans, - allocator, - type))) { - LOG_WARN("failed to add primary key", K(ret)); - } + if (OB_SUCC(ret) && + OB_FAIL(create_hidden_table_with_pk_changed(alter_table_arg, + index_columns, + origin_table_schema, + new_table_schema, + frozen_version, + schema_guard, + ddl_operator, + trans, + allocator, + type))) { + LOG_WARN("failed to add primary key", K(ret)); } } break; @@ -9079,11 +9055,7 @@ int ObDDLService::update_global_index(ObAlterTableArg &arg, } else if (!index_table_schema->can_read_index()) { // If the index is not available, the partition operation will not do any intervention } else if (index_table_schema->is_global_index_table()) { - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2276) { - ret = OB_NOT_SUPPORTED; - LOG_WARN("drop/truncate partition with global indexes not support", KR(ret)); - LOG_USER_ERROR(OB_NOT_SUPPORTED, "drop/truncate partition with global indexes "); - } else if (!arg.is_update_global_indexes_) { + if (!arg.is_update_global_indexes_) { if (OB_FAIL(ddl_operator.update_index_status( tenant_id, index_table_schema->get_data_table_id(), @@ -10587,10 +10559,7 @@ int ObDDLService::do_offline_ddl_in_trans(obrpc::ObAlterTableArg &alter_table_ar const ObDDLType ddl_type = res.ddl_type_; ObRootService *root_service = GCTX.root_service_; bool need_redistribute_column_id = false; - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, "Unsupported ddl operation"); - } else if (OB_UNLIKELY(DDL_INVALID == ddl_type)) { + if (OB_UNLIKELY(DDL_INVALID == ddl_type)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("unexpected ddl type", K(ret), K(ddl_type), K(alter_table_arg)); } else if (OB_ISNULL(root_service)) { @@ -11140,11 +11109,7 @@ int ObDDLService::check_alter_partitions(const ObTableSchema &orig_table_schema, } is_drop_or_truncate = true; } else if (obrpc::ObAlterTableArg::TRUNCATE_SUB_PARTITION == alter_part_type) { - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2276) { - ret = OB_NOT_SUPPORTED; - LOG_WARN("truncate subpartition in update not support", KR(ret)); - LOG_USER_ERROR(OB_NOT_SUPPORTED, "truncate subpartition in update "); - } else if (OB_FAIL(check_alter_drop_subpartitions(orig_table_schema, alter_table_arg))) { + if (OB_FAIL(check_alter_drop_subpartitions(orig_table_schema, alter_table_arg))) { LOG_WARN("failed to check drop partition", KR(ret), K(orig_table_schema), K(alter_table_arg)); } is_drop_or_truncate = true; @@ -11168,19 +11133,11 @@ int ObDDLService::check_alter_partitions(const ObTableSchema &orig_table_schema, LOG_WARN("failed to check add paritions", K(ret), K(orig_table_schema), K(alter_table_arg)); } } else if (is_oracle_mode && obrpc::ObAlterTableArg::SET_INTERVAL == alter_part_type) { - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0) { - ret = OB_NOT_SUPPORTED; - LOG_WARN("interval partition less than 4.0 not support", K(ret), K(GET_MIN_CLUSTER_VERSION())); - LOG_USER_ERROR(OB_NOT_SUPPORTED, "interval partition less than 4.0"); - } else if (OB_FAIL(check_alter_set_interval(orig_table_schema, alter_table_arg))) { + if (OB_FAIL(check_alter_set_interval(orig_table_schema, alter_table_arg))) { LOG_WARN("failed to check set interval", K(ret), K(orig_table_schema), K(alter_table_arg)); } } else if (is_oracle_mode && obrpc::ObAlterTableArg::INTERVAL_TO_RANGE == alter_part_type) { - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0) { - ret = OB_NOT_SUPPORTED; - LOG_WARN("interval partition less than 4.0 not support", K(ret), K(GET_MIN_CLUSTER_VERSION())); - LOG_USER_ERROR(OB_NOT_SUPPORTED, "interval partition less than 4.0"); - } else if (PARTITION_FUNC_TYPE_INTERVAL != orig_table_schema.get_part_option().get_part_func_type()) { + if (PARTITION_FUNC_TYPE_INTERVAL != orig_table_schema.get_part_option().get_part_func_type()) { ret = OB_ERR_UNEXPECTED; LOG_WARN("type is unexpected when interval to range", K(orig_table_schema), K(alter_table_arg), KR(ret)); } diff --git a/src/rootserver/ob_root_service.cpp b/src/rootserver/ob_root_service.cpp index ee73ba340..232034afa 100644 --- a/src/rootserver/ob_root_service.cpp +++ b/src/rootserver/ob_root_service.cpp @@ -3681,8 +3681,6 @@ int ObRootService::maintain_obj_dependency_info(const obrpc::ObDependencyObjDDLA if (!inited_) { ret = OB_NOT_INIT; LOG_WARN("not init", K(ret)); - } else if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_322) { - // do nothing } else if (!arg.is_valid()) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid arg", K(arg), K(ret)); @@ -3794,13 +3792,10 @@ int ObRootService::precheck_interval_part(const obrpc::ObAlterTableArg &arg) int64_t tenant_id = alter_table_schema.get_tenant_id(); if (!alter_table_schema.is_interval_part() - || obrpc::ObAlterTableArg::ADD_PARTITION != op_type) { + || obrpc::ObAlterTableArg::ADD_PARTITION != op_type) { } else if (OB_ISNULL(schema_service_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("error unexpected, schema service must not be NULL", K(ret)); - } else if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, "interval partition"); } else if (OB_FAIL(schema_service_->get_tenant_schema_guard(tenant_id, schema_guard))) { LOG_WARN("fail to get schema guard", K(ret)); } else if (OB_FAIL(schema_guard.get_simple_table_schema(tenant_id, diff --git a/src/rootserver/ob_server_manager.cpp b/src/rootserver/ob_server_manager.cpp index a765c9094..bd78fc676 100644 --- a/src/rootserver/ob_server_manager.cpp +++ b/src/rootserver/ob_server_manager.cpp @@ -994,9 +994,7 @@ int ObServerManager::receive_hb( } } else { status_ptr->last_hb_time_ = now; - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_1450) { - // for compatibility - } else if (update_delay_time_flag) { + if (update_delay_time_flag) { const int64_t current_rs_time = ObTimeUtility::current_time(); int64_t server_behind_time = current_rs_time - (lease_request.current_server_time_ + lease_request.round_trip_time_ / 2); if (std::abs(server_behind_time) > GCONF.rpc_timeout) { diff --git a/src/rootserver/ob_system_admin_util.cpp b/src/rootserver/ob_system_admin_util.cpp index c0f0cd486..101f2c794 100644 --- a/src/rootserver/ob_system_admin_util.cpp +++ b/src/rootserver/ob_system_admin_util.cpp @@ -1388,7 +1388,7 @@ int ObAdminUpgradeCmd::execute(const Bool &upgrade) LOG_WARN("assign enable_upgrade_mode config value failed", KR(ret)); } else if (OB_FAIL(set_config_arg.items_.push_back(item))) { LOG_WARN("add enable_upgrade_mode config item failed", KR(ret)); - } else if (current_version >= CLUSTER_VERSION_2250) { + } else { const char *upgrade_stage_name = "_upgrade_stage"; obrpc::ObUpgradeStage stage = upgrade ? obrpc::OB_UPGRADE_STAGE_PREUPGRADE : diff --git a/src/rootserver/ob_unit_manager.cpp b/src/rootserver/ob_unit_manager.cpp index 3fe992d66..e2584d725 100644 --- a/src/rootserver/ob_unit_manager.cpp +++ b/src/rootserver/ob_unit_manager.cpp @@ -7404,13 +7404,6 @@ int ObUnitManager::determine_alter_unit_num_type( } } } - if (OB_SUCC(ret) && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_1460) { - if (AUN_SHRINK == alter_unit_num_type || AUN_ROLLBACK_SHRINK == alter_unit_num_type) { - ret = OB_NOT_SUPPORTED; - LOG_WARN("shrink pool unit num is not supported during upgrading to 1.4.6"); - LOG_USER_ERROR(OB_NOT_SUPPORTED, "shrink pool unit num during upgrading to 1.4.6"); - } - } return ret; } diff --git a/src/rootserver/ob_zone_manager.cpp b/src/rootserver/ob_zone_manager.cpp index 3d5c30865..b3e10dc6e 100644 --- a/src/rootserver/ob_zone_manager.cpp +++ b/src/rootserver/ob_zone_manager.cpp @@ -552,11 +552,7 @@ int ObZoneManagerBase::alter_zone( ObZone zone = arg.zone_; ObRegion my_region = arg.region_; ObIDC my_idc = arg.idc_; - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_1440) { - ret = OB_OP_NOT_ALLOW; - LOG_WARN("cannot alter zone during updating to 144", K(ret)); - LOG_USER_ERROR(OB_OP_NOT_ALLOW, "alter zone during upgrading to version 1.4.4"); - } else if (OB_FAIL(check_inner_stat())) { + if (OB_FAIL(check_inner_stat())) { LOG_WARN("check_inner_stat failed", K(ret)); } else if (zone.is_empty()) { ret = OB_INVALID_ARGUMENT; diff --git a/src/share/ob_cluster_info_proxy.cpp b/src/share/ob_cluster_info_proxy.cpp index c7d218244..0aab9f29e 100644 --- a/src/share/ob_cluster_info_proxy.cpp +++ b/src/share/ob_cluster_info_proxy.cpp @@ -186,9 +186,7 @@ bool ObClusterInfo::is_valid() const bret = true; } if (bret) { - if (CLUSTER_VERSION_2260 <= GET_MIN_CLUSTER_VERSION()) { - bret = OB_INVALID_VERSION != version_; - } + bret = OB_INVALID_VERSION != version_; } return bret; } diff --git a/src/share/ob_cluster_version.h b/src/share/ob_cluster_version.h index 2bf1d3867..6daea669c 100644 --- a/src/share/ob_cluster_version.h +++ b/src/share/ob_cluster_version.h @@ -160,16 +160,6 @@ cal_version(const uint64_t major, const uint64_t minor, const uint64_t major_pat //TODO: If you update the above version, please update CLUSTER_CURRENT_VERSION. #define CLUSTER_CURRENT_VERSION CLUSTER_VERSION_4_1_0_0 #define GET_MIN_CLUSTER_VERSION() (oceanbase::common::ObClusterVersion::get_instance().get_cluster_version()) -#define GET_UNIS_CLUSTER_VERSION() (::oceanbase::lib::get_unis_compat_version() ?: GET_MIN_CLUSTER_VERSION()) - -#define IS_CLUSTER_VERSION_BEFORE_1472 (oceanbase::common::ObClusterVersion::get_instance().get_cluster_version() < CLUSTER_VERSION_1472) -#define IS_CLUSTER_VERSION_BEFORE_2200 (oceanbase::common::ObClusterVersion::get_instance().get_cluster_version() < CLUSTER_VERSION_2200) -#define IS_CLUSTER_VERSION_BEFORE_2240 (oceanbase::common::ObClusterVersion::get_instance().get_cluster_version() < CLUSTER_VERSION_2240) -#define IS_CLUSTER_VERSION_BEFORE_3000 (oceanbase::common::ObClusterVersion::get_instance().get_cluster_version() < CLUSTER_VERSION_3000) -#define IS_CLUSTER_VERSION_BEFORE_3100 (oceanbase::common::ObClusterVersion::get_instance().get_cluster_version() < CLUSTER_VERSION_3100) -#define IS_CLUSTER_VERSION_BEFORE_4_0_0_0 (oceanbase::common::ObClusterVersion::get_instance().get_cluster_version() < CLUSTER_VERSION_4_0_0_0) - -#define IS_CLUSTER_VERSION_AFTER_2274 (oceanbase::common::ObClusterVersion::get_instance().get_cluster_version() > CLUSTER_VERSION_2274) // ATTENSION !!!!!!!!!!!!!!!!!!!!!!!!!!! // 1. After 4.0, each cluster_version is corresponed to a data version. diff --git a/src/share/ob_simple_batch.h b/src/share/ob_simple_batch.h index 718703b10..722067137 100644 --- a/src/share/ob_simple_batch.h +++ b/src/share/ob_simple_batch.h @@ -78,4 +78,4 @@ struct ObSimpleBatch } // end of namespace common } // end of namespace oceanbase -#endif /* OCEABASE_OBSERVER_OB_CLUSTER_VERSION_H_*/ +#endif /*OCEANBASE_SHARE_OB_COMMON_BATCH_H_*/ diff --git a/src/share/ob_zone_table_operation.cpp b/src/share/ob_zone_table_operation.cpp index e472f051d..f1c6e26b6 100644 --- a/src/share/ob_zone_table_operation.cpp +++ b/src/share/ob_zone_table_operation.cpp @@ -162,44 +162,6 @@ int ObZoneTableOperation::insert_zone_info(ObISQLClient &sql_client, ObZoneInfo return ret; } -int ObZoneTableOperation::select_gc_timestamp_for_update(common::ObISQLClient &sql_client, - int64_t &gc_timestamp) -{ - int ret = OB_SUCCESS; - if (GET_MIN_CLUSTER_VERSION() > CLUSTER_VERSION_2000) { - ret = OB_NOT_SUPPORTED; - LOG_WARN("not supported now", K(ret)); - } else { - gc_timestamp = 0; - SMART_VAR(ObMySQLProxy::MySQLResult, res) { - ObMySQLResult *result = NULL; - ObSqlString sql; - if (OB_FAIL(sql.assign_fmt( - "SELECT zone, name, value, info FROM %s WHERE NAME = 'snapshot_gc_ts' FOR UPDATE", - OB_ALL_ZONE_TNAME))) { - LOG_WARN("assign sql failed", K(ret)); - } else if (OB_FAIL(sql_client.read(res, sql.ptr()))) { - LOG_WARN("execute sql failed", K(ret), K(sql)); - } else if (NULL == (result = res.get_result())) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("failed to get sql result", K(ret)); - } else if (OB_FAIL(result->next())) { - LOG_WARN("fail to get next row", K(ret)); - } else { - EXTRACT_INT_FIELD_MYSQL(*result, "value", gc_timestamp, int64_t); - } - if (OB_FAIL(ret)) { - //nothing todo - } else if (OB_ITER_END != result->next()) { - LOG_WARN("get more row than one", K(ret)); - } else { - ret = OB_SUCCESS; - } - } - } - return ret; -} - int ObZoneTableOperation::update_info_item(common::ObISQLClient &sql_client, const common::ObZone &zone, const ObZoneInfoItem &item, bool insert /* = false */) { diff --git a/src/share/ob_zone_table_operation.h b/src/share/ob_zone_table_operation.h index e086acfdd..3ac0c6b81 100644 --- a/src/share/ob_zone_table_operation.h +++ b/src/share/ob_zone_table_operation.h @@ -45,8 +45,6 @@ public: static int insert_zone_info(common::ObISQLClient &sql_client, ObZoneInfo &info); static int remove_zone_info(common::ObISQLClient &sql_client, const common::ObZone &zone); - static int select_gc_timestamp_for_update(common::ObISQLClient &sql_client, - int64_t &gc_timestmp); static int get_region_list( common::ObISQLClient &sql_client, common::ObIArray ®ion_list); private: diff --git a/src/share/resource_manager/ob_resource_manager_proxy.cpp b/src/share/resource_manager/ob_resource_manager_proxy.cpp index 9cd3b0bbc..cf0b58c83 100644 --- a/src/share/resource_manager/ob_resource_manager_proxy.cpp +++ b/src/share/resource_manager/ob_resource_manager_proxy.cpp @@ -119,12 +119,6 @@ int ObResourceManagerProxy::create_plan( } } } - - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3200) { - if (OB_SUCCESS != ret) { - LOG_WARN("fail init default consumer groups", K(tenant_id) , K(ret)); - } - } } return ret; } diff --git a/src/share/rpc/ob_batch_proxy.cpp b/src/share/rpc/ob_batch_proxy.cpp index 67ef11f07..0e7ee12c4 100644 --- a/src/share/rpc/ob_batch_proxy.cpp +++ b/src/share/rpc/ob_batch_proxy.cpp @@ -30,10 +30,8 @@ DEFINE_SERIALIZE(ObBatchPacket) } else { MEMCPY(buf + pos, buf_, size_); pos += size_; - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100) { - if (OB_FAIL(src_addr_.serialize(buf, buf_len, pos))) { - CLOG_LOG(WARN, "failed to serialize addr", K_(src_addr), K(ret)); - } + if (OB_FAIL(src_addr_.serialize(buf, buf_len, pos))) { + CLOG_LOG(WARN, "failed to serialize addr", K_(src_addr), K(ret)); } } return ret; @@ -51,10 +49,8 @@ DEFINE_DESERIALIZE(ObBatchPacket) pos += size_; // In order to support IPv6, used ObAddr for version 2.2 and abover if (pos < data_len) { - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100) { - if (OB_FAIL(src_addr_.deserialize(buf, data_len, pos))) { - CLOG_LOG(WARN, "failed to deserialize addr", K_(src_addr), K(ret)); - } + if (OB_FAIL(src_addr_.deserialize(buf, data_len, pos))) { + CLOG_LOG(WARN, "failed to deserialize addr", K_(src_addr), K(ret)); } } } @@ -66,9 +62,7 @@ DEFINE_GET_SERIALIZE_SIZE(ObBatchPacket) int64_t len = 0; LST_DO_CODE(OB_UNIS_ADD_LEN, size_, id_, src_); len += size_; - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100) { - len += src_addr_.get_serialize_size(); - } + len += src_addr_.get_serialize_size(); return len; } diff --git a/src/share/rpc/ob_batch_rpc.cpp b/src/share/rpc/ob_batch_rpc.cpp index 8dcf1260f..f2139c862 100644 --- a/src/share/rpc/ob_batch_rpc.cpp +++ b/src/share/rpc/ob_batch_rpc.cpp @@ -35,10 +35,8 @@ int build_batch_packet(const ObAddr &sender, const uint32_t batch_type, const ui bool is_retry = false; ObCurTraceId::TraceId *trace_id = ObCurTraceId::get_trace_id(); uint32_t flag = 0; - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2260) { - // with trace id - flag = 1; - } + // with trace id + flag = 1; // 优先从线程局部分配内存, 如果分配的内存不够大, 则动态分配内存 while (true) { bool need_retry = false; @@ -105,7 +103,7 @@ int64_t ObRpcBuffer::send(Rpc& rpc, uint64_t tenant_id, const ObAddr &sender, bo Packet* pkt = (Packet*)buf; pkt->set((int32_t)(size - sizeof(*pkt)), sender, (char*)(pkt+1)); common::ObAddr dest = server_; - if (CLOG_BATCH_REQ_NODELAY == batch_type_ && (!IS_CLUSTER_VERSION_BEFORE_2200)) { + if (CLOG_BATCH_REQ_NODELAY == batch_type_) { uint32_t new_port = dest.get_port() + BATCH_RPC_PORT_DELTA; dest.set_port(new_port); } @@ -127,7 +125,7 @@ int ObBatchRpcBase::post(const uint64_t tenant_id, const ObAddr &dest, const int RpcBuffer* buffer = fetch(tenant_id, dest, dst_cluster_id); ObAddr new_dest = dest; - if (CLOG_BATCH_REQ_NODELAY == batch_type && (!IS_CLUSTER_VERSION_BEFORE_2200)) { + if (CLOG_BATCH_REQ_NODELAY == batch_type) { new_dest.set_port(dest.get_port() + BATCH_RPC_PORT_DELTA); } if (NULL == buffer || !buffer->fill(sub_type, req)) { @@ -162,10 +160,8 @@ int build_batch_packet(const ObAddr &sender, const uint32_t batch_type, const in bool is_retry = false; ObCurTraceId::TraceId *trace_id = ObCurTraceId::get_trace_id(); uint32_t flag = 0; - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2260) { - // with trace id - flag = 1; - } + // with trace id + flag = 1; // 优先从线程局部分配内存, 如果分配的内存不够大, 则动态分配内存 while (true) { bool need_retry = false; @@ -235,7 +231,7 @@ int ObBatchRpcBase::post(const uint64_t tenant_id, const ObAddr &dest, const int RpcBuffer* buffer = fetch(tenant_id, dest, dst_cluster_id); ObAddr new_dest = dest; - if (CLOG_BATCH_REQ_NODELAY == batch_type && (!IS_CLUSTER_VERSION_BEFORE_2200)) { + if (CLOG_BATCH_REQ_NODELAY == batch_type) { new_dest.set_port(dest.get_port() + BATCH_RPC_PORT_DELTA); } if (NULL == buffer || !buffer->fill(sub_type, ls, req)) { diff --git a/src/share/rpc/ob_batch_rpc.h b/src/share/rpc/ob_batch_rpc.h index fa2a3acbf..e0317a432 100644 --- a/src/share/rpc/ob_batch_rpc.h +++ b/src/share/rpc/ob_batch_rpc.h @@ -104,11 +104,9 @@ public: int64_t total_size = req_size; common::ObCurTraceId::TraceId *trace_id = common::ObCurTraceId::get_trace_id(); uint32_t flag = 0; - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2260) { - // with trace id - flag = 1; - total_size = total_size + trace_id->get_serialize_size(); - } + // with trace id + flag = 1; + total_size = total_size + trace_id->get_serialize_size(); if (total_size <= buf_size_ - RESERVED_SIZE) { while(NULL == header) { CriticalGuard(get_qs()); @@ -144,11 +142,8 @@ public: int64_t total_size = ls.get_serialize_size() + req_size; common::ObCurTraceId::TraceId *trace_id = common::ObCurTraceId::get_trace_id(); uint32_t flag = 0; - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2260) { - // with trace id - flag = 1; - total_size = total_size + trace_id->get_serialize_size(); - } + flag = 1; + total_size = total_size + trace_id->get_serialize_size(); if (total_size <= buf_size_ - RESERVED_SIZE) { while(NULL == header) { CriticalGuard(get_qs()); @@ -459,8 +454,7 @@ public: { int ret = common::OB_SUCCESS; bool is_hp_eio_enabled = false; - if (static_cast(GCONF.high_priority_net_thread_count) > 0 - && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2220) { + if (static_cast(GCONF.high_priority_net_thread_count) > 0) { is_hp_eio_enabled = true; } diff --git a/src/share/schema/ob_column_schema.cpp b/src/share/schema/ob_column_schema.cpp index af4bd8ef5..62e4eb92e 100644 --- a/src/share/schema/ob_column_schema.cpp +++ b/src/share/schema/ob_column_schema.cpp @@ -512,8 +512,7 @@ int ObColumnSchemaV2::get_byte_length( ret = OB_ERR_UNEXPECTED; LOG_WARN("collation type is invalid", K(ret)); } else if (ob_is_text_tc(meta_type_.get_type()) || ob_is_json(meta_type_.get_type())) { - if (for_check_length && - ((GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_1470) || ObSchemaService::g_liboblog_mode_)) { + if (for_check_length) { // when check row length, a lob will occupy at most 2KB length = min(get_data_length(), OB_MAX_LOB_HANDLE_LENGTH); } else { diff --git a/src/share/schema/ob_dependency_info.cpp b/src/share/schema/ob_dependency_info.cpp index d8cff566d..b7ef4d515 100644 --- a/src/share/schema/ob_dependency_info.cpp +++ b/src/share/schema/ob_dependency_info.cpp @@ -244,37 +244,32 @@ int ObDependencyInfo::delete_schema_object_dependency(common::ObISQLClient &tran { UNUSED(schema_version); int ret = OB_SUCCESS; - if (IS_CLUSTER_VERSION_BEFORE_3100) { - // do nothing - LOG_DEBUG("all_dependency schema only support after version 3.1"); + const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id); + const uint64_t extract_tid = ObSchemaUtils::get_extract_tenant_id(exec_tenant_id, tenant_id); + ObSqlString sql; + int64_t affected_rows = 0; + if (OB_INVALID_ID == tenant_id + || OB_INVALID_ID == dep_obj_id + || ObObjectType::MAX_TYPE == dep_obj_type) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("delete error info unexpected.", K(ret), K(tenant_id), + K(dep_obj_id), K(dep_obj_type)); + } else if (sql.assign_fmt("delete FROM %s WHERE dep_obj_id = %ld \ + AND tenant_id = %ld \ + AND dep_obj_type = %ld", + OB_ALL_TENANT_DEPENDENCY_TNAME, + extract_obj_id(tenant_id, dep_obj_id), + extract_tid, + static_cast(dep_obj_type))) { + LOG_WARN("delete from __all_tenant_dependency table failed.", K(ret), K(tenant_id), + K(extract_tid), + K(dep_obj_id), + K(dep_obj_type)); } else { - const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id); - const uint64_t extract_tid = ObSchemaUtils::get_extract_tenant_id(exec_tenant_id, tenant_id); - ObSqlString sql; - int64_t affected_rows = 0; - if (OB_INVALID_ID == tenant_id - || OB_INVALID_ID == dep_obj_id - || ObObjectType::MAX_TYPE == dep_obj_type) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("delete error info unexpected.", K(ret), K(tenant_id), - K(dep_obj_id), K(dep_obj_type)); - } else if (sql.assign_fmt("delete FROM %s WHERE dep_obj_id = %ld \ - AND tenant_id = %ld \ - AND dep_obj_type = %ld", - OB_ALL_TENANT_DEPENDENCY_TNAME, - extract_obj_id(tenant_id, dep_obj_id), - extract_tid, - static_cast(dep_obj_type))) { - LOG_WARN("delete from __all_tenant_dependency table failed.", K(ret), K(tenant_id), - K(extract_tid), - K(dep_obj_id), - K(dep_obj_type)); + if (OB_FAIL(trans.write(exec_tenant_id, sql.ptr(), affected_rows))) { + LOG_WARN("execute query failed", K(ret), K(sql)); } else { - if (OB_FAIL(trans.write(exec_tenant_id, sql.ptr(), affected_rows))) { - LOG_WARN("execute query failed", K(ret), K(sql)); - } else { - // do nothing - } + // do nothing } } return ret; @@ -285,45 +280,40 @@ int ObDependencyInfo::insert_schema_object_dependency(common::ObISQLClient &tran { int ret = OB_SUCCESS; - if (IS_CLUSTER_VERSION_BEFORE_3100) { - // do nothing - LOG_DEBUG("all_dependency schema only support after version 3.1"); + ObDependencyInfo& dep_info = *this; + const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(dep_info.get_tenant_id()); + ObDMLSqlSplicer dml; + //这块暂时注释掉,因为系统租户下的__all_package的虚拟表没有实现。 + //int64_t ref_obj_create_time = -1; + //ObString ref_obj_name; + // OZ (get_object_create_time(trans, dep_info.get_ref_obj_type(), + // ref_obj_create_time, ref_obj_name)); + // OX (dep_info.set_ref_timestamp(ref_obj_create_time)); + // OZ (dep_info.set_ref_obj_name(ref_obj_name)); + if (OB_FAIL(ret)) { + LOG_WARN("get ref object time failed", K(ret), + K(dep_info.get_ref_obj_type()), + K(dep_info.get_ref_obj_id())); + } else if (OB_FAIL(gen_dependency_dml(exec_tenant_id, dml))) { + LOG_WARN("gen table dml failed", K(ret)); } else { - ObDependencyInfo& dep_info = *this; - const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(dep_info.get_tenant_id()); - ObDMLSqlSplicer dml; - //这块暂时注释掉,因为系统租户下的__all_package的虚拟表没有实现。 - //int64_t ref_obj_create_time = -1; - //ObString ref_obj_name; - // OZ (get_object_create_time(trans, dep_info.get_ref_obj_type(), - // ref_obj_create_time, ref_obj_name)); - // OX (dep_info.set_ref_timestamp(ref_obj_create_time)); - // OZ (dep_info.set_ref_obj_name(ref_obj_name)); - if (OB_FAIL(ret)) { - LOG_WARN("get ref object time failed", K(ret), - K(dep_info.get_ref_obj_type()), - K(dep_info.get_ref_obj_id())); - } else if (OB_FAIL(gen_dependency_dml(exec_tenant_id, dml))) { - LOG_WARN("gen table dml failed", K(ret)); - } else { + ObDMLExecHelper exec(trans, exec_tenant_id); + int64_t affected_rows = 0; + if (!only_history) { ObDMLExecHelper exec(trans, exec_tenant_id); - int64_t affected_rows = 0; - if (!only_history) { - ObDMLExecHelper exec(trans, exec_tenant_id); - if (is_replace) { - if (OB_FAIL(exec.exec_update(OB_ALL_TENANT_DEPENDENCY_TNAME, dml, affected_rows))) { - LOG_WARN("execute update failed", K(ret)); - } - } else { - if (OB_FAIL(exec.exec_insert(OB_ALL_TENANT_DEPENDENCY_TNAME, dml, affected_rows))) { - LOG_WARN("execute insert failed", K(ret)); - } + if (is_replace) { + if (OB_FAIL(exec.exec_update(OB_ALL_TENANT_DEPENDENCY_TNAME, dml, affected_rows))) { + LOG_WARN("execute update failed", K(ret)); } - if (OB_SUCC(ret) && !is_single_row(affected_rows)) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("affected_rows unexpected to be one", K(affected_rows), K(ret)); + } else { + if (OB_FAIL(exec.exec_insert(OB_ALL_TENANT_DEPENDENCY_TNAME, dml, affected_rows))) { + LOG_WARN("execute insert failed", K(ret)); } } + if (OB_SUCC(ret) && !is_single_row(affected_rows)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("affected_rows unexpected to be one", K(affected_rows), K(ret)); + } } } return ret; @@ -338,42 +328,37 @@ int ObDependencyInfo::collect_dep_infos(const ObIArray &sche bool is_pl) { int ret = OB_SUCCESS; - if (IS_CLUSTER_VERSION_BEFORE_3100) { - // do nothing - LOG_DEBUG("all_dependency schema only support after version 3.1"); - } else { - int64_t order = 0; - for (int64_t i = 0; OB_SUCC(ret) && i < schema_objs.count(); ++i) { - ObDependencyInfo dep; - const ObSchemaObjVersion &s_objs = schema_objs.at(i); - if (!s_objs.is_valid() - // object may depend on self - || (is_pl - && dep_obj_type == s_objs.get_schema_object_type())) { - continue; - } - dep.set_dep_obj_id(OB_INVALID_ID); - dep.set_dep_obj_type(dep_obj_type); - dep.set_dep_obj_owner_id(OB_INVALID_ID); - dep.set_ref_obj_id(s_objs.get_object_id()); - dep.set_ref_obj_type(s_objs.get_schema_object_type()); - dep.set_order(order); - ++order; - dep.set_dep_timestamp(-1); - dep.set_ref_timestamp(s_objs.get_version()); - dep.set_property(property); - if (dep_attrs.length() >= OB_MAX_ORACLE_RAW_SQL_COL_LENGTH - || dep_reason.length() >= OB_MAX_ORACLE_RAW_SQL_COL_LENGTH) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("dep attrs or dep reason is too long", K(ret), - K(dep_attrs.length()), - K(dep_reason.length())); - } else { - if (!dep_attrs.empty()) OZ (dep.set_dep_attrs(dep_attrs)); - if (!dep_reason.empty()) OZ (dep.set_dep_reason(dep_reason)); - } - OZ (deps.push_back(dep)); + int64_t order = 0; + for (int64_t i = 0; OB_SUCC(ret) && i < schema_objs.count(); ++i) { + ObDependencyInfo dep; + const ObSchemaObjVersion &s_objs = schema_objs.at(i); + if (!s_objs.is_valid() + // object may depend on self + || (is_pl + && dep_obj_type == s_objs.get_schema_object_type())) { + continue; } + dep.set_dep_obj_id(OB_INVALID_ID); + dep.set_dep_obj_type(dep_obj_type); + dep.set_dep_obj_owner_id(OB_INVALID_ID); + dep.set_ref_obj_id(s_objs.get_object_id()); + dep.set_ref_obj_type(s_objs.get_schema_object_type()); + dep.set_order(order); + ++order; + dep.set_dep_timestamp(-1); + dep.set_ref_timestamp(s_objs.get_version()); + dep.set_property(property); + if (dep_attrs.length() >= OB_MAX_ORACLE_RAW_SQL_COL_LENGTH + || dep_reason.length() >= OB_MAX_ORACLE_RAW_SQL_COL_LENGTH) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("dep attrs or dep reason is too long", K(ret), + K(dep_attrs.length()), + K(dep_reason.length())); + } else { + if (!dep_attrs.empty()) OZ (dep.set_dep_attrs(dep_attrs)); + if (!dep_reason.empty()) OZ (dep.set_dep_reason(dep_reason)); + } + OZ (deps.push_back(dep)); } return ret; } @@ -726,7 +711,7 @@ int ObReferenceObjTable::batch_execute_insert_or_update_obj_dependency( if (OB_INVALID_ID == tenant_id) { ret = OB_ERR_UNEXPECTED; LOG_WARN("invalid argument", K(ret), K(tenant_id)); - } else if (is_standby || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_322) { + } else if (is_standby) { // do nothing } else { ObSqlString sql; @@ -781,7 +766,7 @@ int ObReferenceObjTable::batch_execute_delete_obj_dependency( if (OB_INVALID_ID == tenant_id) { ret = OB_ERR_UNEXPECTED; LOG_WARN("invalid argument", K(ret), K(tenant_id)); - } else if (is_standby || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_322) { + } else if (is_standby) { // do nothing } else { share::ObDMLSqlSplicer dml; diff --git a/src/share/schema/ob_keystore_sql_service.cpp b/src/share/schema/ob_keystore_sql_service.cpp index 32f7df6d3..e437b6eec 100644 --- a/src/share/schema/ob_keystore_sql_service.cpp +++ b/src/share/schema/ob_keystore_sql_service.cpp @@ -84,18 +84,15 @@ int ObKeystoreSqlService::add_keystore(common::ObISQLClient &sql_client, SQL_COL_APPEND_VALUE(sql, values, keystore_schema.get_status(), "status", "%lu"); SQL_COL_APPEND_VALUE(sql, values, ObSchemaUtils::get_extract_schema_id( exec_tenant_id, keystore_schema.get_master_key_id()), "master_key_id", "%lu"); - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2277 - && OB_INTERNAL_ENCRYPTED_KEY_LENGTH == keystore_schema.get_encrypted_key().length()) { + if (OB_INTERNAL_ENCRYPTED_KEY_LENGTH == keystore_schema.get_encrypted_key().length()) { SQL_COL_APPEND_ESCAPE_STR_VALUE(sql, values, "", 0, "master_key"); } else { SQL_COL_APPEND_ESCAPE_STR_VALUE(sql, values, keystore_schema.get_master_key().ptr(), keystore_schema.get_master_key().length(), "master_key"); } - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2277) { - SQL_COL_APPEND_ESCAPE_STR_VALUE(sql, values, keystore_schema.get_encrypted_key().ptr(), - keystore_schema.get_encrypted_key().length(), - "encrypted_key"); - } + SQL_COL_APPEND_ESCAPE_STR_VALUE(sql, values, keystore_schema.get_encrypted_key().ptr(), + keystore_schema.get_encrypted_key().length(), + "encrypted_key"); if (0 == STRCMP(tname[i], OB_ALL_TENANT_KEYSTORE_HISTORY_TNAME)) { SQL_COL_APPEND_VALUE(sql, values, keystore_schema.get_schema_version(), "schema_version", "%ld"); SQL_COL_APPEND_VALUE(sql, values, "false", "is_deleted", "%s"); @@ -170,12 +167,10 @@ int ObKeystoreSqlService::update_keystore(common::ObISQLClient &sql_client, || OB_FAIL(dml.add_column("password", ObHexEscapeSqlStr(keystore_schema.get_password()))) || OB_FAIL(dml.add_column("status", keystore_schema.get_status())) || OB_FAIL(dml.add_column("master_key_id", ObSchemaUtils::get_extract_schema_id(exec_tenant_id, master_key_id))) - || OB_FAIL(dml.add_column("master_key", (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2277 - && OB_INTERNAL_ENCRYPTED_KEY_LENGTH == keystore_schema.get_encrypted_key().length()) ? + || OB_FAIL(dml.add_column("master_key", (OB_INTERNAL_ENCRYPTED_KEY_LENGTH == keystore_schema.get_encrypted_key().length()) ? ObString::make_string("") : ObHexEscapeSqlStr(keystore_schema.get_master_key()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2277 - && OB_FAIL(dml.add_column("encrypted_key", ObHexEscapeSqlStr(keystore_schema.get_encrypted_key())))) + || OB_FAIL(dml.add_column("encrypted_key", ObHexEscapeSqlStr(keystore_schema.get_encrypted_key()))) || OB_FAIL(dml.add_gmt_modified())) { LOG_WARN("add column failed", K(ret)); } diff --git a/src/share/schema/ob_profile_sql_service.cpp b/src/share/schema/ob_profile_sql_service.cpp index fd001e411..c4951c89a 100644 --- a/src/share/schema/ob_profile_sql_service.cpp +++ b/src/share/schema/ob_profile_sql_service.cpp @@ -87,10 +87,8 @@ int ObProfileSqlService::gen_sql(ObSqlString &sql, SQL_COL_APPEND_VALUE(sql, values, schema.get_password_lock_time(), "password_lock_time", "%ld"); SQL_COL_APPEND_ESCAPE_STR_VALUE(sql, values, schema.get_password_verify_function_str().ptr(), schema.get_password_verify_function_str().length(), "password_verify_function"); - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2276) { - SQL_COL_APPEND_VALUE(sql, values, schema.get_password_life_time(), "password_life_time", "%ld"); - SQL_COL_APPEND_VALUE(sql, values, schema.get_password_grace_time(), "password_grace_time", "%ld"); - } + SQL_COL_APPEND_VALUE(sql, values, schema.get_password_life_time(), "password_life_time", "%ld"); + SQL_COL_APPEND_VALUE(sql, values, schema.get_password_grace_time(), "password_grace_time", "%ld"); return ret; } diff --git a/src/share/schema/ob_schema_getter_guard.cpp b/src/share/schema/ob_schema_getter_guard.cpp index 7fe17e534..a1a34f78d 100644 --- a/src/share/schema/ob_schema_getter_guard.cpp +++ b/src/share/schema/ob_schema_getter_guard.cpp @@ -1147,30 +1147,19 @@ int ObSchemaGetterGuard::get_user_profile_failed_login_limits( } else { uint64_t default_profile_id = OB_ORACLE_TENANT_INNER_PROFILE_ID; profile_id = user_info->get_profile_id(); - - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2250 && !is_valid_id(profile_id)) { - if (OB_FAIL(ObProfileSchema::get_default_value(ObProfileSchema::FAILED_LOGIN_ATTEMPTS, - failed_login_limit_num))) { - LOG_WARN("fail to get default value", KR(ret)); - } else if (OB_FAIL(ObProfileSchema::get_default_value(ObProfileSchema::PASSWORD_LOCK_TIME, - failed_login_limit_time))) { - LOG_WARN("fail to get default value", KR(ret)); - } + if (OB_FAIL(get_profile_schema_by_id(user_info->get_tenant_id(), + is_valid_id(profile_id) ? profile_id : default_profile_id, + profile_info))) { + LOG_WARN("fail to get profile info", KR(ret), KPC(user_info)); + } else if (OB_FAIL(get_profile_schema_by_id(user_info->get_tenant_id(), + default_profile_id, + default_profile))) { + LOG_WARN("fail to get profile info", KR(ret), KPC(user_info)); } else { - if (OB_FAIL(get_profile_schema_by_id(user_info->get_tenant_id(), - is_valid_id(profile_id) ? profile_id : default_profile_id, - profile_info))) { - LOG_WARN("fail to get profile info", KR(ret), KPC(user_info)); - } else if (OB_FAIL(get_profile_schema_by_id(user_info->get_tenant_id(), - default_profile_id, - default_profile))) { - LOG_WARN("fail to get profile info", KR(ret), KPC(user_info)); - } else { - failed_login_limit_num = combine_default_value(profile_info->get_failed_login_attempts(), - default_profile->get_failed_login_attempts()); - failed_login_limit_time = combine_default_value(profile_info->get_password_lock_time(), - default_profile->get_password_lock_time()); - } + failed_login_limit_num = combine_default_value(profile_info->get_failed_login_attempts(), + default_profile->get_failed_login_attempts()); + failed_login_limit_time = combine_default_value(profile_info->get_password_lock_time(), + default_profile->get_password_lock_time()); } } @@ -1200,33 +1189,22 @@ int ObSchemaGetterGuard::get_user_password_expire_times( uint64_t default_profile_id = OB_ORACLE_TENANT_INNER_PROFILE_ID; profile_id = user_info->get_profile_id(); password_last_change = user_info->get_password_last_changed(); - - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2250 && !is_valid_id(profile_id)) { - if (OB_FAIL(ObProfileSchema::get_default_value(ObProfileSchema::PASSWORD_LIFE_TIME, - password_life_time))) { - LOG_WARN("fail to get default value", KR(ret)); - } else if (OB_FAIL(ObProfileSchema::get_default_value(ObProfileSchema::PASSWORD_GRACE_TIME, - password_grace_time))) { - LOG_WARN("fail to get default value", KR(ret)); - } + if (!is_valid_id(profile_id)) { + profile_id = OB_ORACLE_TENANT_INNER_PROFILE_ID; + } + if (OB_FAIL(get_profile_schema_by_id(user_info->get_tenant_id(), + is_valid_id(profile_id) ? profile_id : default_profile_id, + profile_info))) { + LOG_WARN("fail to get profile info", KR(ret), KPC(user_info)); + } else if (OB_FAIL(get_profile_schema_by_id(user_info->get_tenant_id(), + default_profile_id, + default_profile))) { + LOG_WARN("fail to get profile info", KR(ret), KPC(user_info)); } else { - if (!is_valid_id(profile_id)) { - profile_id = OB_ORACLE_TENANT_INNER_PROFILE_ID; - } - if (OB_FAIL(get_profile_schema_by_id(user_info->get_tenant_id(), - is_valid_id(profile_id) ? profile_id : default_profile_id, - profile_info))) { - LOG_WARN("fail to get profile info", KR(ret), KPC(user_info)); - } else if (OB_FAIL(get_profile_schema_by_id(user_info->get_tenant_id(), - default_profile_id, - default_profile))) { - LOG_WARN("fail to get profile info", KR(ret), KPC(user_info)); - } else { - password_life_time = combine_default_value(profile_info->get_password_life_time(), - default_profile->get_password_life_time()); - password_grace_time = combine_default_value(profile_info->get_password_grace_time(), - default_profile->get_password_grace_time()); - } + password_life_time = combine_default_value(profile_info->get_password_life_time(), + default_profile->get_password_life_time()); + password_grace_time = combine_default_value(profile_info->get_password_grace_time(), + default_profile->get_password_grace_time()); } password_life_time = (password_life_time == -1) ? INT64_MAX : password_life_time; password_grace_time = (password_grace_time == -1) ? INT64_MAX : password_grace_time; @@ -1243,25 +1221,20 @@ int ObSchemaGetterGuard::get_user_profile_function_name(const uint64_t tenant_id const ObProfileSchema *profile_info = nullptr; const ObProfileSchema *default_profile = nullptr; - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2250 && !is_valid_id(profile_id)) { - //do nothing - function_name.reset(); - } else { - uint64_t default_profile_id = OB_ORACLE_TENANT_INNER_PROFILE_ID; + uint64_t default_profile_id = OB_ORACLE_TENANT_INNER_PROFILE_ID; - if (OB_FAIL(get_profile_schema_by_id(tenant_id, - is_valid_id(profile_id) ? profile_id : default_profile_id, - profile_info))) { - LOG_WARN("fail to get profile info", KR(ret)); - } else if (OB_FAIL(get_profile_schema_by_id(tenant_id, - default_profile_id, - default_profile))) { - LOG_WARN("fail to get profile info", KR(ret)); - } else { - function_name = profile_info->get_password_verify_function_str(); - if (0 == function_name.case_compare("DEFAULT")) { - function_name = default_profile->get_password_verify_function_str(); - } + if (OB_FAIL(get_profile_schema_by_id(tenant_id, + is_valid_id(profile_id) ? profile_id : default_profile_id, + profile_info))) { + LOG_WARN("fail to get profile info", KR(ret)); + } else if (OB_FAIL(get_profile_schema_by_id(tenant_id, + default_profile_id, + default_profile))) { + LOG_WARN("fail to get profile info", KR(ret)); + } else { + function_name = profile_info->get_password_verify_function_str(); + if (0 == function_name.case_compare("DEFAULT")) { + function_name = default_profile->get_password_verify_function_str(); } } return ret; @@ -2803,8 +2776,7 @@ int ObSchemaGetterGuard::check_db_access( // check db level privilege lib::Worker::CompatMode compat_mode; OZ (get_tenant_compat_mode(session_priv.tenant_id_, compat_mode)); - if (OB_SUCC(ret) && (compat_mode == lib::Worker::CompatMode::ORACLE) - && (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2260)) { + if (OB_SUCC(ret) && compat_mode == lib::Worker::CompatMode::ORACLE) { /* For compatibility_mode, check if user has been granted all privileges first */ if (((session_priv.user_priv_set_ | db_priv_set) & OB_PRIV_DB_ACC) || is_grant) { diff --git a/src/share/schema/ob_schema_mgr.cpp b/src/share/schema/ob_schema_mgr.cpp index e8c845689..483f49ebc 100644 --- a/src/share/schema/ob_schema_mgr.cpp +++ b/src/share/schema/ob_schema_mgr.cpp @@ -2479,59 +2479,51 @@ int ObSchemaMgr::add_table(const ObSimpleTableSchemaV2 &table_schema) } } if (OB_SUCC(ret) && (new_table_schema->is_table() || new_table_schema->is_oracle_tmp_table())) { - if (ObSchemaService::g_liboblog_mode_ && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2100) { - // do-nothing for liboblog - } else { - if (NULL != replaced_table) { - if (!replaced_table->is_user_hidden_table() - && new_table_schema->is_user_hidden_table()) { - if (OB_FAIL(delete_foreign_keys_in_table(*replaced_table))) { - LOG_WARN("delete foreign keys info from a hash map failed", - K(ret), K(*replaced_table)); - } - // deal with the situation that alter table drop fk and truncate table enter the recycle bin, - // and delete the foreign key information dropped from the hash map - // First delete the foreign key information on the table from the hash map when truncate table, - // and add it back when rebuild_table_hashmap - } else if (OB_FAIL(check_and_delete_given_fk_in_table(replaced_table, new_table_schema))) { - LOG_WARN("check and delete given fk in table failed", K(ret), K(*replaced_table), K(*new_table_schema)); + if (NULL != replaced_table) { + if (!replaced_table->is_user_hidden_table() + && new_table_schema->is_user_hidden_table()) { + if (OB_FAIL(delete_foreign_keys_in_table(*replaced_table))) { + LOG_WARN("delete foreign keys info from a hash map failed", + K(ret), K(*replaced_table)); } + // deal with the situation that alter table drop fk and truncate table enter the recycle bin, + // and delete the foreign key information dropped from the hash map + // First delete the foreign key information on the table from the hash map when truncate table, + // and add it back when rebuild_table_hashmap + } else if (OB_FAIL(check_and_delete_given_fk_in_table(replaced_table, new_table_schema))) { + LOG_WARN("check and delete given fk in table failed", K(ret), K(*replaced_table), K(*new_table_schema)); } - if (OB_SUCC(ret) && !new_table_schema->is_user_hidden_table()) { - if (OB_FAIL(add_foreign_keys_in_table(new_table_schema->get_simple_foreign_key_info_array(), 1 /*over_write*/))) { - LOG_WARN("add foreign keys info to a hash map failed", K(ret), K(*new_table_schema)); - } else { - // do nothing - } + } + if (OB_SUCC(ret) && !new_table_schema->is_user_hidden_table()) { + if (OB_FAIL(add_foreign_keys_in_table(new_table_schema->get_simple_foreign_key_info_array(), 1 /*over_write*/))) { + LOG_WARN("add foreign keys info to a hash map failed", K(ret), K(*new_table_schema)); + } else { + // do nothing } } } if (OB_SUCC(ret) && (new_table_schema->is_table() || new_table_schema->is_oracle_tmp_table())) { // In mysql mode, check constraints in non-temporary tables don't share namespace with constraints in temporary tables - if (ObSchemaService::g_liboblog_mode_ && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2110) { - // do-nothing for liboblog - } else { - if (NULL != replaced_table) { - if (!replaced_table->is_user_hidden_table() - && new_table_schema->is_user_hidden_table()) { - if (OB_FAIL(delete_constraints_in_table(*replaced_table))) { - LOG_WARN("delete constraint info from a hash map failed", - K(ret), K(*replaced_table)); - } - // deal with the situation that alter table drop cst and truncate table enter the recycle bin, - // delete the constraint information dropped from the hash map - // When truncate table, delete the constraint information on the table from the hash map first, - // and add it back when rebuild_table_hashmap - } else if (OB_FAIL(check_and_delete_given_cst_in_table(replaced_table, new_table_schema))) { - LOG_WARN("check and delete given cst in table failed", K(ret), K(*replaced_table), K(*new_table_schema)); + if (NULL != replaced_table) { + if (!replaced_table->is_user_hidden_table() + && new_table_schema->is_user_hidden_table()) { + if (OB_FAIL(delete_constraints_in_table(*replaced_table))) { + LOG_WARN("delete constraint info from a hash map failed", + K(ret), K(*replaced_table)); } + // deal with the situation that alter table drop cst and truncate table enter the recycle bin, + // delete the constraint information dropped from the hash map + // When truncate table, delete the constraint information on the table from the hash map first, + // and add it back when rebuild_table_hashmap + } else if (OB_FAIL(check_and_delete_given_cst_in_table(replaced_table, new_table_schema))) { + LOG_WARN("check and delete given cst in table failed", K(ret), K(*replaced_table), K(*new_table_schema)); } - if (OB_SUCC(ret) && !new_table_schema->is_user_hidden_table()) { - if (OB_FAIL(add_constraints_in_table(new_table_schema, 1 /*over_write*/))) { - LOG_WARN("add foreign keys info to a hash map failed", K(ret), K(*new_table_schema)); - } else { - // do nothing - } + } + if (OB_SUCC(ret) && !new_table_schema->is_user_hidden_table()) { + if (OB_FAIL(add_constraints_in_table(new_table_schema, 1 /*over_write*/))) { + LOG_WARN("add foreign keys info to a hash map failed", K(ret), K(*new_table_schema)); + } else { + // do nothing } } } @@ -3218,16 +3210,12 @@ int ObSchemaMgr::del_table(const ObTenantTableId table) ret = OB_HASH_NOT_EXIST != hash_ret ? hash_ret : ret; } if (OB_SUCC(ret)) { - if (ObSchemaService::g_liboblog_mode_ && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2100) { - // do-nothing for liboblog - } else if (OB_FAIL(delete_foreign_keys_in_table(*schema_to_del))) { + if (OB_FAIL(delete_foreign_keys_in_table(*schema_to_del))) { LOG_WARN("delete foreign keys info from a hash map failed", K(ret), K(*schema_to_del)); } } if (OB_SUCC(ret)) { - if (ObSchemaService::g_liboblog_mode_ && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2110) { - // do-nothing for liboblog - } else if (OB_FAIL(delete_constraints_in_table(*schema_to_del))) { + if (OB_FAIL(delete_constraints_in_table(*schema_to_del))) { LOG_WARN("delete constraint info from a hash map failed", K(ret), K(*schema_to_del)); } } @@ -4692,18 +4680,14 @@ int ObSchemaMgr::rebuild_table_hashmap(uint64_t &fk_cnt, uint64_t &cst_cnt) "table_name", table_schema->get_table_name()); } if (OB_SUCC(ret)) { - if (ObSchemaService::g_liboblog_mode_ && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2100) { - // do-nothing for liboblog - } else if (OB_FAIL(add_foreign_keys_in_table(table_schema->get_simple_foreign_key_info_array(), over_write))) { + if (OB_FAIL(add_foreign_keys_in_table(table_schema->get_simple_foreign_key_info_array(), over_write))) { LOG_WARN("add foreign keys info to a hash map failed", K(ret), K(table_schema->get_table_name_str())); } else { fk_cnt += table_schema->get_simple_foreign_key_info_array().count(); } } if (OB_SUCC(ret)) { - if (ObSchemaService::g_liboblog_mode_ && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2110) { - // do-nothing for liboblog - } else if (table_schema->is_mysql_tmp_table()) { + if (table_schema->is_mysql_tmp_table()) { // check constraints in non-temporary tables don't share namespace with constraints in temporary tables, do nothing } else if (OB_FAIL(add_constraints_in_table(table_schema, over_write))) { LOG_WARN("add constraint info to a hash map failed", K(ret), K(table_schema->get_table_name_str())); diff --git a/src/share/schema/ob_schema_retrieve_utils.ipp b/src/share/schema/ob_schema_retrieve_utils.ipp index 89fe16921..70531a150 100644 --- a/src/share/schema/ob_schema_retrieve_utils.ipp +++ b/src/share/schema/ob_schema_retrieve_utils.ipp @@ -1216,14 +1216,7 @@ int ObSchemaRetrieveUtils::fill_table_schema( SHARE_SCHEMA_LOG(WARN, "fail to set encryption str", K(ret), K(encryption)); } } - /* - * __all_table_v2_history is added in ver 2.2.60. To avoid compatibility problems, - * __all_table/__all_table_history/__all_table_v2/__all_table_v2_history should add columns in upgrade post stage from ver 2.2.60. - * Here, we should ignore error because column is not exist when cluster is still in upgradation. - */ - /* ver 2.2.60 */ - bool ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2270; + bool ignore_column_error = false; EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE( result, sub_part_template_flags, table_schema, int64_t, true /* skip null error*/, ignore_column_error, true); @@ -1232,13 +1225,9 @@ int ObSchemaRetrieveUtils::fill_table_schema( table_schema.set_def_sub_part_num(0); } - // table dop: table dop supported from 2270 int64_t default_table_dop = OB_DEFAULT_TABLE_DOP; EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, dop, table_schema, int64_t, true, ignore_column_error, default_table_dop); - // character_set_client and collation_connection of view schema, supported from 2271 - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2271; EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE( result, character_set_client, table_schema.get_view_schema(), @@ -1251,26 +1240,17 @@ int ObSchemaRetrieveUtils::fill_table_schema( ObCollationType, true /* skip null error*/, ignore_column_error, CS_TYPE_INVALID); - /* ver 3.1 */ - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3100; EXTRACT_BOOL_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, auto_part, partition_option, true, ignore_column_error, false); EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, auto_part_size, partition_option, int64_t, true, ignore_column_error, -1); - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0; EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_TENANT_ID_AND_DEFAULT_VALUE(result, association_table_id, table_schema, tenant_id, true, ignore_column_error, common::OB_INVALID_ID); EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_TENANT_ID_AND_DEFAULT_VALUE(result, define_user_id, table_schema, tenant_id, true, ignore_column_error, common::OB_INVALID_ID); - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_322; EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, max_dependency_version, table_schema, int64_t, true, ignore_column_error, common::OB_INVALID_VERSION); - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0; if (OB_SUCC(ret) && table_schema.is_interval_part()) { ObString btransition_point; ObString binterval_range; @@ -1289,7 +1269,6 @@ int ObSchemaRetrieveUtils::fill_table_schema( } } - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_; EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, tablet_id, table_schema, uint64_t, true, ignore_column_error, ObTabletID::INVALID_TABLET_ID); } @@ -2185,7 +2164,7 @@ int ObSchemaRetrieveUtils::fill_trigger_schema( EXTRACT_VARCHAR_FIELD_TO_CLASS_MYSQL_SKIP_RET(result, package_exec_env, trigger_info); EXTRACT_INT_FIELD_TO_CLASS_MYSQL(result, sql_mode, trigger_info, uint64_t); EXTRACT_VARCHAR_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, trigger_priv_user, trigger_info, - true, ObSchemaService::g_ignore_column_retrieve_error_ || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0, default_value); + true, false, default_value); } return ret; } @@ -2336,8 +2315,7 @@ int ObSchemaRetrieveUtils::fill_sequence_schema( EXTRACT_NUMBER_FIELD_TO_CLASS_MYSQL(result, cache_size, sequence_schema); EXTRACT_BOOL_FIELD_TO_CLASS_MYSQL(result, cycle_flag, sequence_schema); EXTRACT_BOOL_FIELD_TO_CLASS_MYSQL(result, order_flag, sequence_schema); - bool ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3200; + bool ignore_column_error = false; EXTRACT_BOOL_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, is_system_generated, sequence_schema, true, ignore_column_error, false); } return ret; @@ -3764,14 +3742,7 @@ int ObSchemaRetrieveUtils::fill_table_schema(const uint64_t tenant_id, SHARE_SCHEMA_LOG(WARN, "fail to set encryption str", K(ret), K(encryption)); } } - /* - * __all_table_v2_history is added in ver 2.2.60. To avoid compatibility problems, - * __all_table/__all_table_history/__all_table_v2/__all_table_v2_history should add columns in upgrade post stage from ver 2.2.60. - * Here, we should ignore error because column is not exist when cluster is still in upgradation. - */ - /* ver 2.2.60 */ - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2270; + ignore_column_error = false; EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE( result, sub_part_template_flags, table_schema, int64_t, true /* skip null error*/, ignore_column_error, true); @@ -3779,25 +3750,15 @@ int ObSchemaRetrieveUtils::fill_table_schema(const uint64_t tenant_id, table_schema.get_sub_part_option().set_part_num(0); table_schema.set_def_sub_part_num(0); } - /* ver 3.1 */ - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3100; EXTRACT_BOOL_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, auto_part, partition_option, true, ignore_column_error, false); EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, auto_part_size, partition_option, int64_t, true, ignore_column_error, -1); - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0; EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_TENANT_ID_AND_DEFAULT_VALUE(result, association_table_id, table_schema, tenant_id, true, ignore_column_error, common::OB_INVALID_ID); - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_322; EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, max_dependency_version, table_schema, int64_t, true, ignore_column_error, common::OB_INVALID_VERSION); } - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_0_0_0; - if (OB_SUCC(ret) && table_schema.is_interval_part()) { ObString btransition_point; ObString binterval_range; @@ -3815,7 +3776,6 @@ int ObSchemaRetrieveUtils::fill_table_schema(const uint64_t tenant_id, SHARE_SCHEMA_LOG(WARN, "Failed to set interval range to partition", K(ret)); } } - ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_; EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, tablet_id, table_schema, uint64_t, true, ignore_column_error, 0); } return ret; @@ -4758,9 +4718,7 @@ int ObSchemaRetrieveUtils::fill_tablespace_schema( EXTRACT_INT_FIELD_MYSQL(result, "is_deleted", is_deleted, bool); if (!is_deleted) { EXTRACT_VARCHAR_FIELD_TO_CLASS_MYSQL(result, tablespace_name, tablespace_schema); - // Because encryption_name/encrypt_key/master_key_id is added in upgrade post stage in ver 2.2.30. - bool ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2230; + bool ignore_column_error = false; ObString empty_str(""); EXTRACT_VARCHAR_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE( result, encryption_name, tablespace_schema, true, ignore_column_error, empty_str); @@ -4828,10 +4786,7 @@ int ObSchemaRetrieveUtils::fill_profile_schema( EXTRACT_INT_FIELD_TO_CLASS_MYSQL(result, password_lock_time, profile_schema, int64_t); EXTRACT_VARCHAR_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE( result, password_verify_function, profile_schema, true, ObSchemaService::g_ignore_column_retrieve_error_, default_password_verify_function); - // __all_tenant_profile is a new table in 2230, adding column actions should be in post stage. - // Ignore column error according to cluster version - bool ignore_column_error = ObSchemaService::g_ignore_column_retrieve_error_ - || GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2276; + bool ignore_column_error = false; EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, password_life_time, profile_schema, int64_t, false, ignore_column_error, INT64_MAX); EXTRACT_INT_FIELD_TO_CLASS_MYSQL_WITH_DEFAULT_VALUE(result, password_grace_time, profile_schema, diff --git a/src/share/schema/ob_schema_service_sql_impl.cpp b/src/share/schema/ob_schema_service_sql_impl.cpp index 151411bd1..2545dd019 100644 --- a/src/share/schema/ob_schema_service_sql_impl.cpp +++ b/src/share/schema/ob_schema_service_sql_impl.cpp @@ -886,7 +886,7 @@ int ObSchemaServiceSQLImpl::get_mock_fk_parent_table_schema_from_inner_table( #define FETCH_ALL_TENANT_HISTORY_SQL3 "SELECT * from %s where 1 = 1" #define FETCH_ALL_TABLE_HISTORY_SQL3 COMMON_SQL_WITH_TENANT -#define FETCH_ALL_TABLE_HISTORY_FULL_SCHEMA "SELECT /*+ leading(b a) use_nl(b a) %s*/ a.* FROM %s AS a JOIN "\ +#define FETCH_ALL_TABLE_HISTORY_FULL_SCHEMA "SELECT /*+ leading(b a) use_nl(b a) no_rewrite() */ a.* FROM %s AS a JOIN "\ "(SELECT tenant_id, table_id, MAX(schema_version) AS schema_version FROM %s "\ "WHERE tenant_id = %lu AND schema_version <= %ld GROUP BY tenant_id, table_id) AS b "\ "ON a.tenant_id = b.tenant_id AND a.table_id = b.table_id AND a.schema_version = b.schema_version "\ @@ -1119,49 +1119,18 @@ GET_ALL_SCHEMA_FUNC_DEFINE(sequence, ObSequenceSchema); GET_ALL_SCHEMA_FUNC_DEFINE(dblink, ObDbLinkSchema); GET_ALL_SCHEMA_FUNC_DEFINE(context, ObContextSchema); GET_ALL_SCHEMA_FUNC_DEFINE(mock_fk_parent_table, ObSimpleMockFKParentTableSchema); - -#define GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(SCHEMA, SCHEMA_TYPE, CLUSTER_VERSION) \ - int ObSchemaServiceSQLImpl::get_all_##SCHEMA##s(ObISQLClient &client, \ - const ObRefreshSchemaStatus &schema_status, \ - const int64_t schema_version, \ - const uint64_t tenant_id, \ - ObIArray &schema_array) \ - { \ - int ret = OB_SUCCESS; \ - schema_array.reset(); \ - if (!check_inner_stat()) { \ - ret = OB_NOT_INIT; \ - LOG_WARN("check inner stat fail"); \ - } else if (!ObSchemaService::g_liboblog_mode_ \ - && GCONF.in_upgrade_mode() \ - && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION) { \ - /* system table in tenant space will be created in upgrade post stage after ver 2.2.1.*/ \ - /* To avoid error while restart observer in upgrade stage, we skip refresh of new schema */ \ - /* when cluster is still in upgrade stage. */ \ - /* In addition, new schema history can be recorded after upgradation. */ \ - LOG_INFO("ignore "#SCHEMA" schema table NOT EXIST error while upgrade", K(ret), K(schema_status), K(schema_version), K(tenant_id)); \ - } else if (OB_FAIL(fetch_##SCHEMA##s(client, schema_status, schema_version, tenant_id, schema_array))) { \ - LOG_WARN("fetch "#SCHEMA"s failed", K(ret), K(schema_status), K(schema_version), K(tenant_id)); \ - /* for liboblog compatibility */ \ - if (-ER_NO_SUCH_TABLE == ret && ObSchemaService::g_liboblog_mode_) { \ - LOG_WARN("liboblog mode, ignore "#SCHEMA" schema table NOT EXIST error", K(ret), K(schema_status), K(schema_version), K(tenant_id)); \ - ret = OB_SUCCESS; \ - } \ - } \ - return ret; \ - } -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(keystore, ObKeystoreSchema, CLUSTER_VERSION_2220); -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(tablespace, ObTablespaceSchema, CLUSTER_VERSION_2220); -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(trigger, ObSimpleTriggerSchema, CLUSTER_VERSION_2220); -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(label_se_policy, ObLabelSePolicySchema, CLUSTER_VERSION_2230); -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(label_se_component, ObLabelSeComponentSchema, CLUSTER_VERSION_2230); -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(label_se_label, ObLabelSeLabelSchema, CLUSTER_VERSION_2230); -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(label_se_user_level, ObLabelSeUserLevelSchema, CLUSTER_VERSION_2230); -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(profile, ObProfileSchema, CLUSTER_VERSION_2230); -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(audit, ObSAuditSchema, CLUSTER_VERSION_2230); -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(sys_priv, ObSysPriv, CLUSTER_VERSION_2250); -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(obj_priv, ObObjPriv, CLUSTER_VERSION_2260); -GET_ALL_SCHEMA_IGNORE_FAIL_FUNC_DEFINE(directory, ObDirectorySchema, CLUSTER_VERSION_4_0_0_0); // TODO: change version to 3200 +GET_ALL_SCHEMA_FUNC_DEFINE(keystore, ObKeystoreSchema); +GET_ALL_SCHEMA_FUNC_DEFINE(tablespace, ObTablespaceSchema); +GET_ALL_SCHEMA_FUNC_DEFINE(trigger, ObSimpleTriggerSchema); +GET_ALL_SCHEMA_FUNC_DEFINE(label_se_policy, ObLabelSePolicySchema); +GET_ALL_SCHEMA_FUNC_DEFINE(label_se_component, ObLabelSeComponentSchema); +GET_ALL_SCHEMA_FUNC_DEFINE(label_se_label, ObLabelSeLabelSchema); +GET_ALL_SCHEMA_FUNC_DEFINE(label_se_user_level, ObLabelSeUserLevelSchema); +GET_ALL_SCHEMA_FUNC_DEFINE(profile, ObProfileSchema); +GET_ALL_SCHEMA_FUNC_DEFINE(audit, ObSAuditSchema); +GET_ALL_SCHEMA_FUNC_DEFINE(sys_priv, ObSysPriv); +GET_ALL_SCHEMA_FUNC_DEFINE(obj_priv, ObObjPriv); +GET_ALL_SCHEMA_FUNC_DEFINE(directory, ObDirectorySchema); int ObSchemaServiceSQLImpl::get_all_db_privs(ObISQLClient &client, const ObRefreshSchemaStatus &schema_status, @@ -3730,52 +3699,46 @@ int ObSchemaServiceSQLImpl::fetch_all_udt_object_info( ObMySQLResult *result = NULL; ObSqlString sql; const uint64_t exec_tenant_id = fill_exec_tenant_id(schema_status); - if ((ObSchemaService::g_liboblog_mode_ && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2270) - || (GCONF.in_upgrade_mode() && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2270)) { - LOG_WARN("in upgrade mode, table maybe not ready, just skip", - K(ret), K(schema_status), K(tenant_id), K(schema_version)); - } else { - if (OB_FAIL(sql.append_fmt(FETCH_ALL_OBJECT_TYPE_HISTORY_SQL, - OB_ALL_TENANT_OBJECT_TYPE_HISTORY_TNAME, - fill_extract_tenant_id(schema_status, tenant_id)))) { + if (OB_FAIL(sql.append_fmt(FETCH_ALL_OBJECT_TYPE_HISTORY_SQL, + OB_ALL_TENANT_OBJECT_TYPE_HISTORY_TNAME, + fill_extract_tenant_id(schema_status, tenant_id)))) { + LOG_WARN("append sql failed", K(ret)); + } else if (NULL != object_ids && object_ids_size > 0) { + if (OB_FAIL(sql.append_fmt(" AND OBJECT_TYPE_ID IN ("))) { LOG_WARN("append sql failed", K(ret)); - } else if (NULL != object_ids && object_ids_size > 0) { - if (OB_FAIL(sql.append_fmt(" AND OBJECT_TYPE_ID IN ("))) { - LOG_WARN("append sql failed", K(ret)); - } else { - for (int64_t i = 0; OB_SUCC(ret) && i < object_ids_size; ++i) { - const uint64_t object_type_id = fill_extract_schema_id(schema_status, object_ids[i]); - if (OB_FAIL(sql.append_fmt("%s%lu", 0 == i ? "" : ", ", object_type_id))) { - LOG_WARN("append sql failed", K(ret), K(i)); - } - } - if (OB_SUCC(ret)) { - if (OB_FAIL(sql.append(")"))) { - LOG_WARN("append sql failed", K(ret)); - } + } else { + for (int64_t i = 0; OB_SUCC(ret) && i < object_ids_size; ++i) { + const uint64_t object_type_id = fill_extract_schema_id(schema_status, object_ids[i]); + if (OB_FAIL(sql.append_fmt("%s%lu", 0 == i ? "" : ", ", object_type_id))) { + LOG_WARN("append sql failed", K(ret), K(i)); } } - } else { } - if (OB_SUCC(ret)) { - if (OB_FAIL(sql.append_fmt(" AND SCHEMA_VERSION <= %ld", schema_version))) { - LOG_WARN("append failed", K(ret)); - } else if (OB_FAIL( - sql.append(" ORDER BY TENANT_ID ASC, OBJECT_TYPE_ID ASC, TYPE ASC, SCHEMA_VERSION DESC"))) { - LOG_WARN("sql append failed", K(ret)); + if (OB_SUCC(ret)) { + if (OB_FAIL(sql.append(")"))) { + LOG_WARN("append sql failed", K(ret)); + } } } - if (OB_SUCC(ret)) { - const int64_t snapshot_timestamp = schema_status.snapshot_timestamp_; - DEFINE_SQL_CLIENT_RETRY_WEAK_WITH_SNAPSHOT(sql_client, snapshot_timestamp); - if (OB_FAIL(sql_client_retry_weak.read(res, exec_tenant_id, sql.ptr()))) { - LOG_WARN("execute sql failed", K(ret), K(tenant_id), K(sql)); - } else if (OB_UNLIKELY(NULL == (result = res.get_result()))) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("Fail to get result", K(ret)); - } else if (OB_FAIL(ObSchemaRetrieveUtils::retrieve_udt_object_schema(tenant_id, - *result, udt_infos))) { - LOG_WARN("Failed to retrieve udt object type infos", K(ret)); - } + } else { } + if (OB_SUCC(ret)) { + if (OB_FAIL(sql.append_fmt(" AND SCHEMA_VERSION <= %ld", schema_version))) { + LOG_WARN("append failed", K(ret)); + } else if (OB_FAIL( + sql.append(" ORDER BY TENANT_ID ASC, OBJECT_TYPE_ID ASC, TYPE ASC, SCHEMA_VERSION DESC"))) { + LOG_WARN("sql append failed", K(ret)); + } + } + if (OB_SUCC(ret)) { + const int64_t snapshot_timestamp = schema_status.snapshot_timestamp_; + DEFINE_SQL_CLIENT_RETRY_WEAK_WITH_SNAPSHOT(sql_client, snapshot_timestamp); + if (OB_FAIL(sql_client_retry_weak.read(res, exec_tenant_id, sql.ptr()))) { + LOG_WARN("execute sql failed", K(ret), K(tenant_id), K(sql)); + } else if (OB_UNLIKELY(NULL == (result = res.get_result()))) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("Fail to get result", K(ret)); + } else if (OB_FAIL(ObSchemaRetrieveUtils::retrieve_udt_object_schema(tenant_id, + *result, udt_infos))) { + LOG_WARN("Failed to retrieve udt object type infos", K(ret)); } } } @@ -3903,12 +3866,7 @@ int ObSchemaServiceSQLImpl::fetch_all_user_info( } } if (OB_SUCC(ret)) { - if (!ObSchemaService::g_liboblog_mode_ - && GCONF.in_upgrade_mode() - && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2260) { - LOG_WARN("in upgrade mode, table maybe not ready, just skip", - K(ret), K(schema_status), K(tenant_id), K(schema_version)); - } else if (OB_FAIL(fetch_role_grantee_map_info(schema_status, + if (OB_FAIL(fetch_role_grantee_map_info(schema_status, schema_version, tenant_id, sql_client, @@ -4270,15 +4228,8 @@ int ObSchemaServiceSQLImpl::fetch_tables( schema_service_))) { LOG_WARN("fail to get all table name", K(ret), K(exec_tenant_id)); } else if (!is_increase_schema) { - /* no_rewrite() hint for the following sql stmt is needed since ver 2.2.1. - * Otherwise, the following sql stmt will run in low performance. - * To avoid possible problem (no_rewrite() hint may cause error in ver 1.4.21), - * no_rewrite() hint is only added since ver 2.2.1. - */ - const char *addition_hint = GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2210 ? - "" : " no_rewrite() "; if (OB_FAIL(sql.append_fmt(FETCH_ALL_TABLE_HISTORY_FULL_SCHEMA, - addition_hint, table_name, table_name, + table_name, table_name, fill_extract_tenant_id(schema_status, tenant_id), schema_version, fill_extract_schema_id(schema_status, OB_ALL_CORE_TABLE_TID)))) { @@ -4940,11 +4891,7 @@ int ObSchemaServiceSQLImpl::get_not_core_table_schema( } } if (OB_SUCCESS == ret) { - if (!ObSchemaService::g_liboblog_mode_ && - GCONF.in_upgrade_mode() && - GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2220) { - LOG_WARN("skip fetch trigger list while upgrade in process from 221 to 222", K(tenant_id)); - } else if (OB_FAIL(fetch_trigger_list(schema_status, tenant_id, table_id, + if (OB_FAIL(fetch_trigger_list(schema_status, tenant_id, table_id, schema_version, sql_client, *table_schema))) { LOG_WARN("Failed to fetch trigger list", K(ret)); if (-ER_NO_SUCH_TABLE == ret && ObSchemaService::g_liboblog_mode_) { @@ -5126,13 +5073,7 @@ int ObSchemaServiceSQLImpl::fetch_constraint_column_info(const ObRefreshSchemaSt LOG_WARN("append table_id and foreign key id and schema version", K(ret), K(table_id), K(cst->get_constraint_id()), K(schema_version)); } else if (OB_FAIL(sql_client_retry_weak.read(res, exec_tenant_id, sql.ptr()))) { - if ((OB_TABLE_NOT_EXIST == ret) && (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3100)) { - LOG_INFO("cluster version is earlier than 3.1.0, ignore OB_TABLE_NOT_EXIST", - K(ret), K(GET_MIN_CLUSTER_VERSION()), K(sql)); - ret = OB_SUCCESS; - } else { - LOG_WARN("execute sql failed", K(ret), K(GET_MIN_CLUSTER_VERSION()), K(sql)); - } + LOG_WARN("execute sql failed", K(ret), K(sql)); } else if (OB_ISNULL(result = res.get_result())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("failed to get result. ", K(ret)); @@ -5327,13 +5268,7 @@ int ObSchemaServiceSQLImpl::fetch_part_info( const bool check_deleted = true; DEFINE_SQL_CLIENT_RETRY_WEAK_WITH_SNAPSHOT(sql_client, snapshot_timestamp); if (OB_FAIL(sql_client_retry_weak.read(res, exec_tenant_id, sql.ptr()))) { - if ((OB_TABLE_NOT_EXIST == ret) && (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3100)) { - LOG_INFO("cluster version is earlier than 3.1.0, ignore OB_TABLE_NOT_EXIST", - K(ret), K(GET_MIN_CLUSTER_VERSION()), K(sql)); - ret = OB_SUCCESS; - } else { - LOG_WARN("execute sql failed", K(ret), K(GET_MIN_CLUSTER_VERSION()), K(sql)); - } + LOG_WARN("execute sql failed", K(ret), K(sql)); } else if (OB_UNLIKELY(NULL == (result = res.get_result()))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("fail to get result. ", K(sql), K(ret)); @@ -5884,18 +5819,9 @@ int ObSchemaServiceSQLImpl::fetch_foreign_key_column_info( if (OB_FAIL(sql.append_fmt(FETCH_ALL_FOREIGN_KEY_COLUMN_HISTORY_SQL, OB_ALL_FOREIGN_KEY_COLUMN_HISTORY_TNAME, fill_extract_tenant_id(schema_status, tenant_id)))) { LOG_WARN("append sql failed", K(ret)); - } else if ((!ObSchemaService::g_liboblog_mode_ - || (ObSchemaService::g_liboblog_mode_ && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2250)) - && OB_FAIL(sql.append_fmt(" AND foreign_key_id = %lu AND schema_version <= %ld ORDER BY position ASC, schema_version DESC", - fill_extract_schema_id(schema_status, foreign_key_info.foreign_key_id_), - schema_version))) { - LOG_WARN("append table_id and foreign key id and schema version", - K(ret), K(foreign_key_info.foreign_key_id_), K(schema_version)); - } else if (ObSchemaService::g_liboblog_mode_ - && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2250 - && OB_FAIL(sql.append_fmt(" AND foreign_key_id = %lu AND schema_version <= %ld", - fill_extract_schema_id(schema_status, foreign_key_info.foreign_key_id_), - schema_version))) { + } else if (OB_FAIL(sql.append_fmt(" AND foreign_key_id = %lu AND schema_version <= %ld ORDER BY position ASC, schema_version DESC", + fill_extract_schema_id(schema_status, foreign_key_info.foreign_key_id_), + schema_version))) { LOG_WARN("append table_id and foreign key id and schema version", K(ret), K(foreign_key_info.foreign_key_id_), K(schema_version)); } else if (OB_FAIL(sql_client_retry_weak.read(res, exec_tenant_id, sql.ptr()))) { @@ -5928,10 +5854,7 @@ int ObSchemaServiceSQLImpl::fetch_foreign_key_array_for_simple_table_schemas( DEFINE_SQL_CLIENT_RETRY_WEAK_WITH_SNAPSHOT(sql_client, snapshot_timestamp); const uint64_t exec_tenant_id = fill_exec_tenant_id(schema_status); // FIXME: The following SQL will cause full table scan, which it's poor performance when the amount of table data is large. - if (ObSchemaService::g_liboblog_mode_ && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2100) { - LOG_INFO("liboblog mode, ignore"); - ret = OB_SUCCESS; - } else if (OB_FAIL(sql.append_fmt(FETCH_TABLE_ID_AND_NAME_FROM_ALL_FOREIGN_KEY_SQL, OB_ALL_FOREIGN_KEY_HISTORY_TNAME, + if (OB_FAIL(sql.append_fmt(FETCH_TABLE_ID_AND_NAME_FROM_ALL_FOREIGN_KEY_SQL, OB_ALL_FOREIGN_KEY_HISTORY_TNAME, fill_extract_tenant_id(schema_status, tenant_id)))) { LOG_WARN("failed to append sql", K(ret), K(tenant_id)); } else if (OB_FAIL(sql.append_fmt(" AND child_table_id IN "))) { @@ -6081,10 +6004,7 @@ int ObSchemaServiceSQLImpl::fetch_constraint_array_for_simple_table_schemas(cons SMART_VAR(ObMySQLProxy::MySQLResult, res) { ObMySQLResult *result = NULL; DEFINE_SQL_CLIENT_RETRY_WEAK_WITH_SNAPSHOT(sql_client, snapshot_timestamp); - if (ObSchemaService::g_liboblog_mode_ && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2110) { - LOG_INFO("liboblog mode, ignore"); - ret = OB_SUCCESS; - } else if (OB_FAIL(sql.append_fmt(FETCH_TABLE_ID_AND_CST_NAME_FROM_ALL_CONSTRAINT_HISTORY_SQL, OB_ALL_CONSTRAINT_HISTORY_TNAME, + if (OB_FAIL(sql.append_fmt(FETCH_TABLE_ID_AND_CST_NAME_FROM_ALL_CONSTRAINT_HISTORY_SQL, OB_ALL_CONSTRAINT_HISTORY_TNAME, fill_extract_tenant_id(schema_status, tenant_id)))) { LOG_WARN("failed to append sql", K(ret), K(tenant_id)); } else if (OB_FAIL(sql.append_fmt(" AND table_id IN "))) { @@ -8058,7 +7978,7 @@ int ObSchemaServiceSQLImpl::fetch_link_table_info(const ObDbLinkSchema &dblink_s int16_t scale = 0; int32_t length = 0; ObString column_name; - bool old_max_length = (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_1470) && !ObSchemaService::g_liboblog_mode_; + bool old_max_length = false; if (OB_FAIL(result->get_col_meta(i, old_max_length, column_name, type, precision, scale, length))) { LOG_WARN("failed to get column meta", K(i), K(old_max_length), K(ret)); } else if (OB_FAIL(column_schema.set_column_name(column_name))) { diff --git a/src/share/schema/ob_schema_struct.cpp b/src/share/schema/ob_schema_struct.cpp index 9945f6581..26cf9d5da 100644 --- a/src/share/schema/ob_schema_struct.cpp +++ b/src/share/schema/ob_schema_struct.cpp @@ -11554,7 +11554,6 @@ int ObProfileSchema::set_default_values() int ObProfileSchema::set_default_values_v2() { int ret = OB_SUCCESS; - //GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2250 for (int i = 0; OB_SUCC(ret) && i < MAX_PARAMS; ++i) { if (PASSWORD_VERIFY_FUNCTION == i) { password_verify_function_ = "DEFAULT"; diff --git a/src/share/schema/ob_schema_utils.cpp b/src/share/schema/ob_schema_utils.cpp index ed6604ddd..7cc18d87f 100644 --- a/src/share/schema/ob_schema_utils.cpp +++ b/src/share/schema/ob_schema_utils.cpp @@ -98,24 +98,15 @@ int ObSchemaUtils::cascaded_generated_column(ObTableSchema &table_schema, ObColumnSchemaV2 *col_schema = NULL; bool is_oracle_mode = false; if (column.is_generated_column()) { - if (ObSchemaService::g_liboblog_mode_ && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_1471) { - // when 2.0liboblog fetch <1471 cluster, Parsing the column schema only needs to read orig_default_value - // Can not judge cur_default_value.is_null(), because the dependent column may have a default value - // cur_default_value is is_not_null, misjudgment + // If the dependent column of the generated column has a change column, the current default value + // should be used instead of orig vaule + if (column.get_cur_default_value().is_null()) { if (OB_FAIL(column.get_orig_default_value().get_string(col_def))) { LOG_WARN("get orig default value failed", K(ret)); } } else { - // If the dependent column of the generated column has a change column, the current default value - // should be used instead of orig vaule - if (column.get_cur_default_value().is_null()) { - if (OB_FAIL(column.get_orig_default_value().get_string(col_def))) { - LOG_WARN("get orig default value failed", K(ret)); - } - } else { - if (OB_FAIL(column.get_cur_default_value().get_string(col_def))) { - LOG_WARN("get cur default value failed", K(ret)); - } + if (OB_FAIL(column.get_cur_default_value().get_string(col_def))) { + LOG_WARN("get cur default value failed", K(ret)); } } diff --git a/src/share/schema/ob_sequence_sql_service.cpp b/src/share/schema/ob_sequence_sql_service.cpp index 6714c4de3..26e83d237 100644 --- a/src/share/schema/ob_sequence_sql_service.cpp +++ b/src/share/schema/ob_sequence_sql_service.cpp @@ -417,10 +417,7 @@ int ObSequenceSqlService::add_sequence(common::ObISQLClient &sql_client, SQL_COL_APPEND_VALUE(sql, values, sequence_schema.get_cache_size().format(), "cache_size", "%s"); SQL_COL_APPEND_VALUE(sql, values, sequence_schema.get_order_flag(), "order_flag", "%d"); SQL_COL_APPEND_VALUE(sql, values, sequence_schema.get_cycle_flag(), "cycle_flag", "%d"); - - if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3200) { - SQL_COL_APPEND_VALUE(sql, values, sequence_schema.get_is_system_generated(), "is_system_generated", "%d"); - } + SQL_COL_APPEND_VALUE(sql, values, sequence_schema.get_is_system_generated(), "is_system_generated", "%d"); if (0 == STRCMP(tname[i], OB_ALL_SEQUENCE_OBJECT_HISTORY_TNAME)) { SQL_COL_APPEND_VALUE(sql, values, "false", "is_deleted", "%s"); } diff --git a/src/share/schema/ob_table_schema.cpp b/src/share/schema/ob_table_schema.cpp index 7e5dafbb5..bcd571940 100644 --- a/src/share/schema/ob_table_schema.cpp +++ b/src/share/schema/ob_table_schema.cpp @@ -1502,11 +1502,7 @@ bool ObTableSchema::is_valid() const } } else if (ob_is_text_tc(column->get_data_type()) || ob_is_json_tc(column->get_data_type())) { ObLength max_length = 0; - if ((GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_1470) && !ObSchemaService::g_liboblog_mode_) { - max_length = ObAccuracy::MAX_ACCURACY_OLD[column->get_data_type()].get_length(); - } else { - max_length = ObAccuracy::MAX_ACCURACY[column->get_data_type()].get_length(); - } + max_length = ObAccuracy::MAX_ACCURACY[column->get_data_type()].get_length(); if (max_length < column->get_data_length()) { LOG_WARN("length of text/blob column is larger than the max allowed length, ", "data_length", column->get_data_length(), "column_name", @@ -1514,11 +1510,7 @@ bool ObTableSchema::is_valid() const valid_ret = false; } else if (!column->is_shadow_column()) { // TODO @hanhui need seperate inline memtable length from store length - if ((GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_1470) && !ObSchemaService::g_liboblog_mode_) { - varchar_col_total_length += column->get_data_length(); - } else { - varchar_col_total_length += min(column->get_data_length(), OB_MAX_LOB_HANDLE_LENGTH); - } + varchar_col_total_length += min(column->get_data_length(), OB_MAX_LOB_HANDLE_LENGTH); } } } diff --git a/src/share/schema/ob_table_sql_service.cpp b/src/share/schema/ob_table_sql_service.cpp index 27ab71a24..640bd89aa 100644 --- a/src/share/schema/ob_table_sql_service.cpp +++ b/src/share/schema/ob_table_sql_service.cpp @@ -1237,16 +1237,6 @@ int ObTableSqlService::add_constraints_for_not_core(ObISQLClient &sql_client, if (OB_ISNULL(*cst_iter)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("iter is NULL", K(ret)); - } else if (CONSTRAINT_TYPE_CHECK == (*cst_iter)->get_constraint_type() - && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3100) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, - "do ddl with check constraint before cluster upgrade to 310"); - } else if (CONSTRAINT_TYPE_NOT_NULL == (*cst_iter)->get_constraint_type() - && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_312) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, - "do ddl with not null constraint before cluster upgrade to 312"); } else { // generate sql of 'insert into __all_constraint_history' and 'insert into __all_constraint' cst_dml.reset(); @@ -1284,7 +1274,7 @@ int ObTableSqlService::add_constraints_for_not_core(ObISQLClient &sql_client, } } // generate sql of 'insert into __all_constraint_column_history' and 'insert into __all_constraint_column' - if (OB_SUCC(ret) && (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100)) { + if (OB_SUCC(ret)) { for (ObConstraint::const_cst_col_iterator cst_col_iter = (*cst_iter)->cst_col_begin(); OB_SUCC(ret) && (cst_col_iter != (*cst_iter)->cst_col_end()); ++cst_col_iter, ++cst_cols_num_in_table) { @@ -1462,7 +1452,7 @@ int ObTableSqlService::delete_constraint(common::ObISQLClient &sql_client, } } // generate sql of 'insert into __all_constraint_column_history' and 'delete from __all_constraint_column' - if (OB_SUCC(ret) && (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100)) { + if (OB_SUCC(ret)) { for (ObConstraint::const_cst_col_iterator cst_col_iter = (*cst_iter)->cst_col_begin(); OB_SUCC(ret) && (cst_col_iter != (*cst_iter)->cst_col_end()); ++cst_col_iter, ++cst_cols_num_in_table) { @@ -1650,6 +1640,7 @@ int ObTableSqlService::add_single_constraint(ObISQLClient &sql_client, const bool do_cst_revise) { int ret = OB_SUCCESS; + UNUSED(do_cst_revise); ObDMLSqlSplicer dml; const uint64_t tenant_id = constraint.get_tenant_id(); const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id); @@ -1685,22 +1676,7 @@ int ObTableSqlService::add_single_constraint(ObISQLClient &sql_client, } // __all_constraint_column and __all_constraint_column_history - if (OB_SUCC(ret) && (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3100)) { - if (CONSTRAINT_TYPE_CHECK == constraint.get_constraint_type()) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, - "do ddl with check constraint before cluster upgrade to 310"); - } - } - if (OB_SUCC(ret) && !do_cst_revise && (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_312)) { - if (CONSTRAINT_TYPE_NOT_NULL == constraint.get_constraint_type()) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, - "do ddl with not null constraint before cluster upgrade to 311"); - } - } if (OB_SUCC(ret) - && (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100 || do_cst_revise) && need_to_deal_with_cst_cols) { // Because column schema won't change while alter table modify constraint states, // it's no need to modify constraint_column. @@ -2035,14 +2011,7 @@ int ObTableSqlService::delete_single_constraint( } } // mark delete in __all_constraint_column_history - if (OB_SUCC(ret) && (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3100)) { - if (CONSTRAINT_TYPE_CHECK == orig_constraint.get_constraint_type()) { - ret = OB_NOT_SUPPORTED; - LOG_USER_ERROR(OB_NOT_SUPPORTED, - "do ddl with check/not null constraint before cluster upgrade to 310"); - } - } - if (OB_SUCC(ret) && (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100)) { + if (OB_SUCC(ret)) { const int64_t is_deleted = 1; ObDMLExecHelper exec(sql_client, exec_tenant_id); const ObConstraint *constraint = @@ -2550,32 +2519,19 @@ int ObTableSqlService::gen_table_dml( exec_tenant_id, table.get_tablespace_id()))) // To avoid compatibility problems (such as error while upgrade virtual schema) in upgrade post stage, // cluster version judgemenet is needed if columns are added in upgrade post stage. - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2270 - && OB_FAIL(dml.add_column("sub_part_template_flags", table.get_sub_part_template_flags()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2270 - && OB_FAIL(dml.add_column("dop", table.get_dop()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2271 - && OB_FAIL(dml.add_column("character_set_client", table.get_view_schema().get_character_set_client()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2271 - && OB_FAIL(dml.add_column("collation_connection", table.get_view_schema().get_collation_connection()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100 - && OB_FAIL(dml.add_column("auto_part", table.get_part_option().is_auto_range_part()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100 - && OB_FAIL(dml.add_column("auto_part_size", table.get_part_option().get_auto_part_size()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && OB_FAIL(dml.add_column("association_table_id", ObSchemaUtils::get_extract_schema_id( - exec_tenant_id, table.get_association_table_id())))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && OB_FAIL(dml.add_column("define_user_id", ObSchemaUtils::get_extract_schema_id( - exec_tenant_id, table.get_define_user_id())))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_322 - && OB_FAIL(dml.add_column("max_dependency_version", table.get_max_dependency_version()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && (table.is_interval_part()) - && OB_FAIL(add_transition_point_val(dml, table))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && (table.is_interval_part()) - && OB_FAIL(add_interval_range_val(dml, table))) + || OB_FAIL(dml.add_column("sub_part_template_flags", table.get_sub_part_template_flags())) + || OB_FAIL(dml.add_column("dop", table.get_dop())) + || OB_FAIL(dml.add_column("character_set_client", table.get_view_schema().get_character_set_client())) + || OB_FAIL(dml.add_column("collation_connection", table.get_view_schema().get_collation_connection())) + || OB_FAIL(dml.add_column("auto_part", table.get_part_option().is_auto_range_part())) + || OB_FAIL(dml.add_column("auto_part_size", table.get_part_option().get_auto_part_size())) + || OB_FAIL(dml.add_column("association_table_id", ObSchemaUtils::get_extract_schema_id( + exec_tenant_id, table.get_association_table_id()))) + || OB_FAIL(dml.add_column("define_user_id", ObSchemaUtils::get_extract_schema_id( + exec_tenant_id, table.get_define_user_id()))) + || OB_FAIL(dml.add_column("max_dependency_version", table.get_max_dependency_version())) + || (table.is_interval_part() && OB_FAIL(add_transition_point_val(dml, table))) + || (table.is_interval_part() && OB_FAIL(add_interval_range_val(dml, table))) || (OB_FAIL(dml.add_column("tablet_id", table.get_tablet_id().id()))) ) { LOG_WARN("add column failed", K(ret)); @@ -2653,28 +2609,17 @@ int ObTableSqlService::gen_table_options_dml( exec_tenant_id, table.get_tablespace_id()))) // To avoid compatibility problems (such as error while upgrade virtual schema) in upgrade post stage, // cluster version judgemenet is needed if columns are added in upgrade post stage. - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2270 - && OB_FAIL(dml.add_column("sub_part_template_flags", table.get_sub_part_template_flags()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100 - && OB_FAIL(dml.add_column("auto_part", table.get_part_option().is_auto_range_part()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100 - && OB_FAIL(dml.add_column("auto_part_size", table.get_part_option().get_auto_part_size()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_322 - && OB_FAIL(dml.add_column("max_dependency_version", table.get_max_dependency_version()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_2270 - && OB_FAIL(dml.add_column("dop", table.get_dop()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && OB_FAIL(dml.add_column("association_table_id", ObSchemaUtils::get_extract_schema_id( - exec_tenant_id, table.get_association_table_id())))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && OB_FAIL(dml.add_column("define_user_id", ObSchemaUtils::get_extract_schema_id( - exec_tenant_id, table.get_define_user_id())))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && (table.is_interval_part()) - && OB_FAIL(add_transition_point_val(dml, table))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && (table.is_interval_part()) - && OB_FAIL(add_interval_range_val(dml, table))) + || OB_FAIL(dml.add_column("sub_part_template_flags", table.get_sub_part_template_flags())) + || OB_FAIL(dml.add_column("auto_part", table.get_part_option().is_auto_range_part())) + || OB_FAIL(dml.add_column("auto_part_size", table.get_part_option().get_auto_part_size())) + || OB_FAIL(dml.add_column("max_dependency_version", table.get_max_dependency_version())) + || OB_FAIL(dml.add_column("dop", table.get_dop())) + || OB_FAIL(dml.add_column("association_table_id", ObSchemaUtils::get_extract_schema_id( + exec_tenant_id, table.get_association_table_id()))) + || OB_FAIL(dml.add_column("define_user_id", ObSchemaUtils::get_extract_schema_id( + exec_tenant_id, table.get_define_user_id()))) + || (table.is_interval_part() && OB_FAIL(add_transition_point_val(dml, table))) + || (table.is_interval_part() && OB_FAIL(add_interval_range_val(dml, table))) || (OB_FAIL(dml.add_column("tablet_id", table.get_tablet_id().id()))) ) { LOG_WARN("add column failed", K(ret)); @@ -2708,27 +2653,18 @@ int ObTableSqlService::update_table_attribute(ObISQLClient &sql_client, || OB_FAIL(dml.add_column("sess_active_time", new_table_schema.get_sess_active_time())) //|| OB_FAIL(dml.add_column("create_host", new_table_schema.get_create_host())) || OB_FAIL(dml.add_column("autoinc_column_id", new_table_schema.get_autoinc_column_id())) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && OB_FAIL(dml.add_column("association_table_id", ObSchemaUtils::get_extract_schema_id( - exec_tenant_id, new_table_schema.get_association_table_id())))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && OB_FAIL(dml.add_column("define_user_id", ObSchemaUtils::get_extract_schema_id( - exec_tenant_id, new_table_schema.get_define_user_id())))) + || OB_FAIL(dml.add_column("association_table_id", ObSchemaUtils::get_extract_schema_id( + exec_tenant_id, new_table_schema.get_association_table_id()))) + || OB_FAIL(dml.add_column("define_user_id", ObSchemaUtils::get_extract_schema_id( + exec_tenant_id, new_table_schema.get_define_user_id()))) || OB_FAIL(dml.add_column("table_mode", new_table_schema.get_table_mode())) || OB_FAIL(dml.add_column("table_name", ObHexEscapeSqlStr(table_name))) || OB_FAIL(dml.add_column("auto_increment", share::ObRealUInt64(new_table_schema.get_auto_increment()))) || OB_FAIL(dml.add_column("sub_part_template_flags", new_table_schema.get_sub_part_template_flags())) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_322 - && OB_FAIL(dml.add_column("max_dependency_version", new_table_schema.get_max_dependency_version()))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && (new_table_schema.is_range_part()) - && OB_FAIL(add_transition_point_val(dml, new_table_schema))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && (new_table_schema.is_range_part()) - && OB_FAIL(add_interval_range_val(dml, new_table_schema))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && (new_table_schema.is_range_part()) - && (OB_FAIL(dml.add_column("part_func_type", part_option.get_part_func_type())))) + || OB_FAIL(dml.add_column("max_dependency_version", new_table_schema.get_max_dependency_version())) + || (new_table_schema.is_range_part() && OB_FAIL(add_transition_point_val(dml, new_table_schema))) + || (new_table_schema.is_range_part() && OB_FAIL(add_interval_range_val(dml, new_table_schema))) + || (OB_FAIL(dml.add_column("part_func_type", part_option.get_part_func_type()))) || OB_FAIL(dml.add_column("auto_increment", share::ObRealUInt64(new_table_schema.get_auto_increment()))) || OB_FAIL(dml.add_column("tablet_id", new_table_schema.get_tablet_id().id())) || OB_FAIL(dml.add_column("data_table_id", new_table_schema.get_data_table_id()))) { @@ -2805,12 +2741,8 @@ int ObTableSqlService::gen_partition_option_dml(const ObTableSchema &table, ObDM || OB_FAIL(dml.add_column("auto_part", table.get_part_option().is_auto_range_part())) || OB_FAIL(dml.add_column("auto_part_size", table.get_part_option().get_auto_part_size())) || OB_FAIL(dml.add_gmt_create()) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && (table.is_interval_part()) - && OB_FAIL(add_transition_point_val(dml, table))) - || (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_0_0_0 - && (table.is_interval_part()) - && OB_FAIL(add_interval_range_val(dml, table))) + || (table.is_interval_part() && OB_FAIL(add_transition_point_val(dml, table))) + || (table.is_interval_part() && OB_FAIL(add_interval_range_val(dml, table))) || OB_FAIL(dml.add_gmt_modified())) { LOG_WARN("add column failed", K(ret)); } @@ -3258,11 +3190,9 @@ int ObTableSqlService::delete_from_all_table_stat_history(ObISQLClient &sql_clie int ret = OB_SUCCESS; ObDMLSqlSplicer dml; const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id); - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_321) { - // do nothing - } else if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( + if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( exec_tenant_id, tenant_id))) - || OB_FAIL(dml.add_pk_column("table_id", ObSchemaUtils::get_extract_schema_id( + || OB_FAIL(dml.add_pk_column("table_id", ObSchemaUtils::get_extract_schema_id( exec_tenant_id, table_id)))) { LOG_WARN("add column failed", K(ret)); } else { @@ -3285,11 +3215,9 @@ int ObTableSqlService::delete_from_all_column_stat_history(ObISQLClient &sql_cli int ret = OB_SUCCESS; ObDMLSqlSplicer dml; const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id); - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_321) { - // do nothing - } else if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( + if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( exec_tenant_id, tenant_id))) - || OB_FAIL(dml.add_pk_column("table_id", ObSchemaUtils::get_extract_schema_id( + || OB_FAIL(dml.add_pk_column("table_id", ObSchemaUtils::get_extract_schema_id( exec_tenant_id, table_id)))) { LOG_WARN("add column failed", K(ret)); } else { @@ -3312,11 +3240,9 @@ int ObTableSqlService::delete_from_all_histogram_stat_history(ObISQLClient &sql_ int ret = OB_SUCCESS; ObDMLSqlSplicer dml; const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id); - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_321) { - // do nothing - } else if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( + if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( exec_tenant_id, tenant_id))) - || OB_FAIL(dml.add_pk_column("table_id", ObSchemaUtils::get_extract_schema_id( + || OB_FAIL(dml.add_pk_column("table_id", ObSchemaUtils::get_extract_schema_id( exec_tenant_id, table_id)))) { LOG_WARN("add column failed", K(ret)); } else { @@ -3340,11 +3266,9 @@ int ObTableSqlService::delete_from_all_optstat_user_prefs(ObISQLClient &sql_clie ObDMLSqlSplicer dml; const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id); - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_321) { - // do nothing - } else if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( + if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( exec_tenant_id, tenant_id))) - || OB_FAIL(dml.add_pk_column("table_id", ObSchemaUtils::get_extract_schema_id( + || OB_FAIL(dml.add_pk_column("table_id", ObSchemaUtils::get_extract_schema_id( exec_tenant_id, table_id)))) { LOG_WARN("add column failed", K(ret)); } else { @@ -4640,16 +4564,6 @@ int ObTableSqlService::check_table_options(const ObTableSchema &table) } } - if (OB_SUCC(ret)) { - if (table.get_dop() > 1 && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2270) { - // defendence, new feature can take effect after upgradation is done. - ret = OB_NOT_SUPPORTED; - LOG_WARN("DDL operation where dop is greater than 1 during cluster upgrade to 310 is not supported", - K(ret), K(GET_MIN_CLUSTER_VERSION())); - LOG_USER_ERROR(OB_NOT_SUPPORTED, - "DDL operation where dop is greater than 1 during cluster upgrade to 310 is not supported"); - } - } return ret; } @@ -4750,11 +4664,9 @@ int ObTableSqlService::delete_from_all_monitor_modified(ObISQLClient &sql_client ObDMLSqlSplicer dml; const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id); int64_t affected_rows = 0; - if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_321) { - // do nothing - } else if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( - exec_tenant_id, tenant_id))) || - OB_FAIL(dml.add_pk_column("table_id", ObSchemaUtils::get_extract_schema_id( + if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( + exec_tenant_id, tenant_id))) + || OB_FAIL(dml.add_pk_column("table_id", ObSchemaUtils::get_extract_schema_id( exec_tenant_id, table_id)))) { LOG_WARN("add column failed", K(ret)); } else if (OB_FAIL(exec_delete(sql_client, tenant_id, table_id, diff --git a/src/share/schema/ob_udt_sql_service.cpp b/src/share/schema/ob_udt_sql_service.cpp index f27dc3613..4548fb5ff 100644 --- a/src/share/schema/ob_udt_sql_service.cpp +++ b/src/share/schema/ob_udt_sql_service.cpp @@ -335,9 +335,7 @@ int ObUDTSqlService::add_udt_object(ObISQLClient &sql_client, bool only_history) { int ret = OB_SUCCESS; - bool is_invalid_version = ObSchemaService::g_liboblog_mode_ - && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2270; - if (udt_info.is_object_type() && !is_invalid_version) { + if (udt_info.is_object_type()) { const uint64_t tenant_id = udt_info.get_tenant_id(); const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id); ObUDTObjectType *obj_info = NULL; @@ -571,14 +569,10 @@ int ObUDTSqlService::del_udt_object(ObISQLClient &sql_client, int64_t new_schema_version) { int ret = OB_SUCCESS; - bool is_invalid_version = ObSchemaService::g_liboblog_mode_ - && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2270; const uint64_t tenant_id = udt_info.get_tenant_id(); const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id); ObDMLSqlSplicer dml; - if (INVALID_UDT_OBJECT_TYPE == object_type && is_invalid_version) { - // do nothing; - } else if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( + if (OB_FAIL(dml.add_pk_column("tenant_id", ObSchemaUtils::get_extract_tenant_id( exec_tenant_id, udt_info.get_tenant_id()))) || OB_FAIL(dml.add_pk_column("object_type_id", ObSchemaUtils::get_extract_schema_id( exec_tenant_id, udt_info.get_type_id()))) @@ -595,7 +589,7 @@ int ObUDTSqlService::del_udt_object(ObISQLClient &sql_client, K(object_type), K(new_schema_version)); } } - if (OB_SUCC(ret) && INVALID_UDT_OBJECT_TYPE != object_type && !is_invalid_version) { + if (OB_SUCC(ret) && INVALID_UDT_OBJECT_TYPE != object_type) { ObSqlString sql; int64_t affected_rows = 0; if (OB_FAIL(sql.assign_fmt("INSERT INTO %s(tenant_id, object_type_id, type, schema_version, is_deleted) VALUES(%lu,%lu, %ld, %ld,%d)", diff --git a/src/share/stat/ob_opt_stat_sql_service.cpp b/src/share/stat/ob_opt_stat_sql_service.cpp index e1ac8226e..f45ca74f6 100644 --- a/src/share/stat/ob_opt_stat_sql_service.cpp +++ b/src/share/stat/ob_opt_stat_sql_service.cpp @@ -1125,15 +1125,6 @@ int ObOptStatSqlService::fill_table_stat(common::sqlclient::ObMySQLResult &resul EXTRACT_INT_FIELD_TO_CLASS_MYSQL(result, partition_id, stat, int64_t); EXTRACT_INT_FIELD_TO_CLASS_MYSQL(result, object_type, stat, int64_t); EXTRACT_INT_FIELD_TO_CLASS_MYSQL(result, row_count, stat, int64_t); - // if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_3200) { - // EXTRACT_INT_FIELD_TO_CLASS_MYSQL(result, avg_row_size, stat, int64_t); - // } else { - // EXTRACT_DOUBLE_FIELD_TO_CLASS_MYSQL(result, avg_row_size, stat, double); - // } - // why not use GET_MIN_CLUSTER_VERSION to check result is int64_t or double? - // Because there has a corner case. When execute inner sql, min cluster verion is 3100. - // inner sql will select __all_table_stat and avg_row_size is int64_t. When fill table - // min cluster version is 3200, but avg_row_size result is int64_t, not double. if (OB_SUCC(ret)) { if (OB_FAIL(result.get_type("avg_row_size", obj_type))) { LOG_WARN("failed to get type", K(ret)); diff --git a/src/sql/engine/cmd/ob_table_executor.cpp b/src/sql/engine/cmd/ob_table_executor.cpp index 41cd14808..62210aef7 100644 --- a/src/sql/engine/cmd/ob_table_executor.cpp +++ b/src/sql/engine/cmd/ob_table_executor.cpp @@ -534,144 +534,6 @@ int ObAlterTableExecutor::refresh_schema_for_table( return ret; } -/* 3100 之前的版本 alter table 逻辑 - alter table 向 RS 发 RPC 时,如果有 add index 或者 add unqiue 操作,就发送 “两批” RPC: - 第一批 RPC 只有一个 RPC,是不包含 add index 或者 add unqiue 操作以外的其他操作的 alter table 的 RPC - 第二批 RPC 是 alter table 中每创建一个索引,就向 RS 发一个 rpc,observer 端同步等待索引建成功或者建失败 - a)如果成功就继续发送下一个创建索引的 RPC; - b)如果失败,就报错结束,并终止发送后面还没有向 RS 发送 RPC(即还没有创建)的创建索引请求。前面已经发送和创建索引无关的 RPC 在 RS 端均已处理成功,不再回滚。但如果一条 alter table 同时建了多个 index,其中一个失败,就回滚所有已经建立的 index。 -*/ -int ObAlterTableExecutor::alter_table_rpc_v1( - obrpc::ObAlterTableArg &alter_table_arg, - obrpc::ObAlterTableRes &res, - common::ObIAllocator &allocator, - obrpc::ObCommonRpcProxy *common_rpc_proxy, - ObSQLSessionInfo *my_session, - const bool is_sync_ddl_user) -{ - int ret = OB_SUCCESS; - bool alter_table_add_index = false; - const ObSArray index_arg_list = alter_table_arg.index_arg_list_; - if (OB_ISNULL(my_session)) { - ret = OB_INVALID_ARGUMENT; - LOG_WARN("invalid argument", K(ret)); - } else { - alter_table_arg.compat_mode_ = ORACLE_MODE == my_session->get_compatibility_mode() ? - lib::Worker::CompatMode::ORACLE : lib::Worker::CompatMode::MYSQL; - } - for (int64_t i = 0; OB_SUCC(ret) && i < index_arg_list.size(); ++i) { - obrpc::ObIndexArg *index_arg = index_arg_list.at(i); - if (OB_ISNULL(index_arg)) { - ret = OB_INVALID_ARGUMENT; - LOG_WARN("index arg should not be null", K(ret)); - } else if (obrpc::ObIndexArg::ADD_INDEX == index_arg->index_action_type_) { - alter_table_add_index = true; - break; - } - } - if (!alter_table_add_index) { - // alter table 中没有 add index 的情况 - if (OB_FAIL(common_rpc_proxy->alter_table(alter_table_arg, res))) { - LOG_WARN("rpc proxy alter table failed", K(ret), "dst", common_rpc_proxy->get_server(), K(alter_table_arg)); - } - } else { - // alter table 中有 add index 的情况 - ObSArray add_index_arg_list; - alter_table_arg.index_arg_list_.reset(); - for (int64_t i = 0; OB_SUCC(ret) && i < index_arg_list.size(); ++i) { - obrpc::ObIndexArg *index_arg = index_arg_list.at(i); - if (OB_ISNULL(index_arg)) { - ret = OB_INVALID_ARGUMENT; - LOG_WARN("index arg should not be null", K(ret)); - } else if (obrpc::ObIndexArg::ADD_INDEX == index_arg->index_action_type_) { - if (OB_FAIL(add_index_arg_list.push_back(index_arg))) { - LOG_WARN("fail to push back to arg_for_adding_index_list", K(ret)); - } - } else { // not for adding index - if (OB_FAIL(alter_table_arg.index_arg_list_.push_back(index_arg))) { - LOG_WARN("fail to push back to arg_for_adding_index_list", K(ret)); - } - } - } - if (OB_SUCC(ret)) { - if (OB_FAIL(common_rpc_proxy->alter_table(alter_table_arg, res))) { - LOG_WARN("rpc proxy alter table for not adding index failed", K(ret), "dst", common_rpc_proxy->get_server(), K(alter_table_arg)); - } - } - if (OB_SUCC(ret)) { - ObString empty_stmt; - alter_table_arg.is_alter_columns_ = false; - alter_table_arg.is_alter_options_ = false; - alter_table_arg.is_alter_partitions_ = false; - alter_table_arg.ddl_stmt_str_ = empty_stmt; - alter_table_arg.ddl_id_str_ = empty_stmt; - alter_table_arg.alter_constraint_type_ = obrpc::ObAlterTableArg::CONSTRAINT_NO_OPERATION; - ObSArray added_index_table_ids; - ObCreateIndexExecutor create_index_executor; - for (int64_t i = 0; OB_SUCC(ret) && i < add_index_arg_list.size(); ++i) { - alter_table_arg.index_arg_list_.reset(); - if (OB_FAIL(alter_table_arg.index_arg_list_.push_back(add_index_arg_list.at(i)))) { - LOG_WARN("fail to push back to arg_for_adding_index_list", K(ret)); - } else if (OB_FAIL(common_rpc_proxy->alter_table(alter_table_arg, res))) { - LOG_WARN("rpc proxy alter table for adding index failed", K(ret), "dst", common_rpc_proxy->get_server(), K(alter_table_arg)); - } else { - // 同步等索引建成功 - obrpc::ObIndexArg *index_arg = alter_table_arg.index_arg_list_.at(0); - obrpc::ObCreateIndexArg *create_index_arg = NULL; - if (OB_ISNULL(index_arg)) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("index arg is null", K(ret), K(i)); - } else if (obrpc::ObIndexArg::ADD_INDEX != index_arg->index_action_type_) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("index action type should be add index", K(ret), K(i)); - } else if (OB_ISNULL(create_index_arg = static_cast(index_arg))) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("create index arg is null", K(ret), K(i)); - } else if (!is_sync_ddl_user) { - // 只考虑非备份恢复时的索引同步检查 - create_index_arg->index_schema_.set_table_id(res.index_table_id_); - create_index_arg->index_schema_.set_schema_version(res.schema_version_); - if (OB_FAIL(create_index_executor.sync_check_index_status(*my_session, *common_rpc_proxy, *create_index_arg, res, allocator))) { - LOG_WARN("failed to sync_check_index_status", K(ret), K(*create_index_arg), K(i)); - } else { - added_index_table_ids.push_back(res.index_table_id_); - } - } - } - } - // 如果一条 alter table 同时建了多个 index,其中一个失败,就回滚所有已经建立的 index - if (OB_FAIL(ret)) { - int tmp_ret = OB_SUCCESS; - for (int64_t i = 0; OB_SUCCESS == tmp_ret && i < added_index_table_ids.size(); ++i) { - obrpc::ObDropIndexArg drop_index_arg; - obrpc::ObDropIndexRes drop_index_res; - obrpc::ObCreateIndexArg *create_index_arg = static_cast(add_index_arg_list.at(i)); - drop_index_arg.tenant_id_ = create_index_arg->tenant_id_; - drop_index_arg.exec_tenant_id_ = create_index_arg->tenant_id_; - drop_index_arg.index_table_id_ = added_index_table_ids.at(i); - drop_index_arg.session_id_ = create_index_arg->session_id_; - drop_index_arg.index_name_ = create_index_arg->index_name_; - drop_index_arg.table_name_ = create_index_arg->table_name_; - drop_index_arg.database_name_ = create_index_arg->database_name_; - drop_index_arg.index_action_type_ = obrpc::ObIndexArg::DROP_INDEX; - drop_index_arg.is_add_to_scheduler_ = false; - if (OB_SUCCESS != (tmp_ret = create_index_executor.set_drop_index_stmt_str(drop_index_arg, allocator))) { - LOG_WARN("fail to set drop index ddl_stmt_str", K(tmp_ret)); - } else if (OB_SUCCESS != (tmp_ret = common_rpc_proxy->drop_index(drop_index_arg, drop_index_res))) { - LOG_WARN("rpc proxy drop index failed", "dst", common_rpc_proxy->get_server(), - K(tmp_ret), - K(drop_index_arg.table_name_), - K(drop_index_arg.index_name_)); - } - } - LOG_INFO("added indexes failed, we rolled back all indexes added in this same alter table sql. But we didn't roll back other actions in this same alter table sql"); - } - } - } - - return ret; -} - /* 从 3100 开始的版本 alter table 逻辑是将建索引和其他操作放到同一个 rpc 里发到 rs,返回后对每个创建的索引进行同步等,如果一个索引创建失败,则回滚全部索引 mysql 模式下支持 alter table 同时做建索引操作和其他操作,需要保证 rs 在处理 drop index 之后再处理 add index 否则前缀索引会有问题:https://code.aone.alibaba-inc.com/oceanbase/oceanbase/codereview/1907077 diff --git a/src/sql/engine/cmd/ob_table_executor.h b/src/sql/engine/cmd/ob_table_executor.h index 79deb7a2e..627f81c0e 100644 --- a/src/sql/engine/cmd/ob_table_executor.h +++ b/src/sql/engine/cmd/ob_table_executor.h @@ -88,14 +88,6 @@ private: ObString first_stmt, const bool need_modify_notnull_validate); - int alter_table_rpc_v1( - obrpc::ObAlterTableArg &alter_table_arg, - obrpc::ObAlterTableRes &res, - common::ObIAllocator &allocator, - obrpc::ObCommonRpcProxy *common_rpc_proxy, - ObSQLSessionInfo *my_session, - const bool is_sync_ddl_user); - int alter_table_rpc_v2( obrpc::ObAlterTableArg &alter_table_arg, obrpc::ObAlterTableRes &res, diff --git a/src/sql/engine/ob_exec_context.cpp b/src/sql/engine/ob_exec_context.cpp index c13123a66..2ca9f851a 100644 --- a/src/sql/engine/ob_exec_context.cpp +++ b/src/sql/engine/ob_exec_context.cpp @@ -197,7 +197,7 @@ void ObExecContext::clean_resolve_ctx() uint64_t ObExecContext::get_ser_version() const { - return GET_UNIS_CLUSTER_VERSION() < CLUSTER_VERSION_2250 ? SER_VERSION_0 : SER_VERSION_1; + return SER_VERSION_1; } void ObExecContext::reset_op_ctx() diff --git a/src/sql/engine/sort/ob_base_sort.h b/src/sql/engine/sort/ob_base_sort.h index b74ae0cb9..c6ebc5e3e 100644 --- a/src/sql/engine/sort/ob_base_sort.h +++ b/src/sql/engine/sort/ob_base_sort.h @@ -69,7 +69,7 @@ public: index_ = index; cs_type_ = cs_type; if (is_asc) { - extra_info_ |= SORT_COL_ASC_BIT; + extra_info_ |= SORT_COL_ASC_BIT; } else { extra_info_ &= SORT_COL_ASC_MASK; } @@ -86,7 +86,7 @@ public: cs_type_ = cs_type; extra_info_ &= SORT_COL_ASC_MASK; if (is_asc) { - extra_info_ |= SORT_COL_ASC_BIT; + extra_info_ |= SORT_COL_ASC_BIT; } extra_info_ &= SORT_COL_EXTRA_MASK; extra_info_ |= SORT_COL_EXTRA_BIT; diff --git a/src/sql/ob_sql_utils.cpp b/src/sql/ob_sql_utils.cpp index a70c4d3d8..72080436f 100644 --- a/src/sql/ob_sql_utils.cpp +++ b/src/sql/ob_sql_utils.cpp @@ -997,13 +997,7 @@ int ObSQLUtils::check_and_convert_db_name(const ObCollationType cs_type, const b ObString origin_name = name; int64_t name_len = name.length(); const char *name_str = name.ptr(); - /** - * 在2.2.20版本上将命名长度比较逻辑由大于等于128字节时报错调整为大于128字节时报错后, 2.2.20以上版本 - * 数据库名长度可以为128字节。 升级过程中高版本server序列化session info到低版本server时, 如果数据 - * 库名长度为128字节会存在兼容性问题。 因此在升级过程中限制数据库名长度不超过127字节 - */ - int32_t max_database_name_length = GET_MIN_CLUSTER_VERSION() < CLUSTER_CURRENT_VERSION ? - OB_MAX_DATABASE_NAME_LENGTH - 1 : OB_MAX_DATABASE_NAME_LENGTH; + int32_t max_database_name_length = OB_MAX_DATABASE_NAME_LENGTH; if (0 == name_len || name_len > (max_database_name_length * OB_MAX_CHAR_LEN)) { ret = OB_WRONG_DB_NAME; LOG_USER_ERROR(OB_WRONG_DB_NAME, static_cast(name_len), name_str); diff --git a/src/sql/resolver/ddl/ob_drop_index_resolver.cpp b/src/sql/resolver/ddl/ob_drop_index_resolver.cpp index 5cf254c9f..e58a551e9 100644 --- a/src/sql/resolver/ddl/ob_drop_index_resolver.cpp +++ b/src/sql/resolver/ddl/ob_drop_index_resolver.cpp @@ -62,13 +62,7 @@ int ObDropIndexResolver::resolve(const ParseNode &parse_tree) // get table name in oracle mode if (OB_SUCC(ret) && lib::is_oracle_mode()) { ParseNode *db_node = NULL; - /** - * 在2.2.20版本上将命名长度比较逻辑由大于等于128字节时报错调整为大于128字节时报错后, 2.2.20以上版本 - * 数据库名长度可以为128字节。 升级过程中高版本server序列化session info到低版本server时, 如果数据 - * 库名长度为128字节会存在兼容性问题。 因此在升级过程中限制数据库名长度不超过127字节 - */ - int32_t max_database_name_length = GET_MIN_CLUSTER_VERSION() < CLUSTER_CURRENT_VERSION ? - OB_MAX_DATABASE_NAME_LENGTH - 1 : OB_MAX_DATABASE_NAME_LENGTH; + int32_t max_database_name_length = OB_MAX_DATABASE_NAME_LENGTH; if (1 == parse_tree.num_child_) { index_node = parse_tree.children_[0]; } else if (2 == parse_tree.num_child_) { diff --git a/src/sql/resolver/ddl/ob_flashback_resolver.cpp b/src/sql/resolver/ddl/ob_flashback_resolver.cpp index c911fa889..d2d64426c 100644 --- a/src/sql/resolver/ddl/ob_flashback_resolver.cpp +++ b/src/sql/resolver/ddl/ob_flashback_resolver.cpp @@ -285,13 +285,7 @@ int ObFlashBackDatabaseResolver::resolve(const ParseNode &parser_tree) { int ret = OB_SUCCESS; ObFlashBackDatabaseStmt *flashback_database_stmt = NULL; - /** - * 在2.2.20版本上将命名长度比较逻辑由大于等于128字节时报错调整为大于128字节时报错后, 2.2.20以上版本 - * 数据库名长度可以为128字节。 升级过程中高版本server序列化session info到低版本server时, 如果数据 - * 库名长度为128字节会存在兼容性问题。 因此在升级过程中限制数据库名长度不超过127字节 - */ - int32_t max_database_name_length = GET_MIN_CLUSTER_VERSION() < CLUSTER_CURRENT_VERSION ? - OB_MAX_DATABASE_NAME_LENGTH - 1 : OB_MAX_DATABASE_NAME_LENGTH; + int32_t max_database_name_length = OB_MAX_DATABASE_NAME_LENGTH; if (OB_ISNULL(session_info_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("session_info is null", K(ret)); @@ -355,13 +349,7 @@ int ObFlashBackTenantResolver::resolve(const ParseNode &parser_tree) { int ret = OB_SUCCESS; ObFlashBackTenantStmt *flashback_tenant_stmt = NULL; - /** - * 在2.2.20版本上将命名长度比较逻辑由大于等于128字节时报错调整为大于128字节时报错后, 2.2.20以上版本 - * 数据库名长度可以为128字节。 升级过程中高版本server序列化session info到低版本server时, 如果数据 - * 库名长度为128字节会存在兼容性问题。 因此在升级过程中限制数据库名长度不超过127字节 - */ - int32_t max_database_name_length = GET_MIN_CLUSTER_VERSION() < CLUSTER_CURRENT_VERSION ? - OB_MAX_DATABASE_NAME_LENGTH - 1 : OB_MAX_DATABASE_NAME_LENGTH; + int32_t max_database_name_length = OB_MAX_DATABASE_NAME_LENGTH; if (OB_ISNULL(session_info_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("session_info is null", K(ret)); diff --git a/src/sql/resolver/ddl/ob_purge_resolver.cpp b/src/sql/resolver/ddl/ob_purge_resolver.cpp index 3e2d2761a..d35c92212 100644 --- a/src/sql/resolver/ddl/ob_purge_resolver.cpp +++ b/src/sql/resolver/ddl/ob_purge_resolver.cpp @@ -175,13 +175,7 @@ int ObPurgeDatabaseResolver::resolve(const ParseNode &parser_tree) purge_database_stmt->set_tenant_id(session_info_->get_effective_tenant_id()); ObString db_name; ParseNode *dbname_node = parser_tree.children_[DATABASE_NODE]; - /** - * 在2.2.20版本上将命名长度比较逻辑由大于等于128字节时报错调整为大于128字节时报错后, 2.2.20以上版本 - * 数据库名长度可以为128字节。 升级过程中高版本server序列化session info到低版本server时, 如果数据 - * 库名长度为128字节会存在兼容性问题。 因此在升级过程中限制数据库名长度不超过127字节 - */ - int32_t max_database_name_length = GET_MIN_CLUSTER_VERSION() < CLUSTER_CURRENT_VERSION ? - OB_MAX_DATABASE_NAME_LENGTH - 1 : OB_MAX_DATABASE_NAME_LENGTH; + int32_t max_database_name_length = OB_MAX_DATABASE_NAME_LENGTH; if (OB_ISNULL(dbname_node) || OB_UNLIKELY(T_IDENT != dbname_node->type_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("invalid parse tree", K(ret)); @@ -228,13 +222,7 @@ int ObPurgeTenantResolver::resolve(const ParseNode &parser_tree) purge_tenant_stmt->set_tenant_id(session_info_->get_effective_tenant_id()); ObString tenant_name; ParseNode *tenant_node = parser_tree.children_[TENANT_NODE]; - /** - * 在2.2.20版本上将命名长度比较逻辑由大于等于128字节时报错调整为大于128字节时报错后, 2.2.20以上版本 - * 数据库名长度可以为128字节。 升级过程中高版本server序列化session info到低版本server时, 如果数据 - * 库名长度为128字节会存在兼容性问题。 因此在升级过程中限制数据库名长度不超过127字节 - */ - int32_t max_database_name_length = GET_MIN_CLUSTER_VERSION() < CLUSTER_CURRENT_VERSION ? - OB_MAX_DATABASE_NAME_LENGTH - 1 : OB_MAX_DATABASE_NAME_LENGTH; + int32_t max_database_name_length = OB_MAX_DATABASE_NAME_LENGTH; if (OB_ISNULL(tenant_node) || OB_UNLIKELY(T_IDENT != tenant_node->type_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("invalid parse tree", K(ret)); diff --git a/src/sql/resolver/ob_schema_checker.cpp b/src/sql/resolver/ob_schema_checker.cpp index 091d45839..b0132ae69 100644 --- a/src/sql/resolver/ob_schema_checker.cpp +++ b/src/sql/resolver/ob_schema_checker.cpp @@ -2693,39 +2693,6 @@ int ObSchemaChecker::check_access_to_obj( return ret; } -/* 为or repalce ddl定制,如果有replace选项,则需要增加一个drop的权限*/ -// int ObSchemaChecker::check_ora_ddl_priv( -// const uint64_t tenant_id, -// const uint64_t user_id, -// const common::ObString &database_name, -// const bool is_replace, -// const stmt::StmtType stmt_type, -// const stmt::StmtType stmt_type2) -// { -// int ret = OB_SUCCESS; -// if (IS_NOT_INIT) { -// ret = OB_NOT_INIT; -// LOG_WARN("schema checker is not inited", K(is_inited_), K(ret)); -// } else if (FALSE_IT(schema_mgr_ == NULL)) { -// } else { -// OZ (ObOraSysChecker::check_ora_ddl_priv(*schema_mgr_, -// tenant_id, -// user_id, -// database_name, -// stmt_type), -// K(tenant_id), K(user_id), K(database_name), K(stmt_type)); -// if (OB_SUCC(ret) && is_replace) { -// OZ (ObOraSysChecker::check_ora_ddl_priv(*schema_mgr_, -// tenant_id, -// user_id, -// database_name, -// stmt_type2), -// K(tenant_id), K(user_id), K(database_name), K(stmt_type2)); -// } -// } -// return ret; -// } - /* 对于一些ddl,系统权限可以,对象权限也可以。 例如:alter table create index diff --git a/src/storage/high_availability/ob_physical_copy_task.cpp b/src/storage/high_availability/ob_physical_copy_task.cpp index 5c00acf8e..335b23f5f 100644 --- a/src/storage/high_availability/ob_physical_copy_task.cpp +++ b/src/storage/high_availability/ob_physical_copy_task.cpp @@ -785,7 +785,7 @@ int ObPhysicalCopyFinishTask::get_cluster_version_( } } else { // TODO(yangyi.yyy): refine get cluster version later - cluster_version = static_cast(ObClusterVersion::get_instance().get_cluster_version()); + cluster_version = static_cast(GET_MIN_CLUSTER_VERSION()); } } return ret; diff --git a/src/storage/memtable/ob_memtable_compact_writer.cpp b/src/storage/memtable/ob_memtable_compact_writer.cpp index e68ab7106..7f9838938 100644 --- a/src/storage/memtable/ob_memtable_compact_writer.cpp +++ b/src/storage/memtable/ob_memtable_compact_writer.cpp @@ -39,7 +39,7 @@ int ObMemtableCompactWriter::init() } else { buffer_ = buf_; buf_size_ = SMALL_BUFFER_SIZE; - if (OB_FAIL(ObCellWriter::init(buffer_, buf_size_, SPARSE, GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_1470))) { + if (OB_FAIL(ObCellWriter::init(buffer_, buf_size_, SPARSE, false))) { TRANS_LOG(WARN, "ObCellWriter::init fail", "ret", ret); } } @@ -61,7 +61,7 @@ void ObMemtableCompactWriter::reset() } } ObCellWriter::reuse(); - ObCellWriter::reset_text_format(GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_1470); + ObCellWriter::reset_text_format(false); ObCellWriter::set_store_type(common::SPARSE); } diff --git a/src/storage/memtable/ob_memtable_context.cpp b/src/storage/memtable/ob_memtable_context.cpp index 60763e2be..90aedde15 100644 --- a/src/storage/memtable/ob_memtable_context.cpp +++ b/src/storage/memtable/ob_memtable_context.cpp @@ -567,7 +567,6 @@ int ObMemtableCtx::trans_replay_end(const bool commit, if (commit && 0 != checksum - && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_3100 && log_cluster_version >= CLUSTER_VERSION_3100 && !ObServerConfig::get_instance().ignore_replay_checksum_error) { const uint64_t checksum4 = calc_checksum_all(); diff --git a/src/storage/memtable/ob_memtable_mutator.cpp b/src/storage/memtable/ob_memtable_mutator.cpp index fb55657ca..c66d65118 100644 --- a/src/storage/memtable/ob_memtable_mutator.cpp +++ b/src/storage/memtable/ob_memtable_mutator.cpp @@ -850,8 +850,6 @@ int ObMutatorWriter::append_row_kv( is_with_head = false; } else if (OB_FAIL(redo.callback_->get_cluster_version(cluster_version))) { TRANS_LOG(WARN, "get cluster version faild.", K(ret)); - } else if (cluster_version < CLUSTER_VERSION_4_0_0_0) { - is_with_head = false; } if (OB_FAIL(ret)) { } else if (OB_ISNULL(mtk)) { diff --git a/src/storage/tx/ob_trans_ctx.h b/src/storage/tx/ob_trans_ctx.h index 4510c5072..218bf5bb6 100644 --- a/src/storage/tx/ob_trans_ctx.h +++ b/src/storage/tx/ob_trans_ctx.h @@ -184,14 +184,6 @@ protected: void print_trace_log_if_necessary_(); bool is_trans_expired_() const { return ObClockGenerator::getRealClock() >= trans_expired_time_; } bool is_slow_query_() const; - bool cluster_version_after_2200_() const { return cluster_version_ >= CLUSTER_VERSION_2200; } - bool cluster_version_after_2230_() const { return cluster_version_ >= CLUSTER_VERSION_2230; } - bool cluster_version_after_2250_() const { return cluster_version_ >= CLUSTER_VERSION_2250; } - bool cluster_version_before_2271_() const { return cluster_version_ < CLUSTER_VERSION_2271; } - bool cluster_version_before_3200_() const { return cluster_version_ < CLUSTER_VERSION_3200; } - bool cluster_version_after_3200_() const { return cluster_version_ >= CLUSTER_VERSION_3200; } - inline bool cluster_version_before_400_() const { return cluster_version_ < CLUSTER_VERSION_4_0_0_0; } - inline bool cluster_version_after_400_() const { return cluster_version_ >= CLUSTER_VERSION_4_0_0_0; } void set_stc_(const MonotonicTs stc); void set_stc_by_now_(); MonotonicTs get_stc_(); diff --git a/src/storage/tx/wrs/ob_weak_read_util.cpp b/src/storage/tx/wrs/ob_weak_read_util.cpp index 9354001c5..6d11c79a7 100644 --- a/src/storage/tx/wrs/ob_weak_read_util.cpp +++ b/src/storage/tx/wrs/ob_weak_read_util.cpp @@ -12,7 +12,6 @@ #include "ob_weak_read_util.h" #include "observer/omt/ob_tenant_config_mgr.h" // ObTenantConfigGuard -#include "share/ob_cluster_version.h" // GET_MIN_CLUSTER_VERSION #include #include #include diff --git a/unittest/storage/blocksstable/encoding/test_micro_block_encoder.cpp b/unittest/storage/blocksstable/encoding/test_micro_block_encoder.cpp index 0916eb4e6..c70efdf0a 100644 --- a/unittest/storage/blocksstable/encoding/test_micro_block_encoder.cpp +++ b/unittest/storage/blocksstable/encoding/test_micro_block_encoder.cpp @@ -136,35 +136,32 @@ public: TEST_F(TestEncoderOverFlow, test_append_row_with_timestamp_and_max_estimate_limit) { common::ObClusterVersion::get_instance().update_cluster_version(cal_version(2, 2, 0, 75)); - ASSERT_TRUE(IS_CLUSTER_VERSION_AFTER_2274); - if (IS_CLUSTER_VERSION_AFTER_2274) { - ObMicroBlockEncoder encoder; - ASSERT_EQ(OB_SUCCESS, encoder.init(ctx_)); + ObMicroBlockEncoder encoder; + ASSERT_EQ(OB_SUCCESS, encoder.init(ctx_)); - encoder.estimate_size_limit_ = ctx_.macro_block_size_; + encoder.estimate_size_limit_ = ctx_.macro_block_size_; - ObDatumRow row; - ASSERT_EQ(OB_SUCCESS, row.init(allocator_, column_cnt_)); - int ret = OB_SUCCESS; - int row_cnt = 0; - // calculated max size 4444 for this schema - while(row_cnt < 4443) { - ASSERT_EQ(OB_SUCCESS, row_generate_.get_next_row(row)); - ret = encoder.append_row(row); - row_cnt++; - } + ObDatumRow row; + ASSERT_EQ(OB_SUCCESS, row.init(allocator_, column_cnt_)); + int ret = OB_SUCCESS; + int row_cnt = 0; + // calculated max size 4444 for this schema + while(row_cnt < 4443) { ASSERT_EQ(OB_SUCCESS, row_generate_.get_next_row(row)); - row.storage_datums_[2].len_ = 105000; - encoder.append_row(row); - - LOG_INFO("Data buffer size", K(encoder.data_buffer_), - K(row_cnt), K(encoder.estimate_size_limit_), K(encoder.estimate_size_), - K(encoder.length_)); - - char *buf = NULL; - int64_t size = 0; - ASSERT_EQ(OB_SUCCESS, encoder.build_block(buf, size)); + ret = encoder.append_row(row); + row_cnt++; } + ASSERT_EQ(OB_SUCCESS, row_generate_.get_next_row(row)); + row.storage_datums_[2].len_ = 105000; + encoder.append_row(row); + + LOG_INFO("Data buffer size", K(encoder.data_buffer_), + K(row_cnt), K(encoder.estimate_size_limit_), K(encoder.estimate_size_), + K(encoder.length_)); + + char *buf = NULL; + int64_t size = 0; + ASSERT_EQ(OB_SUCCESS, encoder.build_block(buf, size)); } static ObObjType test_dict_large_varchar[2] = {ObIntType, ObVarcharType};