empiredan commented on code in PR #1875:
URL:
https://github.com/apache/incubator-pegasus/pull/1875#discussion_r1480982455
##########
src/nfs/nfs_client_impl.cpp:
##########
@@ -582,33 +583,15 @@ void nfs_client_impl::register_cli_commands()
{
static std::once_flag flag;
std::call_once(flag, [&]() {
- _nfs_max_copy_rate_megabytes_cmd =
dsn::command_manager::instance().register_command(
- {"nfs.max_copy_rate_megabytes_per_disk"},
- "nfs.max_copy_rate_megabytes_per_disk [num]",
- "control the max rate(MB/s) for one disk to copy file from remote
node",
- [](const std::vector<std::string> &args) {
- std::string result("OK");
-
- if (args.empty()) {
- return
std::to_string(FLAGS_max_copy_rate_megabytes_per_disk);
- }
-
- int32_t max_copy_rate_megabytes = 0;
- if (!dsn::buf2int32(args[0], max_copy_rate_megabytes) ||
- max_copy_rate_megabytes <= 0) {
- return std::string("ERR: invalid arguments");
- }
-
- uint32_t max_copy_rate_bytes = max_copy_rate_megabytes << 20;
- if (max_copy_rate_bytes <= FLAGS_nfs_copy_block_bytes) {
- result = std::string("ERR:
max_copy_rate_bytes(max_copy_rate_megabytes << 20) "
- "should be greater than
nfs_copy_block_bytes:")
-
.append(std::to_string(FLAGS_nfs_copy_block_bytes));
- return result;
- }
- FLAGS_max_copy_rate_megabytes_per_disk =
max_copy_rate_megabytes;
- return result;
- });
+ _nfs_max_copy_rate_megabytes_cmd =
dsn::command_manager::instance().register_int_command(
+ FLAGS_max_copy_rate_megabytes_per_disk,
+ FLAGS_max_copy_rate_megabytes_per_disk,
+ "nfs.max_copy_rate_megabytes_per_disk",
+ fmt::format("{}, "
+ "should be less than 'nfs_copy_block_bytes' which is
{}",
Review Comment:
```suggestion
"should be greater than 'nfs_copy_block_bytes' which
is {}",
```
--
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]