github-actions[bot] commented on code in PR #45685:
URL: https://github.com/apache/doris/pull/45685#discussion_r1893331371
##########
cloud/src/meta-service/meta_service_resource.cpp:
##########
@@ -523,9 +523,18 @@ static void set_default_vault_log_helper(const
InstanceInfoPB& instance,
LOG(INFO) << vault_msg;
}
-static int alter_hdfs_storage_vault(InstanceInfoPB& instance,
std::unique_ptr<Transaction> txn,
+static bool vault_exist(const InstanceInfoPB& instance, const std::string&
new_vault_name) {
+ for (auto& name : instance.storage_vault_names()) {
+ if (new_vault_name == name) {
+ return true;
+ }
+ }
+ return false;
+}
+
+static int alter_hdfs_storage_vault(InstanceInfoPB& instance,
std::unique_ptr<Transaction>& txn,
Review Comment:
warning: function 'alter_hdfs_storage_vault' exceeds recommended
size/complexity thresholds [readability-function-size]
```cpp
static int alter_hdfs_storage_vault(InstanceInfoPB& instance,
std::unique_ptr<Transaction>& txn,
^
```
<details>
<summary>Additional context</summary>
**cloud/src/meta-service/meta_service_resource.cpp:534:** 116 lines
including whitespace and comments (threshold 80)
```cpp
static int alter_hdfs_storage_vault(InstanceInfoPB& instance,
std::unique_ptr<Transaction>& txn,
^
```
</details>
##########
cloud/src/meta-service/meta_service_resource.cpp:
##########
@@ -623,19 +639,22 @@
txn->put(vault_key, val);
LOG(INFO) << "put vault_id=" << vault_id << ", vault_key=" <<
hex(vault_key)
<< ", origin vault=" << origin_vault_info << ", new_vault=" <<
new_vault_info;
- err = txn->commit();
- if (err != TxnErrorCode::TXN_OK) {
- code = cast_as<ErrCategory::COMMIT>(err);
- msg = fmt::format("failed to commit kv txn, err={}", err);
- LOG(WARNING) << msg;
- }
-
+ // err = txn->commit();
+ // if (err != TxnErrorCode::TXN_OK) {
+ // code = cast_as<ErrCategory::COMMIT>(err);
+ // msg = fmt::format("failed to commit kv txn, err={}", err);
+ // LOG(WARNING) << msg;
+ // }
+
+ 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;
}
-static int alter_s3_storage_vault(InstanceInfoPB& instance,
std::unique_ptr<Transaction> txn,
+static int alter_s3_storage_vault(InstanceInfoPB& instance,
std::unique_ptr<Transaction>& txn,
Review Comment:
warning: function 'alter_s3_storage_vault' exceeds recommended
size/complexity thresholds [readability-function-size]
```cpp
static int alter_s3_storage_vault(InstanceInfoPB& instance,
std::unique_ptr<Transaction>& txn,
^
```
<details>
<summary>Additional context</summary>
**cloud/src/meta-service/meta_service_resource.cpp:654:** 130 lines
including whitespace and comments (threshold 80)
```cpp
static int alter_s3_storage_vault(InstanceInfoPB& instance,
std::unique_ptr<Transaction>& txn,
^
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]