diff --git a/deps/oblib/src/common/ob_zone.h b/deps/oblib/src/common/ob_zone.h index 005ed8ab9..38a67fa05 100644 --- a/deps/oblib/src/common/ob_zone.h +++ b/deps/oblib/src/common/ob_zone.h @@ -20,6 +20,7 @@ namespace oceanbase namespace common { typedef ObFixedLengthString ObZone; +typedef ObFixedLengthString ObPriZone; }//end namespace common }//end namespace oceanbase #endif //OCEANBASE_COMMON_OB_ZONE_H_ diff --git a/src/rootserver/ob_ddl_service.cpp b/src/rootserver/ob_ddl_service.cpp index e21e7404e..3c7730481 100755 --- a/src/rootserver/ob_ddl_service.cpp +++ b/src/rootserver/ob_ddl_service.cpp @@ -38703,10 +38703,10 @@ int ObDDLService::check_and_set_primary_zone( } else if (OB_FAIL(construct_zone_region_list(zone_region_list, zone_list))) { LOG_WARN("fail to construct zone region list", K(ret)); } else { - char primary_zone_str[MAX_ZONE_LENGTH]; + SMART_VARS_2((char[MAX_ZONE_LIST_LENGTH], primary_zone_str), + (ObPrimaryZoneUtil, primary_zone_util, + schema.get_primary_zone(), &zone_region_list)) { int64_t pos = 0; - ObPrimaryZoneUtil primary_zone_util(schema.get_primary_zone(), - &zone_region_list); if (OB_FAIL(primary_zone_util.init(zone_list))) { LOG_WARN("fail to init primary zone util", K(ret)); } else if (OB_FAIL(primary_zone_util.check_and_parse_primary_zone())) { @@ -38714,7 +38714,7 @@ int ObDDLService::check_and_set_primary_zone( LOG_WARN("invalid primary zone", K(ret)); LOG_USER_ERROR(OB_INVALID_ARGUMENT, "primary zone"); } else if (OB_FAIL(primary_zone_util.output_normalized_primary_zone( - primary_zone_str, MAX_ZONE_LENGTH, pos))) { + primary_zone_str, MAX_ZONE_LIST_LENGTH, pos))) { LOG_WARN("fail to output normalized primary zone", K(ret)); } else if (OB_FAIL(schema.set_primary_zone(primary_zone_str))) { LOG_WARN("fail to set primary zone", K(ret)); @@ -38724,6 +38724,7 @@ int ObDDLService::check_and_set_primary_zone( schema, zone_list, zone_region_list, schema_guard))) { LOG_WARN("fail to check primary zone region condition", K(ret)); } else {} // no more to do + } // end smart var } return ret; } @@ -38883,15 +38884,16 @@ int ObDDLService::trim_and_set_primary_zone( } else {} // no more to do } else { lib::ob_sort(new_zone_score_array.begin(), new_zone_score_array.end()); - char primary_zone_str[MAX_ZONE_LENGTH]; + SMART_VAR(char[MAX_ZONE_LIST_LENGTH], primary_zone_str) { if (OB_FAIL(format_primary_zone_from_zone_score_array( - new_zone_score_array, primary_zone_str, MAX_ZONE_LENGTH))) { + new_zone_score_array, primary_zone_str, MAX_ZONE_LIST_LENGTH))) { LOG_WARN("fail to construct primary zone from zone score array", K(ret)); } else if (OB_FAIL(new_schema.set_primary_zone(ObString::make_string(primary_zone_str)))) { LOG_WARN("fail to set primary zone", K(ret)); } else if (OB_FAIL(check_and_set_primary_zone(new_schema, zone_list, schema_guard))) { LOG_WARN("fail to check and set primary zone", K(ret)); } else {} // no more to do + } // end smart var } return ret; } diff --git a/src/rootserver/ob_tenant_thread_helper.h b/src/rootserver/ob_tenant_thread_helper.h index f05f0be46..9b5b67821 100644 --- a/src/rootserver/ob_tenant_thread_helper.h +++ b/src/rootserver/ob_tenant_thread_helper.h @@ -102,8 +102,8 @@ public: static int get_tenant_schema(const uint64_t tenant_id, share::schema::ObTenantSchema &tenant_schema); static int get_zone_priority(const ObZone &primary_zone, - const share::schema::ObTenantSchema &tenant_schema, - common::ObSqlString &primary_zone_str); + const share::schema::ObTenantSchema &tenant_schema, + common::ObSqlString &primary_zone_str); protected: int wait_tenant_schema_and_version_ready_( const uint64_t tenant_id, const uint64_t &data_version); diff --git a/src/share/inner_table/ob_inner_table_schema.101_150.cpp b/src/share/inner_table/ob_inner_table_schema.101_150.cpp index dd8cad6d1..64b2d338a 100644 --- a/src/share/inner_table/ob_inner_table_schema.101_150.cpp +++ b/src/share/inner_table/ob_inner_table_schema.101_150.cpp @@ -3203,7 +3203,7 @@ int ObInnerTableSchema::all_tenant_schema(ObTableSchema &table_schema) 0, //part_key_pos ObVarcharType, //column_type CS_TYPE_INVALID, //column_collation_type - MAX_ZONE_LENGTH, //column_length + MAX_ZONE_LIST_LENGTH, //column_length -1, //column_precision -1, //column_scale true, //is_nullable @@ -3583,7 +3583,7 @@ int ObInnerTableSchema::all_tenant_history_schema(ObTableSchema &table_schema) 0, //part_key_pos ObVarcharType, //column_type CS_TYPE_INVALID, //column_collation_type - MAX_ZONE_LENGTH, //column_length + MAX_ZONE_LIST_LENGTH, //column_length -1, //column_precision -1, //column_scale true, //is_nullable diff --git a/src/share/inner_table/ob_inner_table_schema.12351_12400.cpp b/src/share/inner_table/ob_inner_table_schema.12351_12400.cpp index e7bf88199..17f6bfd0a 100644 --- a/src/share/inner_table/ob_inner_table_schema.12351_12400.cpp +++ b/src/share/inner_table/ob_inner_table_schema.12351_12400.cpp @@ -1404,7 +1404,7 @@ int ObInnerTableSchema::all_virtual_tenant_mysql_sys_agent_schema(ObTableSchema 0, //part_key_pos ObVarcharType, //column_type CS_TYPE_INVALID, //column_collation_type - MAX_ZONE_LENGTH, //column_length + MAX_ZONE_LIST_LENGTH, //column_length -1, //column_precision -1, //column_scale true, //is_nullable diff --git a/src/share/inner_table/ob_inner_table_schema.15251_15300.cpp b/src/share/inner_table/ob_inner_table_schema.15251_15300.cpp index a32c84c1e..ee4ab105e 100644 --- a/src/share/inner_table/ob_inner_table_schema.15251_15300.cpp +++ b/src/share/inner_table/ob_inner_table_schema.15251_15300.cpp @@ -7562,7 +7562,7 @@ int ObInnerTableSchema::all_virtual_tenant_sys_agent_schema(ObTableSchema &table 0, //part_key_pos ObVarcharType, //column_type CS_TYPE_UTF8MB4_BIN, //column_collation_type - MAX_ZONE_LENGTH, //column_length + MAX_ZONE_LIST_LENGTH, //column_length 2, //column_precision -1, //column_scale true, //is_nullable diff --git a/src/share/inner_table/ob_inner_table_schema_def.py b/src/share/inner_table/ob_inner_table_schema_def.py index 35c703fb6..db3bde611 100755 --- a/src/share/inner_table/ob_inner_table_schema_def.py +++ b/src/share/inner_table/ob_inner_table_schema_def.py @@ -543,7 +543,7 @@ all_tenant_def = dict( normal_columns = [ ('tenant_name', 'varchar:OB_MAX_TENANT_NAME_LENGTH_STORE'), ('zone_list', 'varchar:MAX_ZONE_LIST_LENGTH'), - ('primary_zone', 'varchar:MAX_ZONE_LENGTH', 'true'), + ('primary_zone', 'varchar:MAX_ZONE_LIST_LENGTH', 'true'), ('locked', 'int'), ('collation_type', 'int'), ('info', 'varchar:OB_MAX_TENANT_INFO_LENGTH'), diff --git a/src/share/ob_locality_priority.cpp b/src/share/ob_locality_priority.cpp index 0b12f5b16..959111484 100644 --- a/src/share/ob_locality_priority.cpp +++ b/src/share/ob_locality_priority.cpp @@ -33,9 +33,8 @@ int ObLocalityPriority::get_primary_region_prioriry(const char *primary_zone, char *str1, *str2; char *saveptr1, *saveptr2; char *token, *subtoken; - char tmp_primary_zone[MAX_ZONE_LENGTH]; - - size_t size = strlen(primary_zone) > (MAX_ZONE_LENGTH - 1) ? (MAX_ZONE_LENGTH - 1): strlen(primary_zone); + SMART_VAR(char[MAX_ZONE_LIST_LENGTH], tmp_primary_zone) { + size_t size = strlen(primary_zone) > (MAX_ZONE_LIST_LENGTH - 1) ? (MAX_ZONE_LIST_LENGTH - 1): strlen(primary_zone); memcpy(tmp_primary_zone, primary_zone, size); tmp_primary_zone[size] = '\0'; str1 = tmp_primary_zone; @@ -104,6 +103,7 @@ int ObLocalityPriority::get_primary_region_prioriry(const char *primary_zone, } //for } } // for + } // end smar var } return ret; diff --git a/src/share/ob_primary_zone_util.cpp b/src/share/ob_primary_zone_util.cpp index c069a6040..74e8289f7 100644 --- a/src/share/ob_primary_zone_util.cpp +++ b/src/share/ob_primary_zone_util.cpp @@ -46,9 +46,9 @@ int ObPrimaryZoneUtil::init( "zone list count", zone_list.count(), KP(zone_region_list_)); } else { int64_t len = strlen(primary_zone_.ptr()); - if (common::MAX_ZONE_LENGTH < len) { + if (common::MAX_ZONE_LIST_LENGTH < len) { ret = OB_ERR_UNEXPECTED; - LOG_WARN("primary_zone length overflowed", KR(ret), K(len), "max_zone_length", MAX_ZONE_LENGTH); + LOG_WARN("primary_zone length overflowed", KR(ret), K(len), "max_zone_list_length", MAX_ZONE_LIST_LENGTH); } else { MEMCPY(primary_zone_str_, primary_zone_.ptr(), len); primary_zone_str_[len] = '\0'; @@ -85,9 +85,9 @@ int ObPrimaryZoneUtil::init( "zone list count", zone_list.count(), KP(zone_region_list_)); } else { int64_t len = strlen(primary_zone_.ptr()); - if (common::MAX_ZONE_LENGTH < len) { + if (common::MAX_ZONE_LIST_LENGTH < len) { ret = OB_ERR_UNEXPECTED; - LOG_WARN("primary_zone length overflowed", KR(ret), K(len), "max_zone_length", MAX_ZONE_LENGTH); + LOG_WARN("primary_zone length overflowed", KR(ret), K(len), "max_zone_list_length", MAX_ZONE_LIST_LENGTH); } else { MEMCPY(primary_zone_str_, primary_zone_.ptr(), len); primary_zone_str_[len] = '\0'; @@ -117,9 +117,9 @@ int ObPrimaryZoneUtil::init() LOG_WARN("invalid argument", K(ret), K(primary_zone_), KP(zone_region_list_)); } else { int64_t len = strlen(primary_zone_.ptr()); - if (common::MAX_ZONE_LENGTH < len) { + if (common::MAX_ZONE_LIST_LENGTH < len) { ret = OB_ERR_UNEXPECTED; - LOG_WARN("primary_zone length overflowed", KR(ret), K(len), "max_zone_length", MAX_ZONE_LENGTH); + LOG_WARN("primary_zone length overflowed", KR(ret), K(len), "max_zone_list_length", MAX_ZONE_LIST_LENGTH); } else { MEMCPY(primary_zone_str_, primary_zone_.ptr(), len); primary_zone_str_[len] = '\0'; @@ -640,7 +640,7 @@ int ObPrimaryZoneUtil::get_tenant_primary_zone_score( share::schema::ObSchemaGetterGuard guard; ObArray zone_region_list; common::ObSEArray zone_list; - ObZone primary_zone_str; + SMART_VAR(ObPriZone, primary_zone_str) { if (OB_UNLIKELY(!tenant_schema.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("tenant schema is invalid", KR(ret), K(tenant_schema)); @@ -661,6 +661,7 @@ int ObPrimaryZoneUtil::get_tenant_primary_zone_score( primary_zone_str))) { LOG_WARN("fail to generate integrated primary zone str", K(ret)); } + } // end smart var return ret; } @@ -723,7 +724,7 @@ int ObPrimaryZoneUtil::get_tenant_zone_priority( { int ret = OB_SUCCESS; common::ObSEArray zone_score_array; - ObZone primary_zone_str; + SMART_VAR(ObPriZone, primary_zone_str) { ObArenaAllocator allocator("PrimaryZone"); ObPrimaryZone primary_zone_schema(allocator); ObArray zone_locality; @@ -738,6 +739,7 @@ int ObPrimaryZoneUtil::get_tenant_zone_priority( } else if (OB_FAIL(zone_priority.assign(primary_zone_str.str()))) { LOG_WARN("failed to assign zone priority", KR(ret), K(primary_zone_str)); } + } // end smart var return ret; } @@ -746,7 +748,7 @@ int ObPrimaryZoneUtil::convert_random_primary_zone_into_integrated( const common::ObIArray &zone_list, const common::ObIArray &zone_locality, common::ObIArray &zone_score_list, - common::ObZone &primary_zone_str) + common::ObPriZone &primary_zone_str) { int ret = OB_SUCCESS; primary_zone_str.reset(); @@ -776,11 +778,11 @@ int ObPrimaryZoneUtil::convert_random_primary_zone_into_integrated( int ObPrimaryZoneUtil::do_generate_integrated_primary_zone_str( const common::ObIArray &zone_score_array, - common::ObZone &primary_zone_str) + common::ObPriZone &primary_zone_str) { int ret = OB_SUCCESS; - char zone_str[MAX_ZONE_LENGTH]; - MEMSET(zone_str, 0, MAX_ZONE_LENGTH); + SMART_VAR(char[MAX_ZONE_LIST_LENGTH], zone_str) { + MEMSET(zone_str, 0, MAX_ZONE_LIST_LENGTH); if (zone_score_array.count() <= 0) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", K(ret), "array num", zone_score_array.count()); @@ -793,10 +795,10 @@ int ObPrimaryZoneUtil::do_generate_integrated_primary_zone_str( const ObZoneScore &cur_zone_score = zone_score_array.at(i); const bool same_p = (cur_zone_score.score_ == prev_zone_score); separator_token = (same_p ? "," : ";"); - if (OB_FAIL(databuff_printf(zone_str, MAX_ZONE_LENGTH, pos, + if (OB_FAIL(databuff_printf(zone_str, MAX_ZONE_LIST_LENGTH, pos, "%s", (!start_format ? "" : separator_token)))) { LOG_WARN("fail to format separator", K(ret)); - } else if (OB_FAIL(databuff_printf(zone_str, MAX_ZONE_LENGTH, pos, "%.*s", + } else if (OB_FAIL(databuff_printf(zone_str, MAX_ZONE_LIST_LENGTH, pos, "%.*s", static_cast(cur_zone_score.zone_.length()), cur_zone_score.zone_.ptr()))) { LOG_WARN("fail to format zone", K(ret)); @@ -811,6 +813,7 @@ int ObPrimaryZoneUtil::do_generate_integrated_primary_zone_str( } } } + } // end smart var return ret; } @@ -819,7 +822,7 @@ int ObPrimaryZoneUtil::convert_normal_primary_zone_into_integrated( const common::ObIArray &zone_list, const common::ObIArray &zone_locality, common::ObIArray &zone_score_list, - common::ObZone &primary_zone_str) + common::ObPriZone &primary_zone_str) { int ret = OB_SUCCESS; primary_zone_str.reset(); @@ -860,7 +863,7 @@ int ObPrimaryZoneUtil::generate_integrated_primary_zone_str( const common::ObIArray &zone_list, const common::ObIArray &zone_locality, common::ObIArray &zone_score_list, - common::ObZone &primary_zone_str) + common::ObPriZone &primary_zone_str) { int ret = OB_SUCCESS; primary_zone_str.reset(); diff --git a/src/share/ob_primary_zone_util.h b/src/share/ob_primary_zone_util.h index fed39c554..63330c47c 100644 --- a/src/share/ob_primary_zone_util.h +++ b/src/share/ob_primary_zone_util.h @@ -208,7 +208,7 @@ private: // normalized_zone_array_ has a extra region info while full_zone_array_ has not common::ObArray full_zone_array_; // the strings in zone_array_ are pointing into primary_zone_str_ - char primary_zone_str_[common::MAX_ZONE_LENGTH + 1]; + char primary_zone_str_[common::MAX_ZONE_LIST_LENGTH + 1]; int64_t zone_score_; // this is used to record zone priority during check and parse common::ObArenaAllocator allocator_; bool check_and_parse_finished_; @@ -258,21 +258,21 @@ private: const common::ObIArray &zone_list, const common::ObIArray &zone_locality, common::ObIArray &zone_score_list, - common::ObZone &primary_zone_str); + common::ObPriZone &primary_zone_str); static int convert_random_primary_zone_into_integrated( const common::ObIArray &zone_list, const common::ObIArray &zone_locality, common::ObIArray &zone_score_list, - common::ObZone &primary_zone_str); + common::ObPriZone &primary_zone_str); static int convert_normal_primary_zone_into_integrated( const common::ObIArray &primary_zone_array, const common::ObIArray &zone_list, const common::ObIArray &zone_locality, common::ObIArray &zone_score_list, - common::ObZone &primary_zone_str); + common::ObPriZone &primary_zone_str); static int do_generate_integrated_primary_zone_str( const common::ObIArray &zone_score_list, - common::ObZone &primary_zone_str); + common::ObPriZone &primary_zone_str); }; /* ObPrimaryZoneUtil is a full utility parser of primary zone, One can refer to the comments diff --git a/src/share/ob_zone_merge_table_operator.cpp b/src/share/ob_zone_merge_table_operator.cpp index eec5e0fbe..c8293fb32 100644 --- a/src/share/ob_zone_merge_table_operator.cpp +++ b/src/share/ob_zone_merge_table_operator.cpp @@ -411,7 +411,7 @@ int ObZoneMergeTableOperator::construct_zone_merge_info_( bool exist = false; int64_t tmp_real_str_len = 0; // only used for output parameter int64_t tenant_id = 0; - char zone_buf[OB_MAX_TZ_NAME_LEN] = ""; + char zone_buf[MAX_ZONE_LENGTH] = ""; ObZoneMergeInfo tmp_merge_info; uint64_t all_merged_scn = 0; uint64_t broadcast_scn = 0; diff --git a/src/share/restore/ob_restore_uri_parser.cpp b/src/share/restore/ob_restore_uri_parser.cpp index 5b6f8e5c2..c2da6f605 100644 --- a/src/share/restore/ob_restore_uri_parser.cpp +++ b/src/share/restore/ob_restore_uri_parser.cpp @@ -155,7 +155,7 @@ int ObPhysicalRestoreOptionParser::ExtraArgsCb::set_primary_zone( int ret = OB_SUCCESS; if (OB_ISNULL(val)) { ret = OB_INVALID_ARGUMENT; - } else if (STRLEN(val) >= common::MAX_ZONE_LENGTH) { + } else if (STRLEN(val) >= common::MAX_ZONE_LIST_LENGTH) { ret = OB_SIZE_OVERFLOW; } else if (OB_FAIL(job.set_primary_zone(ObString(val)))) { LOG_WARN("failed to set primary zone", KR(ret), K(val)); diff --git a/src/share/schema/ob_schema_retrieve_utils.ipp b/src/share/schema/ob_schema_retrieve_utils.ipp index 23a1a3f62..7749c9d51 100644 --- a/src/share/schema/ob_schema_retrieve_utils.ipp +++ b/src/share/schema/ob_schema_retrieve_utils.ipp @@ -4756,7 +4756,7 @@ int ObSchemaRetrieveUtils::fill_replica_options(T &result, SCHEMA &schema) } else if (OB_FAIL(schema.set_primary_zone(primary_zone_str))) { SHARE_SCHEMA_LOG(WARN, "set_primary_zone failed", K(ret)); } else if (!ObPrimaryZoneUtil::no_need_to_check_primary_zone(schema.get_primary_zone())) { - ObPrimaryZoneUtil primary_zone_util(schema.get_primary_zone()); + SMART_VAR(ObPrimaryZoneUtil, primary_zone_util, schema.get_primary_zone()) { if (OB_FAIL(primary_zone_util.init())) { SHARE_SCHEMA_LOG(WARN, "fail to init primary zone util", K(ret)); } else if (OB_FAIL(primary_zone_util.check_and_parse_primary_zone())) { @@ -4764,6 +4764,7 @@ int ObSchemaRetrieveUtils::fill_replica_options(T &result, SCHEMA &schema) } else if (OB_FAIL(schema.set_primary_zone_array(primary_zone_util.get_zone_array()))) { SHARE_SCHEMA_LOG(WARN, "fail to set primary zone array", K(ret)); } else {} // set primary zone array success + } // end smart var } else {} // empty primary zone, no need to check and parse } return ret; diff --git a/src/share/schema/ob_schema_struct.cpp b/src/share/schema/ob_schema_struct.cpp index 9172559d8..e4fa1fff6 100644 --- a/src/share/schema/ob_schema_struct.cpp +++ b/src/share/schema/ob_schema_struct.cpp @@ -2187,7 +2187,7 @@ OB_DEF_DESERIALIZE(ObTenantSchema) // parse and set primary zone array if (OB_FAIL(ret)) { } else if (primary_zone_.length() > 0 && zone_list_.count() > 0) { - ObPrimaryZoneUtil primary_zone_util(primary_zone_); + SMART_VAR(ObPrimaryZoneUtil, primary_zone_util, primary_zone_) { if (OB_FAIL(primary_zone_util.init())) { SHARE_SCHEMA_LOG(WARN, "fail to init primary zone util", K(ret)); } else if (OB_FAIL(primary_zone_util.check_and_parse_primary_zone())) { @@ -2195,6 +2195,7 @@ OB_DEF_DESERIALIZE(ObTenantSchema) } else if (OB_FAIL(set_primary_zone_array(primary_zone_util.get_zone_array()))) { SHARE_SCHEMA_LOG(WARN, "fail to set primary zone array", K(ret)); } else {} // set primary zone array success + } // end smart var } else {} // no need to parse primary zone } return ret; diff --git a/tools/deploy/init_create_tenant_routines.sql b/tools/deploy/init_create_tenant_routines.sql index 24b3f3fa7..200ff4e7c 100644 --- a/tools/deploy/init_create_tenant_routines.sql +++ b/tools/deploy/init_create_tenant_routines.sql @@ -51,7 +51,7 @@ drop procedure if exists create_tenant_with_arg;/ create procedure create_tenant_with_arg(tenant_name varchar(64), compat_mode varchar(10), unit_config varchar(64), arg_list varchar(64)) begin declare num int; - declare zone_name varchar(20); + declare zone_name varchar(128); select count(*) from oceanbase.DBA_OB_SERVERS group by zone limit 1 into num; select zone from (select zone, count(*) as a from oceanbase.DBA_OB_ZONES group by region order by a desc limit 1) into zone_name; diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_mysql.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_mysql.result index dbb4bfe70..0449ac63f 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_mysql.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_mysql.result @@ -2066,7 +2066,7 @@ TENANT_NAME varchar(128) NO NULL TENANT_TYPE varchar(4) NO CREATE_TIME timestamp(6) YES MODIFY_TIME timestamp(6) YES -PRIMARY_ZONE varchar(128) YES NULL +PRIMARY_ZONE varchar(8192) YES NULL LOCALITY varchar(4096) NO PREVIOUS_LOCALITY varchar(4096) NO COMPATIBILITY_MODE varchar(6) NO diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_sys.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_sys.result index 5063d7028..0b3e347b1 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_sys.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_sys.result @@ -2325,7 +2325,7 @@ TENANT_NAME varchar(128) NO NULL TENANT_TYPE varchar(4) NO CREATE_TIME timestamp(6) YES MODIFY_TIME timestamp(6) YES -PRIMARY_ZONE varchar(128) YES NULL +PRIMARY_ZONE varchar(8192) YES NULL LOCALITY varchar(4096) NO PREVIOUS_LOCALITY varchar(4096) NO COMPATIBILITY_MODE varchar(6) NO diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result index e3560f124..e67df43a8 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result @@ -3571,7 +3571,7 @@ gmt_modified timestamp(6) YES CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP( tenant_id bigint(20) NO PRI NULL tenant_name varchar(128) NO NULL zone_list varchar(8192) NO NULL -primary_zone varchar(128) YES NULL +primary_zone varchar(8192) YES NULL locked bigint(20) NO NULL collation_type bigint(20) NO NULL info varchar(4096) NO NULL diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result index be4254c1f..45d3e783c 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result @@ -7786,7 +7786,7 @@ gmt_modified timestamp(6) YES CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP( tenant_id bigint(20) NO PRI NULL tenant_name varchar(128) NO NULL zone_list varchar(8192) NO NULL -primary_zone varchar(128) YES NULL +primary_zone varchar(8192) YES NULL locked bigint(20) NO NULL collation_type bigint(20) NO NULL info varchar(4096) NO NULL diff --git a/tools/deploy/mysql_test/test_suite/view/r/mysql/dba_ob_tenants.result b/tools/deploy/mysql_test/test_suite/view/r/mysql/dba_ob_tenants.result index 52640c0be..c304025bd 100644 --- a/tools/deploy/mysql_test/test_suite/view/r/mysql/dba_ob_tenants.result +++ b/tools/deploy/mysql_test/test_suite/view/r/mysql/dba_ob_tenants.result @@ -5,7 +5,7 @@ TENANT_NAME varchar(128) NO NULL TENANT_TYPE varchar(4) NO CREATE_TIME timestamp(6) YES MODIFY_TIME timestamp(6) YES -PRIMARY_ZONE varchar(128) YES NULL +PRIMARY_ZONE varchar(8192) YES NULL LOCALITY varchar(4096) NO PREVIOUS_LOCALITY varchar(4096) NO COMPATIBILITY_MODE varchar(6) NO @@ -57,7 +57,7 @@ TENANT_NAME varchar(128) NO NULL TENANT_TYPE varchar(4) NO CREATE_TIME timestamp(6) YES MODIFY_TIME timestamp(6) YES -PRIMARY_ZONE varchar(128) YES NULL +PRIMARY_ZONE varchar(8192) YES NULL LOCALITY varchar(4096) NO PREVIOUS_LOCALITY varchar(4096) NO COMPATIBILITY_MODE varchar(6) NO diff --git a/unittest/share/test_primary_zone_util.cpp b/unittest/share/test_primary_zone_util.cpp index f6a8c64d3..da68abaf7 100644 --- a/unittest/share/test_primary_zone_util.cpp +++ b/unittest/share/test_primary_zone_util.cpp @@ -41,9 +41,9 @@ TEST_F(TestPrimaryZoneUtil, single_zone) ObPrimaryZoneUtil primary_zone_util(primary_zone); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init()); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(primary_zone == pz_str); ASSERT_EQ(1, primary_zone_util.full_zone_array_.count()); ASSERT_TRUE(ObString("zone1") == primary_zone_util.full_zone_array_.at(0).zone_); @@ -57,9 +57,9 @@ TEST_F(TestPrimaryZoneUtil, single_zone1) ObPrimaryZoneUtil primary_zone_util(primary_zone); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init()); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1") == pz_str); ASSERT_EQ(1, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -78,9 +78,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone0) ObPrimaryZoneUtil primary_zone_util(primary_zone); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init()); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1,zone2,zone3") == pz_str); ASSERT_EQ(3, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -105,9 +105,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone1) ObPrimaryZoneUtil primary_zone_util(primary_zone); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init()); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1,zone2,zone3") == pz_str); ASSERT_EQ(3, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -132,9 +132,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone2) ObPrimaryZoneUtil primary_zone_util(primary_zone); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init()); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1;zone2;zone3") == pz_str); ASSERT_EQ(3, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -159,9 +159,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone3) ObPrimaryZoneUtil primary_zone_util(primary_zone); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init()); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1;zone2;zone3") == pz_str); ASSERT_EQ(3, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -186,9 +186,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone4) ObPrimaryZoneUtil primary_zone_util(primary_zone); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init()); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1,zone2;zone3") == pz_str); ASSERT_EQ(3, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -213,9 +213,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone5) ObPrimaryZoneUtil primary_zone_util(primary_zone); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init()); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1;zone2,zone3") == pz_str); ASSERT_EQ(3, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -250,9 +250,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone6) ObPrimaryZoneUtil primary_zone_util(primary_zone, &zone_region_list); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init(zone_list)); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1;zone2;zone3;zone4") == pz_str); ASSERT_EQ(3, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -288,9 +288,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone7) ObPrimaryZoneUtil primary_zone_util(primary_zone, &zone_region_list); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init(zone_list)); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1;zone2;zone3;zone4") == pz_str); ASSERT_EQ(2, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -324,9 +324,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone8) ObPrimaryZoneUtil primary_zone_util(primary_zone, &zone_region_list); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init(zone_list)); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1,zone3;zone2,zone4") == pz_str); ASSERT_EQ(2, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -360,9 +360,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone9) ObPrimaryZoneUtil primary_zone_util(primary_zone, &zone_region_list); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init(zone_list)); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1;zone2;zone3;zone4;zone5") == pz_str); ASSERT_EQ(3, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -399,9 +399,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone10) ObPrimaryZoneUtil primary_zone_util(primary_zone, &zone_region_list); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init(zone_list)); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1;zone2;zone3,zone4") == pz_str); ASSERT_EQ(3, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_); @@ -437,9 +437,9 @@ TEST_F(TestPrimaryZoneUtil, multiple_zone11) ObPrimaryZoneUtil primary_zone_util(primary_zone, &zone_region_list); ASSERT_EQ(OB_SUCCESS, primary_zone_util.init(zone_list)); ASSERT_EQ(OB_SUCCESS, primary_zone_util.check_and_parse_primary_zone()); - char pz_str[MAX_ZONE_LENGTH]; + char pz_str[MAX_ZONE_LIST_LENGTH]; int64_t pos = 0; - ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LENGTH, pos)); + ASSERT_EQ(OB_SUCCESS, primary_zone_util.output_normalized_primary_zone(pz_str, MAX_ZONE_LIST_LENGTH, pos)); ASSERT_TRUE(ObZone("zone1,zone2;zone4;zone3") == pz_str); ASSERT_EQ(3, primary_zone_util.zone_array_.count()); ASSERT_EQ(0, primary_zone_util.zone_array_.at(0).score_);