add tests for object storage to sensitive test

This commit is contained in:
obdev
2024-02-09 17:50:21 +00:00
committed by ob-robot
parent 1d31b939ec
commit 335cda36b4
9 changed files with 97 additions and 88 deletions

View File

@ -1176,9 +1176,9 @@ int ObBackupStorageInfo::parse_storage_info_(const char *storage_info, bool &has
int ret = OB_SUCCESS;
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 if (OB_FAIL(ObObjectStorageInfo::parse_storage_info_(storage_info, has_needed_extension))) {
LOG_WARN("failed to parse storage info", K(ret), K(storage_info));
LOG_WARN("failed to parse storage info", K(ret), KP(storage_info));
} else {
char tmp[OB_MAX_BACKUP_STORAGE_INFO_LENGTH] = { 0 };
char serialize_key[OB_MAX_BACKUP_SERIALIZEKEY_LENGTH] = { 0 };
@ -1260,7 +1260,7 @@ int ObBackupStorageInfo::decrypt_access_key_(const char *buf)
} else if (OB_FAIL(ObEncryptionUtil::decrypt_sys_data(OB_SYS_TENANT_ID,
deserialize_buf, deserialize_size,
decrypt_key, sizeof(decrypt_key), key_len))) {
LOG_WARN("failed to decrypt authorization key", K(ret), K(deserialize_buf), K(deserialize_size));
LOG_WARN("failed to decrypt authorization key", K(ret), KP(deserialize_buf), K(deserialize_size));
} else if (key_len >= sizeof(decrypt_key) || (key_len + strlen(ACCESS_KEY)) >= sizeof(access_key_)) {
ret = OB_SIZE_OVERFLOW;
LOG_WARN("decrypt key size overflow", K(ret), K(key_len), K(sizeof(decrypt_key)));

View File

@ -167,7 +167,7 @@ int ObDeviceManager::alloc_device(ObDeviceInsInfo*& device_info,
}
if (-1 == avai_idx && -1 == last_no_ref_idx) {
OB_LOG(WARN, "devices too mang!", K(MAX_DEVICE_INSTANCE), K(storage_info), K(storage_type_prefix));
OB_LOG(WARN, "devices too mang!", K(MAX_DEVICE_INSTANCE), KP(storage_info.ptr()), K(storage_type_prefix));
//cannot insert into device manager
ret = OB_OUT_OF_ELEMENT;
} else {
@ -176,9 +176,11 @@ int ObDeviceManager::alloc_device(ObDeviceInsInfo*& device_info,
//erase from map
ObString old_key(device_ins_[last_no_ref_idx].storage_info_);
if (OB_FAIL(device_map_.erase_refactored(old_key))) {
OB_LOG(WARN, "fail to erase device from device map", K(old_key), K(ret), K(storage_info), K(storage_type_prefix));
OB_LOG(WARN, "fail to erase device from device map",
KP(old_key.ptr()), K(ret), KP(storage_info.ptr()), K(storage_type_prefix));
} else if (OB_FAIL(handle_map_.erase_refactored((int64_t)(device_ins_[last_no_ref_idx].device_)))) {
OB_LOG(WARN, "fail to erase device from handle map", K(device_ins_[last_no_ref_idx].device_), K(ret), K(storage_info), K(storage_type_prefix));
OB_LOG(WARN, "fail to erase device from handle map", K(ret),
K(device_ins_[last_no_ref_idx].device_), KP(storage_info.ptr()), K(storage_type_prefix));
} else {
/*free the resource*/
ObIODevice* del_device = device_ins_[last_no_ref_idx].device_;
@ -188,7 +190,8 @@ int ObDeviceManager::alloc_device(ObDeviceInsInfo*& device_info,
abort_unless(device_count_ == MAX_DEVICE_INSTANCE);
device_count_--;
avai_idx = last_no_ref_idx;
OB_LOG(INFO, "release one device for realloc another!", K(old_key), K(storage_info), K(storage_type_prefix));
OB_LOG(INFO, "release one device for realloc another!",
KP(old_key.ptr()), KP(storage_info.ptr()), K(storage_type_prefix));
}
}
@ -197,11 +200,14 @@ int ObDeviceManager::alloc_device(ObDeviceInsInfo*& device_info,
STRCPY(device_ins_[avai_idx].storage_info_, storage_info.ptr());
ObString cur_key(device_ins_[avai_idx].storage_info_);
if (OB_FAIL(device_map_.set_refactored(cur_key, &(device_ins_[avai_idx])))) {
OB_LOG(WARN, "fail to set device to device map!", K(ret), K(cur_key), K(storage_type_prefix));
OB_LOG(WARN, "fail to set device to device map!",
K(ret), KP(storage_info.ptr()), K(storage_type_prefix));
} else if (OB_FAIL(handle_map_.set_refactored((int64_t)(device_handle), &(device_ins_[avai_idx])))) {
OB_LOG(WARN, "fail to set device to handle map!", K(ret), K(storage_info), K(storage_type_prefix));
OB_LOG(WARN, "fail to set device to handle map!",
K(ret), KP(storage_info.ptr()), K(storage_type_prefix));
} else {
OB_LOG(INFO, "success insert into map!", K(storage_info), K(storage_type_prefix));
OB_LOG(INFO, "success insert into map!",
KP(storage_info.ptr()), K(storage_type_prefix));
}
}
}
@ -216,7 +222,8 @@ int ObDeviceManager::alloc_device(ObDeviceInsInfo*& device_info,
device_ins_[avai_idx].device_ = device_handle;
device_ins_[avai_idx].ref_cnt_ = 0;
device_count_++;
OB_LOG(INFO, "alloc a new device!", K(storage_info), K(storage_type_prefix), K(avai_idx), K(device_count_), K(device_handle));
OB_LOG(INFO, "alloc a new device!", KP(storage_info.ptr()),
K(storage_type_prefix), K(avai_idx), K(device_count_), K(device_handle));
device_info = &(device_ins_[avai_idx]);
}
@ -254,10 +261,12 @@ int ObDeviceManager::get_device(const common::ObString& storage_info,
if (OB_HASH_NOT_EXIST == ret) {
//alloc a device, and set into the map
if (OB_FAIL(alloc_device(dev_info, storage_info_tmp, storage_type_prefix))) {
OB_LOG(WARN, "fail to alloc device!", K(ret), K(storage_info_tmp), K(storage_type_prefix));
OB_LOG(WARN, "fail to alloc device!",
K(ret), KP(storage_info_tmp.ptr()), K(storage_type_prefix));
}
} else {
OB_LOG(WARN, "fail to get device from device manager ", K(ret), K(storage_info_tmp), K(storage_type_prefix));
OB_LOG(WARN, "fail to get device from device manager ",
K(ret), KP(storage_info_tmp.ptr()), K(storage_type_prefix));
}
}
@ -300,7 +309,7 @@ int ObDeviceManager::release_device(ObIODevice*& device_handle)
abort_unless(device_info->ref_cnt_ > 0);
device_info->ref_cnt_--;
if (0 == device_info->ref_cnt_) {
OB_LOG(DEBUG, "A Device has no others ref", K(device_info->device_), K(device_info->storage_info_));
OB_LOG(DEBUG, "A Device has no others ref", K(device_info->device_), KP(device_info->storage_info_));
} else {
OB_LOG(DEBUG, "released dev info", K(device_info->device_), K(device_info->ref_cnt_));
}