From 504ab054638233cb1882d7e57824a01a097f08cf Mon Sep 17 00:00:00 2001 From: Brad Hubbard Date: Wed, 27 Feb 2019 16:01:45 +1000 Subject: [PATCH] tools/ceph_kvstore_tool: Move summary output to print_summary 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 --- src/tools/kvstore_tool.cc | 22 +++++++++++++++------- src/tools/kvstore_tool.h | 3 +++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/tools/kvstore_tool.cc b/src/tools/kvstore_tool.cc index 7a65ff96baee4..2d94e610c7317 100644 --- a/src/tools/kvstore_tool.cc +++ b/src/tools/kvstore_tool.cc @@ -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; } diff --git a/src/tools/kvstore_tool.h b/src/tools/kvstore_tool.h index 751d35b40d620..296ee5d9a79e5 100644 --- a/src/tools/kvstore_tool.h +++ b/src/tools/kvstore_tool.h @@ -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(); -- 2.39.5