From 9423bc2223227661453a8afd5ab940048abeb008 Mon Sep 17 00:00:00 2001 From: Shreyas Siravara Date: Thu, 7 Sep 2017 16:27:09 -0700 Subject: cluster/afr: Set AFR UP message as soon as quorum is obtained. Summary: AFR currently waits for all children to respond before sending an UP message. This means that one dead host cal cause us to wait a TCP timeout (2 mins!) before declaring the volume up. Now we send an UP as soon as quorum is obtained. This is a port of D4701919 to 3.8. Reviewed By: sshreyas Change-Id: I642d4eb7dc7e0b289e89b7a16abf99a3f98aa8b3 Reviewed-on: https://review.gluster.org/18231 Smoke: Gluster Build System Reviewed-by: Shreyas Siravara CentOS-regression: Gluster Build System --- tests/basic/afr-early-up.t | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 tests/basic/afr-early-up.t (limited to 'tests/basic') diff --git a/tests/basic/afr-early-up.t b/tests/basic/afr-early-up.t new file mode 100644 index 00000000000..703855f4fac --- /dev/null +++ b/tests/basic/afr-early-up.t @@ -0,0 +1,62 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../dht.rc + +function mount_gluster () +{ + local host=$1 + local volume=$2 + local mount=$3 + local timeout=$4 + + if ! glusterfs -s $host --volfile-id $volume $mount; then + echo "N" + return + fi + + if ! timeout -s 9 $timeout stat $mount; then + echo "N" + return + fi + + echo "Y" +} + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{1,2,3}; + +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; +EXPECT '3' brick_count $V0 + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +BRICKPORT=$(pgrep -fl glusterfsd | head -n1 | sed 's/^.*listen-port=//') + +TEST $CLI volume set $V0 cluster.quorum-type auto +EXPECT auto volume_option $V0 cluster.quorum-type + +# Use iptables to block access to one of the brick ports. +BRICKPORT=$(pgrep -fla glusterfsd | head -n1 | sed 's/^.*listen-port=//') +iptables -A INPUT -p tcp --dport $BRICKPORT -j DROP +ip6tables -A INPUT -p tcp --dport $BRICKPORT -j DROP + +# Should still be able to mount within 10 seconds even though brick is +# unreachable. +EXPECT "Y" mount_gluster $H0 $V0 $M0 10 + +# Mount should be writable (we should have quorum) +TEST dd if=/dev/zero of=$M0/test.out bs=128K count=1 conv=fsync + +iptables -D INPUT -p tcp --dport $BRICKPORT -j DROP +ip6tables -D INPUT -p tcp --dport $BRICKPORT -j DROP + +cleanup; -- cgit