alter primary_zone length
This commit is contained in:
parent
89ec337ad6
commit
b0ecd6650d
1
deps/oblib/src/common/ob_zone.h
vendored
1
deps/oblib/src/common/ob_zone.h
vendored
@ -20,6 +20,7 @@ namespace oceanbase
|
||||
namespace common
|
||||
{
|
||||
typedef ObFixedLengthString<MAX_ZONE_LENGTH> ObZone;
|
||||
typedef ObFixedLengthString<MAX_ZONE_LIST_LENGTH> ObPriZone;
|
||||
}//end namespace common
|
||||
}//end namespace oceanbase
|
||||
#endif //OCEANBASE_COMMON_OB_ZONE_H_
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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'),
|
||||
|
@ -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;
|
||||
|
@ -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<share::schema::ObZoneRegion> zone_region_list;
|
||||
common::ObSEArray<common::ObZone, DEFAULT_ZONE_COUNT> 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<share::schema::ObZoneScore, DEFAULT_ZONE_COUNT> zone_score_array;
|
||||
ObZone primary_zone_str;
|
||||
SMART_VAR(ObPriZone, primary_zone_str) {
|
||||
ObArenaAllocator allocator("PrimaryZone");
|
||||
ObPrimaryZone primary_zone_schema(allocator);
|
||||
ObArray<share::ObZoneReplicaAttrSet> 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<common::ObZone> &zone_list,
|
||||
const common::ObIArray<share::ObZoneReplicaAttrSet> &zone_locality,
|
||||
common::ObIArray<share::schema::ObZoneScore> &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<share::schema::ObZoneScore> &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<int32_t>(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<common::ObZone> &zone_list,
|
||||
const common::ObIArray<share::ObZoneReplicaAttrSet> &zone_locality,
|
||||
common::ObIArray<share::schema::ObZoneScore> &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<common::ObZone> &zone_list,
|
||||
const common::ObIArray<share::ObZoneReplicaNumSet> &zone_locality,
|
||||
common::ObIArray<share::schema::ObZoneScore> &zone_score_list,
|
||||
common::ObZone &primary_zone_str)
|
||||
common::ObPriZone &primary_zone_str)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
primary_zone_str.reset();
|
||||
|
@ -208,7 +208,7 @@ private:
|
||||
// normalized_zone_array_ has a extra region info while full_zone_array_ has not
|
||||
common::ObArray<share::schema::ObZoneScore> 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<common::ObZone> &zone_list,
|
||||
const common::ObIArray<share::ObZoneReplicaNumSet> &zone_locality,
|
||||
common::ObIArray<share::schema::ObZoneScore> &zone_score_list,
|
||||
common::ObZone &primary_zone_str);
|
||||
common::ObPriZone &primary_zone_str);
|
||||
static int convert_random_primary_zone_into_integrated(
|
||||
const common::ObIArray<common::ObZone> &zone_list,
|
||||
const common::ObIArray<share::ObZoneReplicaNumSet> &zone_locality,
|
||||
common::ObIArray<share::schema::ObZoneScore> &zone_score_list,
|
||||
common::ObZone &primary_zone_str);
|
||||
common::ObPriZone &primary_zone_str);
|
||||
static int convert_normal_primary_zone_into_integrated(
|
||||
const common::ObIArray<share::schema::ObZoneScore> &primary_zone_array,
|
||||
const common::ObIArray<common::ObZone> &zone_list,
|
||||
const common::ObIArray<share::ObZoneReplicaNumSet> &zone_locality,
|
||||
common::ObIArray<share::schema::ObZoneScore> &zone_score_list,
|
||||
common::ObZone &primary_zone_str);
|
||||
common::ObPriZone &primary_zone_str);
|
||||
static int do_generate_integrated_primary_zone_str(
|
||||
const common::ObIArray<share::schema::ObZoneScore> &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
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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_);
|
||||
|
Loading…
x
Reference in New Issue
Block a user