]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/ceph_kvstore_tool: Move summary output to print_summary 26666/head
authorBrad Hubbard <bhubbard@redhat.com>
Wed, 27 Feb 2019 06:01:45 +0000 (16:01 +1000)
committerBrad Hubbard <bhubbard@redhat.com>
Wed, 27 Feb 2019 08:17:28 +0000 (18:17 +1000)
Post 301a64212f0a38a3b5db4bd1bd0f15e26ff055cf we are still seeing an ICE
in the copy_store_to code. Moving the summary printing to its own
function alleviates the issue.

Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
src/tools/kvstore_tool.cc
src/tools/kvstore_tool.h

index 7a65ff96baee43c964ed921ce56755a8e7136576..2d94e610c731772bb1aed2b64e1e7480f163b4f6 100644 (file)
@@ -179,6 +179,19 @@ bool StoreTool::rm_prefix(const string& prefix)
   return (ret == 0);
 }
 
+void StoreTool::print_summary(const uint64_t total_keys, const uint64_t total_size,
+                              const uint64_t total_txs, const string& store_path,
+                              const string& other_path, const int duration) const
+{
+  std::cout << "summary:" << std::endl;
+  std::cout << "  copied " << total_keys << " keys" << std::endl;
+  std::cout << "  used " << total_txs << " transactions" << std::endl;
+  std::cout << "  total size " << byte_u_t(total_size) << std::endl;
+  std::cout << "  from '" << store_path << "' to '" << other_path << "'"
+            << std::endl;
+  std::cout << "  duration " << duration << " seconds" << std::endl;
+}
+
 int StoreTool::copy_store_to(const string& type, const string& other_path,
                              const int num_keys_per_tx,
                              const string& other_type)
@@ -238,13 +251,8 @@ int StoreTool::copy_store_to(const string& type, const string& other_path,
 
   } while (it->valid());
 
-  std::cout << "summary:" << std::endl;
-  std::cout << "  copied " << total_keys << " keys" << std::endl;
-  std::cout << "  used " << total_txs << " transactions" << std::endl;
-  std::cout << "  total size " << byte_u_t(total_size) << std::endl;
-  std::cout << "  from '" << store_path << "' to '" << other_path << "'"
-            << std::endl;
-  std::cout << "  duration " << duration() << " seconds" << std::endl;
+  print_summary(total_keys, total_size, total_txs, store_path, other_path,
+                duration());
 
   return 0;
 }
index 751d35b40d620afbb5392e4fe688b19361d5836f..296ee5d9a79e58903dcc4d101b6130aebaf11f73 100644 (file)
@@ -62,6 +62,9 @@ public:
           ceph::bufferlist& val);
   bool rm(const std::string& prefix, const std::string& key);
   bool rm_prefix(const std::string& prefix);
+  void print_summary(const uint64_t total_keys, const uint64_t total_size,
+                     const uint64_t total_txs, const std::string& store_path,
+                     const std::string& other_path, const int duration) const;
   int copy_store_to(const std::string& type, const std::string& other_path,
                     const int num_keys_per_tx, const std::string& other_type);
   void compact();