From 8fad76650bd85463708f59d2518f5b764ae4c702 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Mon, 3 Feb 2020 18:10:17 +0530 Subject: bitrot: Make number of signer threads configurable The number of signing process threads (glfs_brpobj) is set to 4 by default. The recommendation is to set it to number of cores available. This patch makes it configurable as follows gluster vol bitrot signer-threads fixes: bz#1797869 Change-Id: Ia883b3e5e34e0bc8d095243508d320c9c9c58adc Signed-off-by: Kotresh HR --- tests/bitrot/br-signer-threads-config-1797869.t | 73 +++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 tests/bitrot/br-signer-threads-config-1797869.t (limited to 'tests/bitrot') diff --git a/tests/bitrot/br-signer-threads-config-1797869.t b/tests/bitrot/br-signer-threads-config-1797869.t new file mode 100644 index 00000000000..657ef3eedaf --- /dev/null +++ b/tests/bitrot/br-signer-threads-config-1797869.t @@ -0,0 +1,73 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../cluster.rc + +function get_bitd_count_1 { + ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H1 | wc -l +} + +function get_bitd_count_2 { + ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H2 | wc -l +} + +function get_bitd_pid_1 { + ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H1 | awk '{print $2}' +} + +function get_bitd_pid_2 { + ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H2 | awk '{print $2}' +} + +function get_signer_th_count_1 { + ps -eL | grep $(get_bitd_pid_1) | grep glfs_brpobj | wc -l +} + +function get_signer_th_count_2 { + ps -eL | grep $(get_bitd_pid_2) | grep glfs_brpobj | wc -l +} + +cleanup; + +TEST launch_cluster 2 + +TEST $CLI_1 peer probe $H2; +EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count; + +TEST $CLI_1 volume create $V0 $H1:$B1 +TEST $CLI_1 volume create $V1 $H2:$B2 +EXPECT 'Created' volinfo_field_1 $V0 'Status'; +EXPECT 'Created' volinfo_field_1 $V1 'Status'; + +TEST $CLI_1 volume start $V0 +TEST $CLI_1 volume start $V1 +EXPECT 'Started' volinfo_field_1 $V0 'Status'; +EXPECT 'Started' volinfo_field_1 $V1 'Status'; + +#Enable bitrot +TEST $CLI_1 volume bitrot $V0 enable +TEST $CLI_1 volume bitrot $V1 enable +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_bitd_count_1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_bitd_count_2 + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" get_signer_th_count_1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" get_signer_th_count_2 + +old_bitd_pid_1=$(get_bitd_pid_1) +old_bitd_pid_2=$(get_bitd_pid_2) +TEST $CLI_1 volume bitrot $V0 signer-threads 1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_signer_th_count_1 +EXPECT_NOT "$old_bitd_pid_1" get_bitd_pid_1; +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" get_signer_th_count_2 +EXPECT "$old_bitd_pid_2" get_bitd_pid_2; + +old_bitd_pid_1=$(get_bitd_pid_1) +old_bitd_pid_2=$(get_bitd_pid_2) +TEST $CLI_1 volume bitrot $V1 signer-threads 2 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" get_signer_th_count_2 +EXPECT_NOT "$old_bitd_pid_2" get_bitd_pid_2; +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_signer_th_count_1 +EXPECT "$old_bitd_pid_1" get_bitd_pid_1; + +cleanup; -- cgit