summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2015-11-01 10:22:00 -0500
committerDan Lambright <dlambrig@redhat.com>2015-11-07 10:30:22 -0800
commit06630972e786c205a485693f66039cd9bb10dc9d (patch)
tree598701dc560c971709d72bb4a778ea550e4ba241 /tests
parenta88859127fbdebadb2895fb3d28eba3091c17cca (diff)
cluster/tier correct promotion cycle calculation
The tier translator should only choose candidate files for promotion from the most recent cycle, not a multiple of the most recent cycles. Otherwise user observed behavior can be inconsistent. Remove related test in tier.t that is subject to race condition. Change-Id: I9ad1523cac00f904097ce468efa6ddd515857024 BUG: 1275524 Signed-off-by: root <root@rhs-cli-15.gdev.lab.eng.bos.redhat.com> Signed-off-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/12480 Reviewed-by: Joseph Fernandes Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/basic/tier/legacy-many.t19
-rwxr-xr-xtests/basic/tier/tier.t17
-rw-r--r--tests/tier.rc13
3 files changed, 30 insertions, 19 deletions
diff --git a/tests/basic/tier/legacy-many.t b/tests/basic/tier/legacy-many.t
index 2c7ff3e5407..6e1147aec2d 100644
--- a/tests/basic/tier/legacy-many.t
+++ b/tests/basic/tier/legacy-many.t
@@ -9,13 +9,12 @@ LAST_BRICK=3
CACHE_BRICK_FIRST=4
CACHE_BRICK_LAST=5
DEMOTE_TIMEOUT=12
-PROMOTE_TIMEOUT=5
+PROMOTE_TIMEOUT=12
MIGRATION_TIMEOUT=10
DEMOTE_FREQ=60
-PROMOTE_FREQ=4
+PROMOTE_FREQ=10
TEST_DIR="test_files"
-NUM_FILES=20
-
+NUM_FILES=15
function read_all {
for file in *
@@ -49,19 +48,25 @@ wait
TEST $CLI volume attach-tier $V0 replica 2 $H0:$B0/${V0}$CACHE_BRICK_FIRST $H0:$B0/${V0}$CACHE_BRICK_LAST
TEST $CLI volume rebalance $V0 tier status
+
TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
TEST $CLI volume set $V0 cluster.read-freq-threshold 0
TEST $CLI volume set $V0 cluster.write-freq-threshold 0
+# wait a little for lookup heal to finish
+sleep 10
+
# Read "legacy" files
drop_cache $M0
-cd ${TEST_DIR}
+
+sleep_until_mid_cycle $DEMOTE_FREQ
+
TEST read_all
# Test to make sure files were promoted as expected
-sleep $DEMOTE_TIMEOUT
-EXPECT_WITHIN $DEMOTE_TIMEOUT "0" check_counters $NUM_FILES 0
+sleep $PROMOTE_TIMEOUT
+EXPECT_WITHIN $PROMOTE_TIMEOUT "0" check_counters $NUM_FILES 0
cd;
cleanup
diff --git a/tests/basic/tier/tier.t b/tests/basic/tier/tier.t
index f38aa898c11..a197d6eb127 100755
--- a/tests/basic/tier/tier.t
+++ b/tests/basic/tier/tier.t
@@ -11,15 +11,7 @@ DEMOTE_TIMEOUT=12
PROMOTE_TIMEOUT=5
MIGRATION_TIMEOUT=10
DEMOTE_FREQ=4
-PROMOTE_FREQ=4
-
-
-# Timing adjustment to avoid spurious errors with first instances of file_on_fast_tier
-function sleep_first_cycle {
- startTime=$(date +%s)
- mod=$(( ( $startTime % $DEMOTE_FREQ ) + 1 ))
- sleep $mod
-}
+PROMOTE_FREQ=12
function file_on_slow_tier {
@@ -127,7 +119,7 @@ TEST $CLI volume start $V0
TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
cd $M0
-sleep_first_cycle
+sleep_first_cycle $DEMOTE_FREQ
$CLI volume tier $V0 status
#Tier options expect non-negative value
@@ -176,10 +168,11 @@ sleep $DEMOTE_TIMEOUT
UUID=$(uuidgen)
echo $UUID >> /tmp/d1/data2.txt
md5data2=$(fingerprint /tmp/d1/data2.txt)
-echo $UUID >> ./d1/data2.txt
-# Check promotion on read to slow tier
+sleep_until_mid_cycle $DEMOTE_FREQ
drop_cache $M0
+
+echo $UUID >> ./d1/data2.txt
cat "./d1/$SPACE_FILE"
sleep $PROMOTE_TIMEOUT
diff --git a/tests/tier.rc b/tests/tier.rc
index 3fa6af6a40f..4fd24de0659 100644
--- a/tests/tier.rc
+++ b/tests/tier.rc
@@ -99,3 +99,16 @@ function confirm_vol_stopped {
fi
}
+
+function sleep_first_cycle {
+ startTime=$(date +%s)
+ mod=$(( ( $startTime % $1 ) + 1 ))
+ sleep $mod
+}
+
+function sleep_until_mid_cycle {
+ startTime=$(date +%s)
+ mod=$(( ( $startTime % $1 ) + 1 ))
+ mod=$(( $mod + $1 / 2 ))
+ sleep $mod
+}