Copilot commented on code in PR #2229:
URL:
https://github.com/apache/incubator-pegasus/pull/2229#discussion_r2047150438
##########
src/shell/commands/table_management.cpp:
##########
@@ -1068,3 +1068,100 @@ bool set_max_replica_count(command_executor *e,
shell_context *sc, arguments arg
return true;
}
+
+bool get_atomic_idempotent(command_executor *e, shell_context *sc, arguments
args)
+{
+ // get_atomic_idempotent <app_name> [-j|--json]
+
+ // All valid flags are given as follows.
+ static const std::set<std::string> flags = {"j", "json"};
+
+ argh::parser cmd(args.argc, args.argv,
argh::parser::PREFER_PARAM_FOR_UNREG_OPTION);
+
+ // Check if the input flags are valid, and there is exact one positional
argument
+ // (i.e. app_name).
+ const auto &check = validate_cmd(cmd, {}, flags, 1);
+ if (!check) {
+ SHELL_PRINTLN_ERROR("{}", check.description());
+ return false;
+ }
+
+ // Get the only positional argument as app_name.
+ const std::string app_name(cmd(1).str());
+
+ const bool json = cmd[{"-j", "--json"}];
+
+ const auto &result = sc->ddl_client->get_atomic_idempotent(app_name);
+ auto status = result.get_error();
+ if (status) {
+ status = FMT_ERR(result.get_value().err,
result.get_value().hint_message);
+ }
+
+ if (!status) {
+ SHELL_PRINTLN_ERROR("get_atomic_idempotent failed, error={}", status);
+ return true;
Review Comment:
The error handling in get_atomic_idempotent (and similarly in
set_atomic_idempotent) returns true on an error condition, which is
inconsistent with patterns (e.g., in create_app) where errors return false;
consider standardizing the error return behavior for clarity and consistency.
```suggestion
return false;
```
--
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]