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