add tests for object storage to sensitive test
This commit is contained in:
@ -134,7 +134,7 @@ int ObCosAccount::parse_from(const char *storage_info, uint32_t size)
|
||||
int ret = OB_SUCCESS;
|
||||
if (NULL == storage_info || MAX_COS_DOMAIN_LENGTH <= size) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
cos_warn_log("[COS]cos parse account failed, storage_info=%s, size=%d, ret=%d\n", storage_info, size, ret);
|
||||
cos_warn_log("[COS]cos parse account failed, storage_info=%p, size=%d, ret=%d\n", storage_info, size, ret);
|
||||
} else {
|
||||
// host=xxxx&access_id=xxx&access_key=xxx&appid=xxx
|
||||
char tmp[MAX_COS_DOMAIN_LENGTH];
|
||||
@ -169,7 +169,7 @@ int ObCosAccount::parse_from(const char *storage_info, uint32_t size)
|
||||
}
|
||||
} else if (0 == strncmp(ACCESS_KEY, token, strlen(ACCESS_KEY))) {
|
||||
if (OB_SUCCESS != (ret = set_field(token + strlen(ACCESS_KEY), access_key_, sizeof(access_key_)))) {
|
||||
cos_warn_log("[COS]fail to set access_key=%s, ret=%d\n", token, ret);
|
||||
cos_warn_log("[COS]fail to set access_key, ret=%d\n", ret);
|
||||
} else {
|
||||
bitmap |= (1 << 2);
|
||||
}
|
||||
@ -190,7 +190,7 @@ int ObCosAccount::parse_from(const char *storage_info, uint32_t size)
|
||||
|
||||
if (OB_SUCCESS == ret && bitmap != 0x0F) {
|
||||
ret = OB_COS_ERROR;
|
||||
cos_warn_log("[COS]fail to parse cos account storage_info=%s, bitmap=%x, ret=%d\n", storage_info, bitmap, ret);
|
||||
cos_warn_log("[COS]fail to parse cos account storage_info=%p, bitmap=%x, ret=%d\n", storage_info, bitmap, ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ void ObObjectDevice::destroy()
|
||||
ObObjectDevice::~ObObjectDevice()
|
||||
{
|
||||
destroy();
|
||||
OB_LOG(INFO, "destory the device!", KCSTRING(storage_info_str_));
|
||||
OB_LOG(INFO, "destory the device!", KP(storage_info_str_));
|
||||
}
|
||||
|
||||
/*the app logical use call ObBackupIoAdapter::get_and_init_device*/
|
||||
@ -83,7 +83,7 @@ int ObObjectDevice::start(const ObIODOpts &opts)
|
||||
if (OB_SUCCESS != ret) {
|
||||
//mem resource will be free with device destroy
|
||||
} else if (OB_FAIL(util_.open(&storage_info_))) {
|
||||
OB_LOG(WARN, "fail to open the util!", K(ret), KCSTRING(opts.opts_[0].value_.value_str));
|
||||
OB_LOG(WARN, "fail to open the util!", K(ret), KP(opts.opts_[0].value_.value_str));
|
||||
} else if (OB_FAIL(fd_mng_.init())) {
|
||||
OB_LOG(WARN, "fail to init fd manager!", K(ret));
|
||||
} else {
|
||||
|
||||
12
deps/oblib/src/lib/restore/ob_storage_info.cpp
vendored
12
deps/oblib/src/lib/restore/ob_storage_info.cpp
vendored
@ -107,7 +107,7 @@ int ObObjectStorageInfo::set(const common::ObStorageType device_type, const char
|
||||
LOG_WARN("storage info init twice", K(ret));
|
||||
} else if (OB_ISNULL(storage_info) || strlen(storage_info) >= OB_MAX_BACKUP_STORAGE_INFO_LENGTH) {
|
||||
ret = OB_INVALID_BACKUP_DEST;
|
||||
LOG_WARN("storage info is invalid", K(ret), K(storage_info));
|
||||
LOG_WARN("storage info is invalid", K(ret), KP(storage_info));
|
||||
} else if (FALSE_IT(device_type_ = device_type)) {
|
||||
} else if (0 == strlen(storage_info)) {
|
||||
if (OB_STORAGE_FILE != device_type_) {
|
||||
@ -163,7 +163,7 @@ int ObObjectStorageInfo::parse_storage_info_(const char *storage_info, bool &has
|
||||
has_needed_extension = false;
|
||||
if (OB_ISNULL(storage_info) || strlen(storage_info) >= OB_MAX_BACKUP_STORAGE_INFO_LENGTH) {
|
||||
ret = OB_INVALID_BACKUP_DEST;
|
||||
LOG_WARN("storage info is invalid", K(ret), K(storage_info), K(strlen(storage_info)));
|
||||
LOG_WARN("storage info is invalid", K(ret), KP(storage_info), K(strlen(storage_info)));
|
||||
} else {
|
||||
char tmp[OB_MAX_BACKUP_STORAGE_INFO_LENGTH] = { 0 };
|
||||
char *token = NULL;
|
||||
@ -192,7 +192,7 @@ int ObObjectStorageInfo::parse_storage_info_(const char *storage_info, bool &has
|
||||
}
|
||||
} else if (0 == strncmp(ACCESS_KEY, token, strlen(ACCESS_KEY))) {
|
||||
if (OB_FAIL(set_storage_info_field_(token, access_key_, sizeof(access_key_)))) {
|
||||
LOG_WARN("failed to set access key", K(ret), K(token));
|
||||
LOG_WARN("failed to set access key", K(ret));
|
||||
}
|
||||
} else if (OB_STORAGE_FILE != device_type_ && 0 == strncmp(APPID, token, strlen(APPID))) {
|
||||
has_needed_extension = (OB_STORAGE_COS == device_type_);
|
||||
@ -250,14 +250,14 @@ int ObObjectStorageInfo::set_storage_info_field_(const char *info, char *field,
|
||||
int64_t pos = strlen(field);
|
||||
if (info_len >= length) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("info is too long ", K(ret), K(info), K(length));
|
||||
LOG_WARN("info is too long ", K(ret), K(info_len), K(length));
|
||||
} else if (pos > 0 && OB_FAIL(databuff_printf(field, length, pos, "&"))) {
|
||||
// cos:host=xxxx&access_id=xxx&access_key=xxxappid=xxx&delete_mode=xxx
|
||||
// extension_ may contain both appid and delete_mode
|
||||
// so delimiter '&' should be included
|
||||
LOG_WARN("failed to add delimiter to storage info field", K(ret), K(info), K(field), K(length));
|
||||
LOG_WARN("failed to add delimiter to storage info field", K(ret), K(pos), KP(field), K(length));
|
||||
} else if (OB_FAIL(databuff_printf(field, length, pos, "%s", info))) {
|
||||
LOG_WARN("failed to set storage info field", K(ret), K(info), K(field), K(length));
|
||||
LOG_WARN("failed to set storage info field", K(ret), K(pos), KP(field), K(length));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
@ -436,7 +436,7 @@ int ObOssAccount::parse_oss_arg(const common::ObString &storage_info)
|
||||
OB_LOG(WARN, "oss client init twice", K(ret));
|
||||
} else if (OB_ISNULL(storage_info.ptr()) || storage_info.length() >= OB_MAX_URI_LENGTH) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
OB_LOG(WARN, "uri is too long", K(ret), K(storage_info), K(storage_info.length()));
|
||||
OB_LOG(WARN, "uri is too long", K(ret), K(storage_info.length()));
|
||||
} else {
|
||||
// host=xxxx&access_id=xxx&access_key=xxx
|
||||
char tmp[OB_MAX_URI_LENGTH];
|
||||
@ -464,24 +464,24 @@ int ObOssAccount::parse_oss_arg(const common::ObString &storage_info)
|
||||
}
|
||||
} else if (0 == strncmp(ACCESS_KEY, token, strlen(ACCESS_KEY))) {
|
||||
if (OB_FAIL(set_oss_field(token + strlen(ACCESS_KEY), oss_key_, sizeof(oss_key_)))) {
|
||||
OB_LOG(WARN, "failed to set oss_key_", K(ret), KCSTRING(token));
|
||||
OB_LOG(WARN, "failed to set oss_key_", K(ret));
|
||||
}
|
||||
} else if (0 == strncmp(DELETE_MODE, token, strlen(DELETE_MODE))) {
|
||||
if (OB_FAIL(set_delete_mode(token + strlen(DELETE_MODE)))) {
|
||||
OB_LOG(WARN, "failed to set delete mode", K(ret), K(token));
|
||||
}
|
||||
} else {
|
||||
OB_LOG(DEBUG, "unkown oss info", K(*token), K(storage_info));
|
||||
OB_LOG(DEBUG, "unkown oss info", K(*token), KP(storage_info.ptr()));
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(oss_domain_) == 0 || strlen(oss_id_) == 0 || strlen(oss_key_) == 0) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
STORAGE_LOG(WARN, "failed to parse oss info",
|
||||
K(ret), KCSTRING(oss_domain_), KCSTRING(oss_id_), KCSTRING(oss_key_), K(storage_info));
|
||||
K(ret), KCSTRING(oss_domain_), KCSTRING(oss_id_));
|
||||
} else {
|
||||
STORAGE_LOG(DEBUG, "success to parse oss info",
|
||||
K(ret), KCSTRING(oss_domain_), KCSTRING(oss_id_), KCSTRING(oss_key_), K(storage_info));
|
||||
K(ret), KCSTRING(oss_domain_), KCSTRING(oss_id_));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -498,7 +498,7 @@ int ObOssAccount::set_oss_field(const char *info, char *field, const int64_t len
|
||||
const int64_t info_len = strlen(info);
|
||||
if (info_len >= length) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
OB_LOG(WARN, "info is too long ", K(ret), KCSTRING(info), K(length));
|
||||
OB_LOG(WARN, "info is too long ", K(ret), K(info_len), K(length));
|
||||
} else {
|
||||
MEMCPY(field, info, info_len);
|
||||
field[info_len] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user