Skip to content

Commit

Permalink
Fix some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SWJTU-ZhangLei committed Dec 25, 2024
1 parent 8db1a5a commit a2a1c3b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 8 deletions.
2 changes: 0 additions & 2 deletions cloud/src/meta-service/meta_service_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,6 @@ static int alter_hdfs_storage_vault(InstanceInfoPB& instance, std::unique_ptr<Tr

DCHECK_EQ(new_vault.id(), vault_id);
response->set_storage_vault_id(new_vault.id());
response->set_storage_vault_name(new_vault.name());
return 0;
}

Expand Down Expand Up @@ -770,7 +769,6 @@ static int alter_s3_storage_vault(InstanceInfoPB& instance, std::unique_ptr<Tran

DCHECK_EQ(new_vault.id(), vault_id);
response->set_storage_vault_id(new_vault.id());
response->set_storage_vault_name(new_vault.name());
return 0;
}

Expand Down
39 changes: 39 additions & 0 deletions cloud/test/meta_service_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,25 @@ TEST(MetaServiceTest, AlterS3StorageVaultTest) {
meta_service->alter_storage_vault(
reinterpret_cast<::google::protobuf::RpcController*>(&cntl), &req, &res, nullptr);
ASSERT_EQ(res.status().code(), MetaServiceCode::OK) << res.status().msg();

{
AlterObjStoreInfoRequest req;
req.set_cloud_unique_id("test_cloud_unique_id");
req.set_op(AlterObjStoreInfoRequest::ALTER_S3_VAULT);
StorageVaultPB vault;
vault.set_alter_name(new_vault_name);
ObjectStoreInfoPB obj;
obj_info.set_ak("new_ak");
obj_info.set_sk("new_sk");
vault.mutable_obj_info()->MergeFrom(obj);
vault.set_name(new_vault_name);
req.mutable_vault()->CopyFrom(vault);
meta_service->alter_storage_vault(
reinterpret_cast<::google::protobuf::RpcController*>(&cntl), &req, &res,
nullptr);
ASSERT_EQ(res.status().code(), MetaServiceCode::ALREADY_EXISTED) << res.status().msg();
}

InstanceInfoPB instance;
get_test_instance(instance);

Expand Down Expand Up @@ -726,6 +745,7 @@ TEST(MetaServiceTest, AlterHdfsStorageVaultTest) {
meta_service->alter_storage_vault(
reinterpret_cast<::google::protobuf::RpcController*>(&cntl), &req, &res, nullptr);
ASSERT_EQ(res.status().code(), MetaServiceCode::OK) << res.status().msg();

InstanceInfoPB instance;
get_test_instance(instance);

Expand Down Expand Up @@ -793,6 +813,25 @@ TEST(MetaServiceTest, AlterHdfsStorageVaultTest) {
meta_service->alter_storage_vault(
reinterpret_cast<::google::protobuf::RpcController*>(&cntl), &req, &res, nullptr);
ASSERT_EQ(res.status().code(), MetaServiceCode::OK) << res.status().msg();

{
AlterObjStoreInfoRequest req;
req.set_cloud_unique_id("test_cloud_unique_id");
req.set_op(AlterObjStoreInfoRequest::ALTER_HDFS_VAULT);
StorageVaultPB vault;
vault.mutable_hdfs_info()->mutable_build_conf()->set_user("hadoop");
vault.set_name(new_vault_name);
vault.set_alter_name(new_vault_name);
req.mutable_vault()->CopyFrom(vault);

brpc::Controller cntl;
AlterObjStoreInfoResponse res;
meta_service->alter_storage_vault(
reinterpret_cast<::google::protobuf::RpcController*>(&cntl), &req, &res,
nullptr);
ASSERT_EQ(res.status().code(), MetaServiceCode::ALREADY_EXISTED) << res.status().msg();
}

InstanceInfoPB instance;
get_test_instance(instance);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,11 @@ public void alterStorageVault(StorageVaultType type, Map<String, String> propert
throw new DdlException(response.getStatus().getMsg());
}

updateVaultNameToIdCache(name, response.getStorageVaultName(), response.getStorageVaultId());
LOG.info("Succeed to alter storage vault, old name:{} new name: {} id:{}", name,
response.getStorageVaultName(), response.getStorageVaultId());
if (request.hasVault() && request.getVault().hasAlterName()) {
updateVaultNameToIdCache(name, request.getVault().getAlterName(), response.getStorageVaultId());
LOG.info("Succeed to alter storage vault, old name:{} new name: {} id:{}", name,
request.getVault().getAlterName(), response.getStorageVaultId());
}

// Make BE eagerly fetch the storage vault info from Meta Service
ALTER_BE_SYNC_THREAD_POOL.execute(() -> alterSyncVaultTask());
Expand Down
3 changes: 0 additions & 3 deletions gensrc/proto/cloud.proto
Original file line number Diff line number Diff line change
Expand Up @@ -887,9 +887,6 @@ message AlterObjStoreInfoResponse {
optional MetaServiceResponseStatus status = 1;
optional string storage_vault_id = 2;
optional bool default_storage_vault_replaced = 3;

// storage_vault_name maybe changed, so return new storage_vault_name
optional string storage_vault_name = 4;
}

message UpdateAkSkRequest {
Expand Down

0 comments on commit a2a1c3b

Please sign in to comment.