support specifying the tenant id in the -o option
This commit is contained in:
@ -352,7 +352,7 @@ int ObTenantConfig::add_extra_config(const char *config_str,
|
||||
const ObString compatible_cfg(COMPATIBLE);
|
||||
while (OB_SUCC(ret) && OB_LIKELY(NULL != token)) {
|
||||
char *saveptr_one = NULL;
|
||||
const char *name = NULL;
|
||||
char *name = NULL;
|
||||
const char *value = NULL;
|
||||
ObConfigItem *const *pp_item = NULL;
|
||||
if (OB_ISNULL(name = STRTOK_R(token, "=", &saveptr_one))) {
|
||||
@ -361,9 +361,22 @@ int ObTenantConfig::add_extra_config(const char *config_str,
|
||||
} else if (OB_ISNULL(saveptr_one) || OB_UNLIKELY('\0' == *(value = saveptr_one))) {
|
||||
LOG_INFO("Empty config string", K(token), K(name));
|
||||
// ret = OB_INVALID_CONFIG;
|
||||
name = "";
|
||||
name = NULL;
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_ISNULL(name)) {
|
||||
// do nothing, just skip this parameter
|
||||
} else {
|
||||
char curr_tid_str[32] = {'\0'}; // 32 is enougth for uint64_t
|
||||
snprintf(curr_tid_str, sizeof(curr_tid_str), "%lu", tenant_id_);
|
||||
char *tid_in_arg = NULL;
|
||||
name = STRTOK_R(name, "@", &tid_in_arg);
|
||||
if (OB_ISNULL(name) || OB_UNLIKELY('\0' == *name)) {
|
||||
// skip this parameter because name is invalid
|
||||
} else if (OB_NOT_NULL(tid_in_arg) && ('\0' != *tid_in_arg) &&
|
||||
0 != strcmp(tid_in_arg, curr_tid_str)) {
|
||||
// skip this parameter because the tenant_id does bot match
|
||||
} else {
|
||||
const int value_len = strlen(value);
|
||||
// hex2cstring -> value_len / 2 + 1
|
||||
// '\0' -> 1
|
||||
@ -409,6 +422,8 @@ int ObTenantConfig::add_extra_config(const char *config_str,
|
||||
LOG_INFO("Load tenant config succ", K(name), K(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
token = STRTOK_R(NULL, ",\n", &saveptr);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user