acelyc111 commented on code in PR #2030:
URL: 
https://github.com/apache/incubator-pegasus/pull/2030#discussion_r1615662760


##########
src/client/replication_ddl_client.cpp:
##########
@@ -1217,23 +1219,34 @@ replication_ddl_client::query_backup_policy(const 
std::vector<std::string> &poli
     configuration_query_backup_policy_response resp;
     ::dsn::unmarshall(resp_task->get_response(), resp);
 
+    std::streambuf *buf;
+    std::ofstream of;
+    buf = std::cout.rdbuf();
+    std::ostream out(buf);
+
     if (resp.err != ERR_OK) {
         return resp.err;
     } else {
+        dsn::utils::multi_table_printer mtp;
         for (int32_t idx = 0; idx < resp.policys.size(); idx++) {
             if (idx != 0) {
                 std::cout << "************************" << std::endl;
             }
             const policy_entry &pentry = resp.policys[idx];
-            std::cout << "policy_info:" << std::endl;
-            print_policy_entry(pentry);
-            std::cout << std::endl << "backup_infos:" << std::endl;
+            dsn::utils::table_printer tp_policy = print_policy_entry(pentry);
+            mtp.add(std::move(tp_policy));
             const std::vector<backup_entry> &backup_infos = 
resp.backup_infos[idx];
+            dsn::utils::table_printer tp_backup("backup_infos");

Review Comment:
   As cold_backup_constant::BACKUP_INFO is considered as the reserve key [1], 
so use cold_backup_constant::BACKUP_INFO instead of "backup_infos".
   
   1. 
https://github.com/apache/incubator-pegasus/blob/master/src/meta/meta_backup_service.cpp#L1470



##########
src/shell/commands/cold_backup.cpp:
##########
@@ -143,31 +143,54 @@ bool add_backup_policy(command_executor *e, shell_context 
*sc, arguments args)
 
 bool ls_backup_policy(command_executor *e, shell_context *sc, arguments args)
 {
-    ::dsn::error_code err = sc->ddl_client->ls_backup_policy();
+    static struct option long_options[] = {{"json", no_argument, 0, 'j'}, {0, 
0, 0, 0}};

Review Comment:
   It's recommend to use the modernize argh::parser instead of getopt_long.



-- 
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]

Reply via email to