From a3be632dd7b671604718477d5d816374f2f121b5 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Wed, 20 Apr 2016 17:53:50 +0530 Subject: [PATCH 113/139] cli/bitrot: Unmask scrub statistics Revert the commit 2a37dbd845348a774f45c4d77cffebc32c749251 The scrub statistics were masked because of inaccurate stats. Now with http://review.gluster.org/#/c/14044/ it's fixed, hence unmasking it. Upstream: master: http://review.gluster.org/14121 release-3.7: http://review.gluster.org/14142 BUG: 1299737 Change-Id: I5664578d1a6efe92a2a887328470821e28443873 Signed-off-by: Kotresh HR Reviewed-on: https://code.engineering.redhat.com/gerrit/73579 Reviewed-by: Venky Shankar Tested-by: Venky Shankar --- cli/src/cli-rpc-ops.c | 61 ++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 55 insertions(+), 6 deletions(-) diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 6574b08..a3787c4 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -10765,9 +10765,9 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict) uint64_t unsigned_files = 0; uint64_t scrub_time = 0; uint64_t days = 0; - uint64_t hour = 0; - uint64_t minut = 0; - uint64_t second = 0; + uint64_t hours = 0; + uint64_t minutes = 0; + uint64_t seconds = 0; char *last_scrub = NULL; uint64_t error_count = 0; @@ -10825,9 +10825,9 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict) last_scrub = NULL; scrub_time = 0; days = 0; - hour = 0; - minut = 0; - second = 0; + hours = 0; + minutes = 0; + seconds = 0; error_count = 0; scrub_files = 0; unsigned_files = 0; @@ -10839,6 +10839,33 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict) gf_log ("cli", GF_LOG_TRACE, "failed to get node-name"); memset (key, 0, 256); + snprintf (key, 256, "scrubbed-files-%d", i); + ret = dict_get_uint64 (dict, key, &scrub_files); + if (ret) + gf_log ("cli", GF_LOG_TRACE, "failed to get scrubbed " + "files"); + + memset (key, 0, 256); + snprintf (key, 256, "unsigned-files-%d", i); + ret = dict_get_uint64 (dict, key, &unsigned_files); + if (ret) + gf_log ("cli", GF_LOG_TRACE, "failed to get unsigned " + "files"); + + memset (key, 0, 256); + snprintf (key, 256, "scrub-duration-%d", i); + ret = dict_get_uint64 (dict, key, &scrub_time); + if (ret) + gf_log ("cli", GF_LOG_TRACE, "failed to get last scrub " + "duration"); + + memset (key, 0, 256); + snprintf (key, 256, "last-scrub-time-%d", i); + ret = dict_get_str (dict, key, &last_scrub); + if (ret) + gf_log ("cli", GF_LOG_TRACE, "failed to get last scrub" + " time"); + memset (key, 0, 256); snprintf (key, 256, "error-count-%d", i); ret = dict_get_uint64 (dict, key, &error_count); if (ret) @@ -10850,6 +10877,28 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict) cli_out ("%s: %s\n", "Node", node_name); + cli_out ("%s: %"PRIu64 "\n", "Number of Scrubbed files", + scrub_files); + + cli_out ("%s: %"PRIu64 "\n", "Number of Skipped files", + unsigned_files); + + if ((!last_scrub) || !strcmp (last_scrub, "")) + cli_out ("%s: %s\n", "Last completed scrub time", + "Scrubber pending to complete."); + else + cli_out ("%s: %s\n", "Last completed scrub time", + last_scrub); + + /* Printing last scrub duration time in human readable form*/ + seconds = scrub_time%60; + minutes = (scrub_time/60)%60; + hours = (scrub_time/3600)%24; + days = scrub_time/86400; + cli_out ("%s: %"PRIu64 ":%"PRIu64 ":%"PRIu64 ":%"PRIu64 "\n", + "Duration of last scrub (D:M:H:M:S)", + days, hours, minutes, seconds); + cli_out ("%s: %"PRIu64 "\n", "Error count", error_count); if (error_count) { -- 1.7.1