|
|
14f8ab |
From 866a4c49ad9c5a9125814a9f843d4c7fd967ab2b Mon Sep 17 00:00:00 2001
|
|
|
14f8ab |
From: Kotresh HR <khiremat@redhat.com>
|
|
|
14f8ab |
Date: Mon, 3 Feb 2020 18:10:17 +0530
|
|
|
14f8ab |
Subject: [PATCH 446/449] bitrot: Make number of signer threads configurable
|
|
|
14f8ab |
|
|
|
14f8ab |
The number of signing process threads (glfs_brpobj)
|
|
|
14f8ab |
is set to 4 by default. The recommendation is to set
|
|
|
14f8ab |
it to number of cores available. This patch makes it
|
|
|
14f8ab |
configurable as follows
|
|
|
14f8ab |
|
|
|
14f8ab |
gluster vol bitrot <volname> signer-threads <count>
|
|
|
14f8ab |
|
|
|
14f8ab |
> fixes: bz#1797869
|
|
|
14f8ab |
> Change-Id: Ia883b3e5e34e0bc8d095243508d320c9c9c58adc
|
|
|
14f8ab |
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
|
|
|
14f8ab |
> (Cherry pick from commit 8fad76650bd85463708f59d2518f5b764ae4c702)
|
|
|
14f8ab |
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/24091/)
|
|
|
14f8ab |
|
|
|
14f8ab |
BUG: 1790336
|
|
|
14f8ab |
Change-Id: Ia883b3e5e34e0bc8d095243508d320c9c9c58adc
|
|
|
14f8ab |
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
14f8ab |
Reviewed-on: https://code.engineering.redhat.com/gerrit/202780
|
|
|
14f8ab |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
14f8ab |
---
|
|
|
14f8ab |
cli/src/cli-cmd-parser.c | 29 +++++++-
|
|
|
14f8ab |
cli/src/cli-cmd-volume.c | 12 +++
|
|
|
14f8ab |
doc/gluster.8 | 6 ++
|
|
|
14f8ab |
libglusterfs/src/glusterfs/common-utils.h | 1 +
|
|
|
14f8ab |
rpc/xdr/src/cli1-xdr.x | 1 +
|
|
|
14f8ab |
tests/bitrot/br-signer-threads-config-1797869.t | 73 +++++++++++++++++++
|
|
|
14f8ab |
xlators/features/bit-rot/src/bitd/bit-rot.c | 45 +++++++++---
|
|
|
14f8ab |
xlators/features/bit-rot/src/bitd/bit-rot.h | 20 ++---
|
|
|
14f8ab |
.../bit-rot/src/stub/bit-rot-stub-mem-types.h | 1 +
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-bitrot.c | 85 ++++++++++++++++++++++
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-volgen.c | 16 ++--
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 9 +++
|
|
|
14f8ab |
12 files changed, 270 insertions(+), 28 deletions(-)
|
|
|
14f8ab |
create mode 100644 tests/bitrot/br-signer-threads-config-1797869.t
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
|
|
|
14f8ab |
index 7446b95..5fd05f4 100644
|
|
|
14f8ab |
--- a/cli/src/cli-cmd-parser.c
|
|
|
14f8ab |
+++ b/cli/src/cli-cmd-parser.c
|
|
|
14f8ab |
@@ -5661,7 +5661,7 @@ cli_cmd_bitrot_parse(const char **words, int wordcount, dict_t **options)
|
|
|
14f8ab |
char *volname = NULL;
|
|
|
14f8ab |
char *opwords[] = {
|
|
|
14f8ab |
"enable", "disable", "scrub-throttle", "scrub-frequency", "scrub",
|
|
|
14f8ab |
- "signing-time", NULL};
|
|
|
14f8ab |
+ "signing-time", "signer-threads", NULL};
|
|
|
14f8ab |
char *scrub_throt_values[] = {"lazy", "normal", "aggressive", NULL};
|
|
|
14f8ab |
char *scrub_freq_values[] = {"hourly", "daily", "weekly", "biweekly",
|
|
|
14f8ab |
"monthly", "minute", NULL};
|
|
|
14f8ab |
@@ -5669,6 +5669,7 @@ cli_cmd_bitrot_parse(const char **words, int wordcount, dict_t **options)
|
|
|
14f8ab |
dict_t *dict = NULL;
|
|
|
14f8ab |
gf_bitrot_type type = GF_BITROT_OPTION_TYPE_NONE;
|
|
|
14f8ab |
int32_t expiry_time = 0;
|
|
|
14f8ab |
+ int32_t signer_th_count = 0;
|
|
|
14f8ab |
|
|
|
14f8ab |
GF_ASSERT(words);
|
|
|
14f8ab |
GF_ASSERT(options);
|
|
|
14f8ab |
@@ -5849,6 +5850,31 @@ cli_cmd_bitrot_parse(const char **words, int wordcount, dict_t **options)
|
|
|
14f8ab |
}
|
|
|
14f8ab |
goto set_type;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
+ } else if (!strcmp(words[3], "signer-threads")) {
|
|
|
14f8ab |
+ if (!words[4]) {
|
|
|
14f8ab |
+ cli_err(
|
|
|
14f8ab |
+ "Missing signer-thread value for bitrot "
|
|
|
14f8ab |
+ "option");
|
|
|
14f8ab |
+ ret = -1;
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ } else {
|
|
|
14f8ab |
+ type = GF_BITROT_OPTION_TYPE_SIGNER_THREADS;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ signer_th_count = strtol(words[4], NULL, 0);
|
|
|
14f8ab |
+ if (signer_th_count < 1) {
|
|
|
14f8ab |
+ cli_err("signer-thread count should not be less than 1");
|
|
|
14f8ab |
+ ret = -1;
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ ret = dict_set_uint32(dict, "signer-threads",
|
|
|
14f8ab |
+ (unsigned int)signer_th_count);
|
|
|
14f8ab |
+ if (ret) {
|
|
|
14f8ab |
+ cli_out("Failed to set dict for bitrot");
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ goto set_type;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
} else {
|
|
|
14f8ab |
cli_err(
|
|
|
14f8ab |
"Invalid option %s for bitrot. Please enter valid "
|
|
|
14f8ab |
@@ -5857,7 +5883,6 @@ cli_cmd_bitrot_parse(const char **words, int wordcount, dict_t **options)
|
|
|
14f8ab |
ret = -1;
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
-
|
|
|
14f8ab |
set_type:
|
|
|
14f8ab |
ret = dict_set_int32(dict, "type", type);
|
|
|
14f8ab |
if (ret < 0)
|
|
|
14f8ab |
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
|
|
|
14f8ab |
index f33fc99..72504ca 100644
|
|
|
14f8ab |
--- a/cli/src/cli-cmd-volume.c
|
|
|
14f8ab |
+++ b/cli/src/cli-cmd-volume.c
|
|
|
14f8ab |
@@ -3236,6 +3236,16 @@ struct cli_cmd bitrot_cmds[] = {
|
|
|
14f8ab |
{"volume bitrot <VOLNAME> {enable|disable}", NULL, /*cli_cmd_bitrot_cbk,*/
|
|
|
14f8ab |
"Enable/disable bitrot for volume <VOLNAME>"},
|
|
|
14f8ab |
|
|
|
14f8ab |
+ {"volume bitrot <VOLNAME> signing-time <time-in-secs>",
|
|
|
14f8ab |
+ NULL, /*cli_cmd_bitrot_cbk,*/
|
|
|
14f8ab |
+ "Waiting time for an object after last fd is closed to start signing "
|
|
|
14f8ab |
+ "process"},
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ {"volume bitrot <VOLNAME> signer-threads <count>",
|
|
|
14f8ab |
+ NULL, /*cli_cmd_bitrot_cbk,*/
|
|
|
14f8ab |
+ "Number of signing process threads. Usually set to number of available "
|
|
|
14f8ab |
+ "cores"},
|
|
|
14f8ab |
+
|
|
|
14f8ab |
{"volume bitrot <VOLNAME> scrub-throttle {lazy|normal|aggressive}",
|
|
|
14f8ab |
NULL, /*cli_cmd_bitrot_cbk,*/
|
|
|
14f8ab |
"Set the speed of the scrubber for volume <VOLNAME>"},
|
|
|
14f8ab |
@@ -3251,6 +3261,8 @@ struct cli_cmd bitrot_cmds[] = {
|
|
|
14f8ab |
"the scrubber. ondemand starts the scrubber immediately."},
|
|
|
14f8ab |
|
|
|
14f8ab |
{"volume bitrot <VOLNAME> {enable|disable}\n"
|
|
|
14f8ab |
+ "volume bitrot <VOLNAME> signing-time <time-in-secs>\n"
|
|
|
14f8ab |
+ "volume bitrot <VOLNAME> signer-threads <count>\n"
|
|
|
14f8ab |
"volume bitrot <volname> scrub-throttle {lazy|normal|aggressive}\n"
|
|
|
14f8ab |
"volume bitrot <volname> scrub-frequency {hourly|daily|weekly|biweekly"
|
|
|
14f8ab |
"|monthly}\n"
|
|
|
14f8ab |
diff --git a/doc/gluster.8 b/doc/gluster.8
|
|
|
14f8ab |
index 66bdb48..084346d 100644
|
|
|
14f8ab |
--- a/doc/gluster.8
|
|
|
14f8ab |
+++ b/doc/gluster.8
|
|
|
14f8ab |
@@ -244,6 +244,12 @@ Use "!<OPTION>" to reset option <OPTION> to default value.
|
|
|
14f8ab |
\fB\ volume bitrot <VOLNAME> {enable|disable} \fR
|
|
|
14f8ab |
Enable/disable bitrot for volume <VOLNAME>
|
|
|
14f8ab |
.TP
|
|
|
14f8ab |
+\fB\ volume bitrot <VOLNAME> signing-time <time-in-secs> \fR
|
|
|
14f8ab |
+Waiting time for an object after last fd is closed to start signing process.
|
|
|
14f8ab |
+.TP
|
|
|
14f8ab |
+\fB\ volume bitrot <VOLNAME> signer-threads <count> \fR
|
|
|
14f8ab |
+Number of signing process threads. Usually set to number of available cores.
|
|
|
14f8ab |
+.TP
|
|
|
14f8ab |
\fB\ volume bitrot <VOLNAME> scrub-throttle {lazy|normal|aggressive} \fR
|
|
|
14f8ab |
Scrub-throttle value is a measure of how fast or slow the scrubber scrubs the filesystem for volume <VOLNAME>
|
|
|
14f8ab |
.TP
|
|
|
14f8ab |
diff --git a/libglusterfs/src/glusterfs/common-utils.h b/libglusterfs/src/glusterfs/common-utils.h
|
|
|
14f8ab |
index 0e2ecc7..f0a0a41 100644
|
|
|
14f8ab |
--- a/libglusterfs/src/glusterfs/common-utils.h
|
|
|
14f8ab |
+++ b/libglusterfs/src/glusterfs/common-utils.h
|
|
|
14f8ab |
@@ -126,6 +126,7 @@ trap(void);
|
|
|
14f8ab |
|
|
|
14f8ab |
/* Default value of signing waiting time to sign a file for bitrot */
|
|
|
14f8ab |
#define SIGNING_TIMEOUT "120"
|
|
|
14f8ab |
+#define BR_WORKERS "4"
|
|
|
14f8ab |
|
|
|
14f8ab |
/* xxhash */
|
|
|
14f8ab |
#define GF_XXH64_DIGEST_LENGTH 8
|
|
|
14f8ab |
diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x
|
|
|
14f8ab |
index a32c864..777cb00 100644
|
|
|
14f8ab |
--- a/rpc/xdr/src/cli1-xdr.x
|
|
|
14f8ab |
+++ b/rpc/xdr/src/cli1-xdr.x
|
|
|
14f8ab |
@@ -68,6 +68,7 @@ enum gf_bitrot_type {
|
|
|
14f8ab |
GF_BITROT_OPTION_TYPE_EXPIRY_TIME,
|
|
|
14f8ab |
GF_BITROT_CMD_SCRUB_STATUS,
|
|
|
14f8ab |
GF_BITROT_CMD_SCRUB_ONDEMAND,
|
|
|
14f8ab |
+ GF_BITROT_OPTION_TYPE_SIGNER_THREADS,
|
|
|
14f8ab |
GF_BITROT_OPTION_TYPE_MAX
|
|
|
14f8ab |
};
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/tests/bitrot/br-signer-threads-config-1797869.t b/tests/bitrot/br-signer-threads-config-1797869.t
|
|
|
14f8ab |
new file mode 100644
|
|
|
14f8ab |
index 0000000..657ef3e
|
|
|
14f8ab |
--- /dev/null
|
|
|
14f8ab |
+++ b/tests/bitrot/br-signer-threads-config-1797869.t
|
|
|
14f8ab |
@@ -0,0 +1,73 @@
|
|
|
14f8ab |
+#!/bin/bash
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+. $(dirname $0)/../include.rc
|
|
|
14f8ab |
+. $(dirname $0)/../volume.rc
|
|
|
14f8ab |
+. $(dirname $0)/../cluster.rc
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+function get_bitd_count_1 {
|
|
|
14f8ab |
+ ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H1 | wc -l
|
|
|
14f8ab |
+}
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+function get_bitd_count_2 {
|
|
|
14f8ab |
+ ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H2 | wc -l
|
|
|
14f8ab |
+}
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+function get_bitd_pid_1 {
|
|
|
14f8ab |
+ ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H1 | awk '{print $2}'
|
|
|
14f8ab |
+}
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+function get_bitd_pid_2 {
|
|
|
14f8ab |
+ ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H2 | awk '{print $2}'
|
|
|
14f8ab |
+}
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+function get_signer_th_count_1 {
|
|
|
14f8ab |
+ ps -eL | grep $(get_bitd_pid_1) | grep glfs_brpobj | wc -l
|
|
|
14f8ab |
+}
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+function get_signer_th_count_2 {
|
|
|
14f8ab |
+ ps -eL | grep $(get_bitd_pid_2) | grep glfs_brpobj | wc -l
|
|
|
14f8ab |
+}
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+cleanup;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+TEST launch_cluster 2
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+TEST $CLI_1 peer probe $H2;
|
|
|
14f8ab |
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+TEST $CLI_1 volume create $V0 $H1:$B1
|
|
|
14f8ab |
+TEST $CLI_1 volume create $V1 $H2:$B2
|
|
|
14f8ab |
+EXPECT 'Created' volinfo_field_1 $V0 'Status';
|
|
|
14f8ab |
+EXPECT 'Created' volinfo_field_1 $V1 'Status';
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+TEST $CLI_1 volume start $V0
|
|
|
14f8ab |
+TEST $CLI_1 volume start $V1
|
|
|
14f8ab |
+EXPECT 'Started' volinfo_field_1 $V0 'Status';
|
|
|
14f8ab |
+EXPECT 'Started' volinfo_field_1 $V1 'Status';
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+#Enable bitrot
|
|
|
14f8ab |
+TEST $CLI_1 volume bitrot $V0 enable
|
|
|
14f8ab |
+TEST $CLI_1 volume bitrot $V1 enable
|
|
|
14f8ab |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_bitd_count_1
|
|
|
14f8ab |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_bitd_count_2
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" get_signer_th_count_1
|
|
|
14f8ab |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" get_signer_th_count_2
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+old_bitd_pid_1=$(get_bitd_pid_1)
|
|
|
14f8ab |
+old_bitd_pid_2=$(get_bitd_pid_2)
|
|
|
14f8ab |
+TEST $CLI_1 volume bitrot $V0 signer-threads 1
|
|
|
14f8ab |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_signer_th_count_1
|
|
|
14f8ab |
+EXPECT_NOT "$old_bitd_pid_1" get_bitd_pid_1;
|
|
|
14f8ab |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" get_signer_th_count_2
|
|
|
14f8ab |
+EXPECT "$old_bitd_pid_2" get_bitd_pid_2;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+old_bitd_pid_1=$(get_bitd_pid_1)
|
|
|
14f8ab |
+old_bitd_pid_2=$(get_bitd_pid_2)
|
|
|
14f8ab |
+TEST $CLI_1 volume bitrot $V1 signer-threads 2
|
|
|
14f8ab |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" get_signer_th_count_2
|
|
|
14f8ab |
+EXPECT_NOT "$old_bitd_pid_2" get_bitd_pid_2;
|
|
|
14f8ab |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_signer_th_count_1
|
|
|
14f8ab |
+EXPECT "$old_bitd_pid_1" get_bitd_pid_1;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+cleanup;
|
|
|
14f8ab |
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
|
|
|
14f8ab |
index 7b1c5dc..b8feef7 100644
|
|
|
14f8ab |
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
|
|
|
14f8ab |
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
|
|
|
14f8ab |
@@ -1734,22 +1734,26 @@ out:
|
|
|
14f8ab |
return 0;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
-/**
|
|
|
14f8ab |
- * Initialize signer specific structures, spawn worker threads.
|
|
|
14f8ab |
- */
|
|
|
14f8ab |
-
|
|
|
14f8ab |
static void
|
|
|
14f8ab |
br_fini_signer(xlator_t *this, br_private_t *priv)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
int i = 0;
|
|
|
14f8ab |
|
|
|
14f8ab |
- for (; i < BR_WORKERS; i++) {
|
|
|
14f8ab |
+ if (priv == NULL)
|
|
|
14f8ab |
+ return;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ for (; i < priv->signer_th_count; i++) {
|
|
|
14f8ab |
(void)gf_thread_cleanup_xint(priv->obj_queue->workers[i]);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
+ GF_FREE(priv->obj_queue->workers);
|
|
|
14f8ab |
|
|
|
14f8ab |
pthread_cond_destroy(&priv->object_cond);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+/**
|
|
|
14f8ab |
+ * Initialize signer specific structures, spawn worker threads.
|
|
|
14f8ab |
+ */
|
|
|
14f8ab |
+
|
|
|
14f8ab |
static int32_t
|
|
|
14f8ab |
br_init_signer(xlator_t *this, br_private_t *priv)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
@@ -1769,7 +1773,12 @@ br_init_signer(xlator_t *this, br_private_t *priv)
|
|
|
14f8ab |
goto cleanup_cond;
|
|
|
14f8ab |
INIT_LIST_HEAD(&priv->obj_queue->objects);
|
|
|
14f8ab |
|
|
|
14f8ab |
- for (i = 0; i < BR_WORKERS; i++) {
|
|
|
14f8ab |
+ priv->obj_queue->workers = GF_CALLOC(
|
|
|
14f8ab |
+ priv->signer_th_count, sizeof(pthread_t), gf_br_mt_br_worker_t);
|
|
|
14f8ab |
+ if (!priv->obj_queue->workers)
|
|
|
14f8ab |
+ goto cleanup_obj_queue;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ for (i = 0; i < priv->signer_th_count; i++) {
|
|
|
14f8ab |
ret = gf_thread_create(&priv->obj_queue->workers[i], NULL,
|
|
|
14f8ab |
br_process_object, this, "brpobj");
|
|
|
14f8ab |
if (ret != 0) {
|
|
|
14f8ab |
@@ -1787,7 +1796,9 @@ cleanup_threads:
|
|
|
14f8ab |
for (i--; i >= 0; i--) {
|
|
|
14f8ab |
(void)gf_thread_cleanup_xint(priv->obj_queue->workers[i]);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
+ GF_FREE(priv->obj_queue->workers);
|
|
|
14f8ab |
|
|
|
14f8ab |
+cleanup_obj_queue:
|
|
|
14f8ab |
GF_FREE(priv->obj_queue);
|
|
|
14f8ab |
|
|
|
14f8ab |
cleanup_cond:
|
|
|
14f8ab |
@@ -1840,7 +1851,7 @@ br_rate_limit_signer(xlator_t *this, int child_count, int numbricks)
|
|
|
14f8ab |
if (contribution == 0)
|
|
|
14f8ab |
contribution = 1;
|
|
|
14f8ab |
spec.rate = BR_HASH_CALC_READ_SIZE * contribution;
|
|
|
14f8ab |
- spec.maxlimit = BR_WORKERS * BR_HASH_CALC_READ_SIZE;
|
|
|
14f8ab |
+ spec.maxlimit = priv->signer_th_count * BR_HASH_CALC_READ_SIZE;
|
|
|
14f8ab |
|
|
|
14f8ab |
#endif
|
|
|
14f8ab |
|
|
|
14f8ab |
@@ -1860,11 +1871,16 @@ br_rate_limit_signer(xlator_t *this, int child_count, int numbricks)
|
|
|
14f8ab |
static int32_t
|
|
|
14f8ab |
br_signer_handle_options(xlator_t *this, br_private_t *priv, dict_t *options)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
- if (options)
|
|
|
14f8ab |
+ if (options) {
|
|
|
14f8ab |
GF_OPTION_RECONF("expiry-time", priv->expiry_time, options, uint32,
|
|
|
14f8ab |
error_return);
|
|
|
14f8ab |
- else
|
|
|
14f8ab |
+ GF_OPTION_RECONF("signer-threads", priv->signer_th_count, options,
|
|
|
14f8ab |
+ uint32, error_return);
|
|
|
14f8ab |
+ } else {
|
|
|
14f8ab |
GF_OPTION_INIT("expiry-time", priv->expiry_time, uint32, error_return);
|
|
|
14f8ab |
+ GF_OPTION_INIT("signer-threads", priv->signer_th_count, uint32,
|
|
|
14f8ab |
+ error_return);
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
|
|
|
14f8ab |
return 0;
|
|
|
14f8ab |
|
|
|
14f8ab |
@@ -1880,6 +1896,8 @@ br_signer_init(xlator_t *this, br_private_t *priv)
|
|
|
14f8ab |
|
|
|
14f8ab |
GF_OPTION_INIT("expiry-time", priv->expiry_time, uint32, error_return);
|
|
|
14f8ab |
GF_OPTION_INIT("brick-count", numbricks, int32, error_return);
|
|
|
14f8ab |
+ GF_OPTION_INIT("signer-threads", priv->signer_th_count, uint32,
|
|
|
14f8ab |
+ error_return);
|
|
|
14f8ab |
|
|
|
14f8ab |
ret = br_rate_limit_signer(this, priv->child_count, numbricks);
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
@@ -2210,6 +2228,15 @@ struct volume_options options[] = {
|
|
|
14f8ab |
.description = "Pause/Resume scrub. Upon resume, scrubber "
|
|
|
14f8ab |
"continues from where it left off.",
|
|
|
14f8ab |
},
|
|
|
14f8ab |
+ {
|
|
|
14f8ab |
+ .key = {"signer-threads"},
|
|
|
14f8ab |
+ .type = GF_OPTION_TYPE_INT,
|
|
|
14f8ab |
+ .default_value = BR_WORKERS,
|
|
|
14f8ab |
+ .op_version = {GD_OP_VERSION_7_0},
|
|
|
14f8ab |
+ .flags = OPT_FLAG_SETTABLE,
|
|
|
14f8ab |
+ .description = "Number of signing process threads. As a best "
|
|
|
14f8ab |
+ "practice, set this to the number of processor cores",
|
|
|
14f8ab |
+ },
|
|
|
14f8ab |
{.key = {NULL}},
|
|
|
14f8ab |
};
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.h b/xlators/features/bit-rot/src/bitd/bit-rot.h
|
|
|
14f8ab |
index a4d4fd7..8ac7dcd 100644
|
|
|
14f8ab |
--- a/xlators/features/bit-rot/src/bitd/bit-rot.h
|
|
|
14f8ab |
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.h
|
|
|
14f8ab |
@@ -30,12 +30,6 @@
|
|
|
14f8ab |
|
|
|
14f8ab |
#include <openssl/sha.h>
|
|
|
14f8ab |
|
|
|
14f8ab |
-/**
|
|
|
14f8ab |
- * TODO: make this configurable. As a best practice, set this to the
|
|
|
14f8ab |
- * number of processor cores.
|
|
|
14f8ab |
- */
|
|
|
14f8ab |
-#define BR_WORKERS 4
|
|
|
14f8ab |
-
|
|
|
14f8ab |
typedef enum scrub_throttle {
|
|
|
14f8ab |
BR_SCRUB_THROTTLE_VOID = -1,
|
|
|
14f8ab |
BR_SCRUB_THROTTLE_LAZY = 0,
|
|
|
14f8ab |
@@ -108,12 +102,12 @@ struct br_child {
|
|
|
14f8ab |
typedef struct br_child br_child_t;
|
|
|
14f8ab |
|
|
|
14f8ab |
struct br_obj_n_workers {
|
|
|
14f8ab |
- struct list_head objects; /* queue of objects expired from the
|
|
|
14f8ab |
- timer wheel and ready to be picked
|
|
|
14f8ab |
- up for signing */
|
|
|
14f8ab |
- pthread_t workers[BR_WORKERS]; /* Threads which pick up the objects
|
|
|
14f8ab |
- from the above queue and start
|
|
|
14f8ab |
- signing each object */
|
|
|
14f8ab |
+ struct list_head objects; /* queue of objects expired from the
|
|
|
14f8ab |
+ timer wheel and ready to be picked
|
|
|
14f8ab |
+ up for signing */
|
|
|
14f8ab |
+ pthread_t *workers; /* Threads which pick up the objects
|
|
|
14f8ab |
+ from the above queue and start
|
|
|
14f8ab |
+ signing each object */
|
|
|
14f8ab |
};
|
|
|
14f8ab |
|
|
|
14f8ab |
struct br_scrubber {
|
|
|
14f8ab |
@@ -209,6 +203,8 @@ struct br_private {
|
|
|
14f8ab |
|
|
|
14f8ab |
uint32_t expiry_time; /* objects "wait" time */
|
|
|
14f8ab |
|
|
|
14f8ab |
+ uint32_t signer_th_count; /* Number of signing process threads */
|
|
|
14f8ab |
+
|
|
|
14f8ab |
tbf_t *tbf; /* token bucket filter */
|
|
|
14f8ab |
|
|
|
14f8ab |
gf_boolean_t iamscrubber; /* function as a fs scrubber */
|
|
|
14f8ab |
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h b/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h
|
|
|
14f8ab |
index 40bcda1..9d93caf 100644
|
|
|
14f8ab |
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h
|
|
|
14f8ab |
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h
|
|
|
14f8ab |
@@ -29,6 +29,7 @@ enum br_mem_types {
|
|
|
14f8ab |
gf_br_stub_mt_sigstub_t,
|
|
|
14f8ab |
gf_br_mt_br_child_event_t,
|
|
|
14f8ab |
gf_br_stub_mt_misc,
|
|
|
14f8ab |
+ gf_br_mt_br_worker_t,
|
|
|
14f8ab |
gf_br_stub_mt_end,
|
|
|
14f8ab |
};
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitrot.c b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
|
|
|
14f8ab |
index c653249..f79af2d 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-bitrot.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
|
|
|
14f8ab |
@@ -34,6 +34,7 @@ const char *gd_bitrot_op_list[GF_BITROT_OPTION_TYPE_MAX] = {
|
|
|
14f8ab |
[GF_BITROT_OPTION_TYPE_SCRUB_FREQ] = "scrub-frequency",
|
|
|
14f8ab |
[GF_BITROT_OPTION_TYPE_SCRUB] = "scrub",
|
|
|
14f8ab |
[GF_BITROT_OPTION_TYPE_EXPIRY_TIME] = "expiry-time",
|
|
|
14f8ab |
+ [GF_BITROT_OPTION_TYPE_SIGNER_THREADS] = "signer-threads",
|
|
|
14f8ab |
};
|
|
|
14f8ab |
|
|
|
14f8ab |
int
|
|
|
14f8ab |
@@ -354,6 +355,81 @@ out:
|
|
|
14f8ab |
return ret;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+static gf_boolean_t
|
|
|
14f8ab |
+is_bitd_configure_noop(xlator_t *this, glusterd_volinfo_t *volinfo)
|
|
|
14f8ab |
+{
|
|
|
14f8ab |
+ gf_boolean_t noop = _gf_true;
|
|
|
14f8ab |
+ glusterd_brickinfo_t *brickinfo = NULL;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ if (!glusterd_is_bitrot_enabled(volinfo))
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ else if (volinfo->status != GLUSTERD_STATUS_STARTED)
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ else {
|
|
|
14f8ab |
+ cds_list_for_each_entry(brickinfo, &volinfo->bricks, brick_list)
|
|
|
14f8ab |
+ {
|
|
|
14f8ab |
+ if (!glusterd_is_local_brick(this, volinfo, brickinfo))
|
|
|
14f8ab |
+ continue;
|
|
|
14f8ab |
+ noop = _gf_false;
|
|
|
14f8ab |
+ return noop;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+out:
|
|
|
14f8ab |
+ return noop;
|
|
|
14f8ab |
+}
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+static int
|
|
|
14f8ab |
+glusterd_bitrot_signer_threads(glusterd_volinfo_t *volinfo, dict_t *dict,
|
|
|
14f8ab |
+ char *key, char **op_errstr)
|
|
|
14f8ab |
+{
|
|
|
14f8ab |
+ int32_t ret = -1;
|
|
|
14f8ab |
+ uint32_t signer_th_count = 0;
|
|
|
14f8ab |
+ uint32_t existing_th_count = 0;
|
|
|
14f8ab |
+ xlator_t *this = NULL;
|
|
|
14f8ab |
+ glusterd_conf_t *priv = NULL;
|
|
|
14f8ab |
+ char dkey[32] = {
|
|
|
14f8ab |
+ 0,
|
|
|
14f8ab |
+ };
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ this = THIS;
|
|
|
14f8ab |
+ GF_ASSERT(this);
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ priv = this->private;
|
|
|
14f8ab |
+ GF_VALIDATE_OR_GOTO(this->name, priv, out);
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ ret = dict_get_uint32(dict, "signer-threads", &signer_th_count);
|
|
|
14f8ab |
+ if (ret) {
|
|
|
14f8ab |
+ gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
|
|
|
14f8ab |
+ "Unable to get bitrot signer thread count.");
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ ret = dict_get_uint32(volinfo->dict, key, &existing_th_count);
|
|
|
14f8ab |
+ if (ret == 0 && signer_th_count == existing_th_count) {
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ snprintf(dkey, sizeof(dkey), "%d", signer_th_count);
|
|
|
14f8ab |
+ ret = dict_set_dynstr_with_alloc(volinfo->dict, key, dkey);
|
|
|
14f8ab |
+ if (ret) {
|
|
|
14f8ab |
+ gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
|
|
|
14f8ab |
+ "Failed to set option %s", key);
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ if (!is_bitd_configure_noop(this, volinfo)) {
|
|
|
14f8ab |
+ ret = priv->bitd_svc.manager(&(priv->bitd_svc), NULL,
|
|
|
14f8ab |
+ PROC_START_NO_WAIT);
|
|
|
14f8ab |
+ if (ret) {
|
|
|
14f8ab |
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_BITDSVC_RECONF_FAIL,
|
|
|
14f8ab |
+ "Failed to reconfigure bitrot services");
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+out:
|
|
|
14f8ab |
+ return ret;
|
|
|
14f8ab |
+}
|
|
|
14f8ab |
+
|
|
|
14f8ab |
static int
|
|
|
14f8ab |
glusterd_bitrot_enable(glusterd_volinfo_t *volinfo, char **op_errstr)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
@@ -594,6 +670,15 @@ glusterd_op_bitrot(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
|
|
|
14f8ab |
volinfo, dict, "features.expiry-time", op_errstr);
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
+ break;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ case GF_BITROT_OPTION_TYPE_SIGNER_THREADS:
|
|
|
14f8ab |
+ ret = glusterd_bitrot_signer_threads(
|
|
|
14f8ab |
+ volinfo, dict, "features.signer-threads", op_errstr);
|
|
|
14f8ab |
+ if (ret)
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ break;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
case GF_BITROT_CMD_SCRUB_STATUS:
|
|
|
14f8ab |
case GF_BITROT_CMD_SCRUB_ONDEMAND:
|
|
|
14f8ab |
break;
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
14f8ab |
index 13f84ea..094a71f 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
14f8ab |
@@ -4658,6 +4658,12 @@ bitrot_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
|
|
|
14f8ab |
return -1;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+ if (!strcmp(vme->option, "signer-threads")) {
|
|
|
14f8ab |
+ ret = xlator_set_fixed_option(xl, "signer-threads", vme->value);
|
|
|
14f8ab |
+ if (ret)
|
|
|
14f8ab |
+ return -1;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
return ret;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
@@ -4940,18 +4946,18 @@ glusterd_prepare_shd_volume_options_for_tier(glusterd_volinfo_t *volinfo,
|
|
|
14f8ab |
dict_t *set_dict)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
int ret = -1;
|
|
|
14f8ab |
- char *key = NULL;
|
|
|
14f8ab |
+ char *key = NULL;
|
|
|
14f8ab |
|
|
|
14f8ab |
- key = volgen_get_shd_key (volinfo->tier_info.cold_type);
|
|
|
14f8ab |
+ key = volgen_get_shd_key(volinfo->tier_info.cold_type);
|
|
|
14f8ab |
if (key) {
|
|
|
14f8ab |
- ret = dict_set_str (set_dict, key, "enable");
|
|
|
14f8ab |
+ ret = dict_set_str(set_dict, key, "enable");
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- key = volgen_get_shd_key (volinfo->tier_info.hot_type);
|
|
|
14f8ab |
+ key = volgen_get_shd_key(volinfo->tier_info.hot_type);
|
|
|
14f8ab |
if (key) {
|
|
|
14f8ab |
- ret = dict_set_str (set_dict, key, "enable");
|
|
|
14f8ab |
+ ret = dict_set_str(set_dict, key, "enable");
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
14f8ab |
index 9001b88..62acadf 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
14f8ab |
@@ -3379,6 +3379,15 @@ struct volopt_map_entry glusterd_volopt_map[] = {
|
|
|
14f8ab |
.op_version = GD_OP_VERSION_3_7_0,
|
|
|
14f8ab |
.type = NO_DOC,
|
|
|
14f8ab |
},
|
|
|
14f8ab |
+ {
|
|
|
14f8ab |
+ .key = "features.signer-threads",
|
|
|
14f8ab |
+ .voltype = "features/bit-rot",
|
|
|
14f8ab |
+ .value = BR_WORKERS,
|
|
|
14f8ab |
+ .option = "signer-threads",
|
|
|
14f8ab |
+ .op_version = GD_OP_VERSION_7_0,
|
|
|
14f8ab |
+ .type = NO_DOC,
|
|
|
14f8ab |
+ },
|
|
|
14f8ab |
+ /* Upcall translator options */
|
|
|
14f8ab |
/* Upcall translator options */
|
|
|
14f8ab |
{
|
|
|
14f8ab |
.key = "features.cache-invalidation",
|
|
|
14f8ab |
--
|
|
|
14f8ab |
1.8.3.1
|
|
|
14f8ab |
|