summaryrefslogtreecommitdiffstats
path: root/tests/bugs/cli/bug-1320388.t
blob: f5ffcbe082ab2bd0dcfc9f8fc090aaf862fe0663 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash

. $(dirname $0)/../../include.rc
. $(dirname $0)/../../volume.rc

# This test enables management ssl and then test the
# heal info command.

for d in /etc/ssl /etc/openssl /usr/local/etc/openssl ; do
        if test -d $d ; then
                SSL_BASE=$d
                break
        fi
done

SSL_KEY=$SSL_BASE/glusterfs.key
SSL_CERT=$SSL_BASE/glusterfs.pem
SSL_CA=$SSL_BASE/glusterfs.ca

cleanup;
rm -f $SSL_BASE/glusterfs.*
touch "$GLUSTERD_WORKDIR"/secure-access

TEST openssl genrsa -out $SSL_KEY 1024
TEST openssl req -new -x509 -key $SSL_KEY -subj /CN=Anyone -out $SSL_CERT
ln $SSL_CERT $SSL_CA

TEST glusterd
TEST pidof glusterd
TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5}
TEST $CLI volume set $V0 disperse.eager-lock off
TEST $CLI volume set $V0 disperse.other-eager-lock off
TEST $CLI volume start $V0
TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0
EXPECT_WITHIN $CHILD_UP_TIMEOUT "^6$" ec_child_up_count $V0 0
touch $M0/a
TEST kill_brick $V0 $H0 $B0/${V0}5
echo abc > $M0/a
EXPECT_WITHIN  $HEAL_TIMEOUT "^5$" get_pending_heal_count $V0 #One for each active brick
$CLI volume start $V0 force
EXPECT_WITHIN $CHILD_UP_TIMEOUT "^6$" ec_child_up_count $V0 0
TEST gluster volume heal $V0 info
EXPECT_WITHIN  $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0 #One for each active brick
cleanup;
mp;id=b97e8f4ef649ed825b4f02b74e33946f6b551cec'>xlators/features/changelog/src/changelog.c parenta9cdfa3072f60171a97d9f6af6988b179d45747f (diff)
feature/changelog: Add timeout to changelog barrier.
This patch introduces configurable 'changelog-barrier-timeout' in changelog. The default changelog-barrier-timeout is set to 120 sec which is same as barrier-timeout of barrier translator. On this timeout, all the barriered fops are unbarriered. It is safe to have this internal timeout for changelog barrier to prevent it from indefinite barrierring of fops if barrier disable notification does not come from snapshot for some reason. Change-Id: Iad07807935f88222cdefcd46312b4b6579186dce BUG: 1094226 Signed-off-by: Kotresh H R <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/7669 Reviewed-by: Kaushal M <kaushal@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Tested-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/features/changelog/src/changelog.c')
-rw-r--r--xlators/features/changelog/src/changelog.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c
index 0b982148f44..4ed7cc7f0e9 100644
--- a/xlators/features/changelog/src/changelog.c
+++ b/xlators/features/changelog/src/changelog.c
@@ -1281,6 +1281,16 @@ changelog_assign_encoding (changelog_priv_t *priv, char *enc)
}
}
+static void
+changelog_assign_barrier_timeout(changelog_priv_t *priv, uint32_t timeout)
+{
+ LOCK (&priv->lock);
+ {
+ priv->timeout.tv_sec = timeout;
+ }
+ UNLOCK (&priv->lock);
+}
+
/* cleanup any helper threads that are running */
static void
changelog_cleanup_helper_threads (xlator_t *this, changelog_priv_t *priv)
@@ -1444,9 +1454,7 @@ notify (xlator_t *this, int event, void *data, ...)
if (event == GF_EVENT_TRANSLATOR_OP) {
dict = data;
- /*TODO: Also barrier option is persistent. Need to
- * decide on the brick crash scenarios.
- */
+
barrier = dict_get_str_boolean (dict, "barrier", DICT_DEFAULT);
switch (barrier) {
@@ -1540,9 +1548,14 @@ notify (xlator_t *this, int event, void *data, ...)
/* Start changelog barrier */
LOCK (&priv->lock);
{
- priv->barrier_enabled = _gf_true;
+ ret = __chlog_barrier_enable (this, priv);
}
UNLOCK (&priv->lock);
+ if (ret == -1) {
+ changelog_barrier_cleanup (this, priv, &queue);
+ goto out;
+ }
+
gf_log(this->name, GF_LOG_DEBUG,
"Enabled changelog barrier");
@@ -1786,6 +1799,7 @@ reconfigure (xlator_t *this, dict_t *options)
changelog_log_data_t cld = {0,};
char htime_dir[PATH_MAX] = {0,};
struct timeval tv = {0,};
+ uint32_t timeout = 0;
priv = this->private;
if (!priv)
@@ -1840,6 +1854,9 @@ reconfigure (xlator_t *this, dict_t *options)
priv->rollover_time, options, int32, out);
GF_OPTION_RECONF ("fsync-interval",
priv->fsync_interval, options, int32, out);
+ GF_OPTION_RECONF ("changelog-barrier-timeout",
+ timeout, options, time, out);
+ changelog_assign_barrier_timeout (priv, timeout);
if (active_now || active_earlier) {
ret = changelog_fill_rollover_data (&cld, !active_now);
@@ -1898,6 +1915,7 @@ init (xlator_t *this)
changelog_priv_t *priv = NULL;
gf_boolean_t cond_lock_init = _gf_false;
char htime_dir[PATH_MAX] = {0,};
+ uint32_t timeout = 0;
GF_VALIDATE_OR_GOTO ("changelog", this, out);
@@ -1977,6 +1995,8 @@ init (xlator_t *this)
GF_OPTION_INIT ("rollover-time", priv->rollover_time, int32, out);
GF_OPTION_INIT ("fsync-interval", priv->fsync_interval, int32, out);
+ GF_OPTION_INIT ("changelog-barrier-timeout", timeout, time, out);
+ priv->timeout.tv_sec = timeout;
changelog_encode_change(priv);
@@ -2127,6 +2147,14 @@ struct volume_options options[] = {
.description = "do not open CHANGELOG file with O_SYNC mode."
" instead perform fsync() at specified intervals"
},
+ { .key = {"changelog-barrier-timeout"},
+ .type = GF_OPTION_TYPE_TIME,
+ .default_value = BARRIER_TIMEOUT,
+ .description = "After 'timeout' seconds since the time 'barrier' "
+ "option was set to \"on\", unlink/rmdir/rename "
+ "operations are no longer blocked and previously "
+ "blocked fops are allowed to go through"
+ },
{.key = {NULL}
},
};