|
|
256ebe |
From 06adac5dbac7b2067232270cbee12931400f7824 Mon Sep 17 00:00:00 2001
|
|
|
256ebe |
From: Hari Gowtham <hgowtham@redhat.com>
|
|
|
256ebe |
Date: Sat, 6 Apr 2019 17:00:47 +0530
|
|
|
256ebe |
Subject: [PATCH 086/124] Revert "tiering: remove the translator from build and
|
|
|
256ebe |
glusterd"
|
|
|
256ebe |
|
|
|
256ebe |
This reverts commit 55a6ba56bea9ec0d3316c005300c514ea3ab0e54.
|
|
|
256ebe |
Add the test files and glusterd related changes.
|
|
|
256ebe |
|
|
|
256ebe |
Label: DOWNSTREAM ONLY
|
|
|
256ebe |
|
|
|
256ebe |
Change-Id: Ib704b7142a82cb1e94538a48af916730992a5701
|
|
|
256ebe |
Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
|
|
|
256ebe |
Reviewed-on: https://code.engineering.redhat.com/gerrit/166246
|
|
|
256ebe |
Reviewed-by: Sanju Rakonde <srakonde@redhat.com>
|
|
|
256ebe |
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
|
|
|
256ebe |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
256ebe |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
256ebe |
---
|
|
|
256ebe |
MAINTAINERS | 18 +
|
|
|
256ebe |
tests/basic/afr/granular-esh/cli.t | 30 +-
|
|
|
256ebe |
...1214222-directories_missing_after_attach_tier.t | 61 ++
|
|
|
256ebe |
...60185-donot-allow-detach-commit-unnecessarily.t | 47 ++
|
|
|
256ebe |
tests/basic/tier/ctr-rename-overwrite.t | 50 ++
|
|
|
256ebe |
tests/basic/tier/file_lock.c | 72 ++
|
|
|
256ebe |
tests/basic/tier/file_with_spaces.t | 71 ++
|
|
|
256ebe |
tests/basic/tier/fops-during-migration-pause.t | 89 +++
|
|
|
256ebe |
tests/basic/tier/fops-during-migration.t | 105 +++
|
|
|
256ebe |
tests/basic/tier/frequency-counters.t | 82 +++
|
|
|
256ebe |
tests/basic/tier/legacy-many.t | 92 +++
|
|
|
256ebe |
tests/basic/tier/locked_file_migration.t | 80 +++
|
|
|
256ebe |
tests/basic/tier/new-tier-cmds.t | 129 ++++
|
|
|
256ebe |
tests/basic/tier/readdir-during-migration.t | 65 ++
|
|
|
256ebe |
tests/basic/tier/record-metadata-heat.t | 106 +++
|
|
|
256ebe |
tests/basic/tier/tier-heald.t | 98 +++
|
|
|
256ebe |
tests/basic/tier/tier-snapshot.t | 47 ++
|
|
|
256ebe |
tests/basic/tier/tier.t | 219 +++++++
|
|
|
256ebe |
tests/basic/tier/tier_lookup_heal.t | 69 ++
|
|
|
256ebe |
tests/basic/tier/tierd_check.t | 128 ++++
|
|
|
256ebe |
tests/basic/tier/unlink-during-migration.t | 92 +++
|
|
|
256ebe |
...03028-Rebalance-glusterd-rpc-connection-issue.t | 78 +++
|
|
|
256ebe |
tests/bugs/quota/bug-1288474.t | 51 ++
|
|
|
256ebe |
.../bug-1290965-detect-bitrotten-objects.t | 53 ++
|
|
|
256ebe |
.../tier/bug-1205545-CTR-and-trash-integration.t | 72 ++
|
|
|
256ebe |
tests/bugs/tier/bug-1279376-rename-demoted-file.t | 93 +++
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-volgen.c | 75 +++
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 723 +++++++++++++++++++++
|
|
|
256ebe |
28 files changed, 2894 insertions(+), 1 deletion(-)
|
|
|
256ebe |
create mode 100755 tests/basic/tier/bug-1214222-directories_missing_after_attach_tier.t
|
|
|
256ebe |
create mode 100644 tests/basic/tier/bug-1260185-donot-allow-detach-commit-unnecessarily.t
|
|
|
256ebe |
create mode 100755 tests/basic/tier/ctr-rename-overwrite.t
|
|
|
256ebe |
create mode 100644 tests/basic/tier/file_lock.c
|
|
|
256ebe |
create mode 100755 tests/basic/tier/file_with_spaces.t
|
|
|
256ebe |
create mode 100755 tests/basic/tier/fops-during-migration-pause.t
|
|
|
256ebe |
create mode 100755 tests/basic/tier/fops-during-migration.t
|
|
|
256ebe |
create mode 100644 tests/basic/tier/frequency-counters.t
|
|
|
256ebe |
create mode 100644 tests/basic/tier/legacy-many.t
|
|
|
256ebe |
create mode 100755 tests/basic/tier/locked_file_migration.t
|
|
|
256ebe |
create mode 100644 tests/basic/tier/new-tier-cmds.t
|
|
|
256ebe |
create mode 100644 tests/basic/tier/readdir-during-migration.t
|
|
|
256ebe |
create mode 100755 tests/basic/tier/record-metadata-heat.t
|
|
|
256ebe |
create mode 100644 tests/basic/tier/tier-heald.t
|
|
|
256ebe |
create mode 100644 tests/basic/tier/tier-snapshot.t
|
|
|
256ebe |
create mode 100755 tests/basic/tier/tier.t
|
|
|
256ebe |
create mode 100755 tests/basic/tier/tier_lookup_heal.t
|
|
|
256ebe |
create mode 100644 tests/basic/tier/tierd_check.t
|
|
|
256ebe |
create mode 100755 tests/basic/tier/unlink-during-migration.t
|
|
|
256ebe |
create mode 100644 tests/bugs/glusterd/bug-1303028-Rebalance-glusterd-rpc-connection-issue.t
|
|
|
256ebe |
create mode 100755 tests/bugs/quota/bug-1288474.t
|
|
|
256ebe |
create mode 100644 tests/bugs/replicate/bug-1290965-detect-bitrotten-objects.t
|
|
|
256ebe |
create mode 100644 tests/bugs/tier/bug-1205545-CTR-and-trash-integration.t
|
|
|
256ebe |
create mode 100755 tests/bugs/tier/bug-1279376-rename-demoted-file.t
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/MAINTAINERS b/MAINTAINERS
|
|
|
256ebe |
index b1fc0ee..1f4c93a 100644
|
|
|
256ebe |
--- a/MAINTAINERS
|
|
|
256ebe |
+++ b/MAINTAINERS
|
|
|
256ebe |
@@ -103,6 +103,12 @@ P: Kotresh HR <khiremat@redhat.com>
|
|
|
256ebe |
S: Maintained
|
|
|
256ebe |
F: xlators/features/changelog/
|
|
|
256ebe |
|
|
|
256ebe |
+Changetimerecorder
|
|
|
256ebe |
+M: Shyamsundar Ranganathan <srangana@redhat.com>
|
|
|
256ebe |
+P: Hari Gowtham <hgowtham@redhat.com>
|
|
|
256ebe |
+S: Maintained
|
|
|
256ebe |
+F: xlators/features/changetimerecorder/
|
|
|
256ebe |
+
|
|
|
256ebe |
Decompounder
|
|
|
256ebe |
M: Krutika Dhananjay <kdhananj@redhat.com>
|
|
|
256ebe |
P: Pranith Karampuri <pkarampu@redhat.com>
|
|
|
256ebe |
@@ -248,6 +254,12 @@ P: Xavier Hernandez <xhernandez@redhat.com>
|
|
|
256ebe |
S: Maintained
|
|
|
256ebe |
F: xlators/features/shard/
|
|
|
256ebe |
|
|
|
256ebe |
+Tiering
|
|
|
256ebe |
+M: Shyamsundar Ranganathan <srangana@redhat.com>
|
|
|
256ebe |
+P: Hari Gowtham <hgowtham@redhat.com>
|
|
|
256ebe |
+S: Maintained
|
|
|
256ebe |
+F: xlators/cluster/dht/src/tier.c
|
|
|
256ebe |
+
|
|
|
256ebe |
Trash
|
|
|
256ebe |
M: Anoop C S <anoopcs@redhat.com>
|
|
|
256ebe |
M: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
256ebe |
@@ -327,6 +339,12 @@ P: Soumya Koduri <skoduri@redhat.com>
|
|
|
256ebe |
S: Maintained
|
|
|
256ebe |
F: api/
|
|
|
256ebe |
|
|
|
256ebe |
+libgfdb
|
|
|
256ebe |
+M: Shyamsundar Ranganathan <srangana@redhat.com>
|
|
|
256ebe |
+P: Hari Gowtham <hgowtham@redhat.com>
|
|
|
256ebe |
+S: Maintained
|
|
|
256ebe |
+F: libglusterfs/src/gfdb/
|
|
|
256ebe |
+
|
|
|
256ebe |
libglusterfs
|
|
|
256ebe |
M: Amar Tumballi <amarts@redhat.com>
|
|
|
256ebe |
M: Jeff Darcy <jeff@pl.atyp.us>
|
|
|
256ebe |
diff --git a/tests/basic/afr/granular-esh/cli.t b/tests/basic/afr/granular-esh/cli.t
|
|
|
256ebe |
index 10b6c63..995d93e 100644
|
|
|
256ebe |
--- a/tests/basic/afr/granular-esh/cli.t
|
|
|
256ebe |
+++ b/tests/basic/afr/granular-esh/cli.t
|
|
|
256ebe |
@@ -11,7 +11,7 @@ TESTS_EXPECTED_IN_LOOP=4
|
|
|
256ebe |
TEST glusterd
|
|
|
256ebe |
TEST pidof glusterd
|
|
|
256ebe |
|
|
|
256ebe |
-TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2}
|
|
|
256ebe |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
|
|
|
256ebe |
# Test that enabling the option should work on a newly created volume
|
|
|
256ebe |
TEST $CLI volume set $V0 cluster.granular-entry-heal on
|
|
|
256ebe |
TEST $CLI volume set $V0 cluster.granular-entry-heal off
|
|
|
256ebe |
@@ -25,6 +25,34 @@ TEST $CLI volume start $V1
|
|
|
256ebe |
TEST ! $CLI volume heal $V1 granular-entry-heal enable
|
|
|
256ebe |
TEST ! $CLI volume heal $V1 granular-entry-heal disable
|
|
|
256ebe |
|
|
|
256ebe |
+#######################
|
|
|
256ebe |
+###### TIER TEST ######
|
|
|
256ebe |
+#######################
|
|
|
256ebe |
+# Execute the same command on a disperse + replicate tiered volume and make
|
|
|
256ebe |
+# sure the option is set on the replicate leg of the volume
|
|
|
256ebe |
+TEST $CLI volume tier $V1 attach replica 2 $H0:$B0/${V1}{3,4}
|
|
|
256ebe |
+TEST $CLI volume heal $V1 granular-entry-heal enable
|
|
|
256ebe |
+EXPECT "enable" volume_get_field $V1 cluster.granular-entry-heal
|
|
|
256ebe |
+TEST $CLI volume heal $V1 granular-entry-heal disable
|
|
|
256ebe |
+EXPECT "disable" volume_get_field $V1 cluster.granular-entry-heal
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Kill a disperse brick and make heal be pending on the volume.
|
|
|
256ebe |
+TEST kill_brick $V1 $H0 $B0/${V1}0
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Now make sure that one offline brick in disperse does not affect enabling the
|
|
|
256ebe |
+# option on the volume.
|
|
|
256ebe |
+TEST $CLI volume heal $V1 granular-entry-heal enable
|
|
|
256ebe |
+EXPECT "enable" volume_get_field $V1 cluster.granular-entry-heal
|
|
|
256ebe |
+TEST $CLI volume heal $V1 granular-entry-heal disable
|
|
|
256ebe |
+EXPECT "disable" volume_get_field $V1 cluster.granular-entry-heal
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Now kill a replicate brick.
|
|
|
256ebe |
+TEST kill_brick $V1 $H0 $B0/${V1}3
|
|
|
256ebe |
+# Now make sure that one offline brick in replicate causes the command to be
|
|
|
256ebe |
+# failed.
|
|
|
256ebe |
+TEST ! $CLI volume heal $V1 granular-entry-heal enable
|
|
|
256ebe |
+EXPECT "disable" volume_get_field $V1 cluster.granular-entry-heal
|
|
|
256ebe |
+
|
|
|
256ebe |
######################
|
|
|
256ebe |
### REPLICATE TEST ###
|
|
|
256ebe |
######################
|
|
|
256ebe |
diff --git a/tests/basic/tier/bug-1214222-directories_missing_after_attach_tier.t b/tests/basic/tier/bug-1214222-directories_missing_after_attach_tier.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..f9166d7
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/bug-1214222-directories_missing_after_attach_tier.t
|
|
|
256ebe |
@@ -0,0 +1,61 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+LAST_BRICK=3
|
|
|
256ebe |
+CACHE_BRICK_FIRST=4
|
|
|
256ebe |
+CACHE_BRICK_LAST=5
|
|
|
256ebe |
+DEMOTE_TIMEOUT=12
|
|
|
256ebe |
+PROMOTE_TIMEOUT=5
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+LAST_BRICK=1
|
|
|
256ebe |
+CACHE_BRICK=2
|
|
|
256ebe |
+DEMOTE_TIMEOUT=12
|
|
|
256ebe |
+PROMOTE_TIMEOUT=5
|
|
|
256ebe |
+MIGRATION_TIMEOUT=10
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0..$LAST_BRICK}
|
|
|
256ebe |
+TEST $CLI volume start $V0
|
|
|
256ebe |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Basic operations.
|
|
|
256ebe |
+cd $M0
|
|
|
256ebe |
+TEST stat .
|
|
|
256ebe |
+TEST mkdir d1
|
|
|
256ebe |
+TEST [ -d d1 ]
|
|
|
256ebe |
+TEST touch file1
|
|
|
256ebe |
+TEST [ -e file1 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume tier $V0 attach replica 2 $H0:$B0/${V0}$CACHE_BRICK_FIRST $H0:$B0/${V0}$CACHE_BRICK_LAST
|
|
|
256ebe |
+TEST $CLI volume set $V0 features.ctr-enabled on
|
|
|
256ebe |
+
|
|
|
256ebe |
+#check whether the directory's and files are present on mount or not.
|
|
|
256ebe |
+TEST [ -d d1 ]
|
|
|
256ebe |
+TEST [ -e file1 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+cd
|
|
|
256ebe |
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+tier_status ()
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ $CLI volume tier $V0 detach status | grep progress | wc -l
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume tier $V0 detach start
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" tier_status
|
|
|
256ebe |
+TEST $CLI volume tier $V0 detach commit
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "0" confirm_tier_removed ${V0}${CACHE_BRICK_FIRST}
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "0" confirm_vol_stopped $V0
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/bug-1260185-donot-allow-detach-commit-unnecessarily.t b/tests/basic/tier/bug-1260185-donot-allow-detach-commit-unnecessarily.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..6efbe32
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/bug-1260185-donot-allow-detach-commit-unnecessarily.t
|
|
|
256ebe |
@@ -0,0 +1,47 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Test case for BZ: 1260185
|
|
|
256ebe |
+## Do not allow detach-tier commit without "force" option or without
|
|
|
256ebe |
+## user have not started "detach-tier start" operation
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../cluster.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Start glusterd
|
|
|
256ebe |
+TEST glusterd;
|
|
|
256ebe |
+TEST pidof glusterd;
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Lets create and start the volume
|
|
|
256ebe |
+TEST $CLI volume create $V0 $H0:$B0/${V0}{1..2}
|
|
|
256ebe |
+TEST $CLI volume start $V0
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Perform attach-tier operation on volume $V0
|
|
|
256ebe |
+TEST $CLI volume tier $V0 attach $H0:$B0/${V0}{3..4}
|
|
|
256ebe |
+
|
|
|
256ebe |
+## detach-tier commit operation without force option on volume $V0
|
|
|
256ebe |
+## should not succeed
|
|
|
256ebe |
+TEST ! $CLI --mode=script volume tier $V0 detach commit
|
|
|
256ebe |
+
|
|
|
256ebe |
+## detach-tier commit operation with force option on volume $V0
|
|
|
256ebe |
+## should succeed
|
|
|
256ebe |
+TEST $CLI volume tier $V0 detach force
|
|
|
256ebe |
+
|
|
|
256ebe |
+sleep 3
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Again performing attach-tier operation on volume $V0
|
|
|
256ebe |
+TEST $CLI volume tier $V0 attach $H0:$B0/${V0}{5..6}
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Do detach-tier start on volume $V0
|
|
|
256ebe |
+TEST $CLI volume tier $V0 detach start
|
|
|
256ebe |
+
|
|
|
256ebe |
+## Now detach-tier commit on volume $V0 should succeed.
|
|
|
256ebe |
+## wait for the detach to complete
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" tier_detach_commit_for_single_node
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=1517961
|
|
|
256ebe |
diff --git a/tests/basic/tier/ctr-rename-overwrite.t b/tests/basic/tier/ctr-rename-overwrite.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..73ee758
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/ctr-rename-overwrite.t
|
|
|
256ebe |
@@ -0,0 +1,50 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+LAST_BRICK=1
|
|
|
256ebe |
+CACHE_BRICK_FIRST=4
|
|
|
256ebe |
+CACHE_BRICK_LAST=5
|
|
|
256ebe |
+
|
|
|
256ebe |
+DEMOTE_FREQ=5
|
|
|
256ebe |
+PROMOTE_FREQ=5
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Start glusterd
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Set-up tier cluster
|
|
|
256ebe |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0..$LAST_BRICK}
|
|
|
256ebe |
+TEST $CLI volume start $V0
|
|
|
256ebe |
+TEST $CLI volume tier $V0 attach replica 2 $H0:$B0/${V0}$CACHE_BRICK_FIRST $H0:$B0/${V0}$CACHE_BRICK_LAST
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Start and mount the volume after enabling CTR
|
|
|
256ebe |
+TEST $CLI volume set $V0 features.ctr-enabled on
|
|
|
256ebe |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+# create two files
|
|
|
256ebe |
+echo "hello world" > $M0/file1
|
|
|
256ebe |
+echo "hello world" > $M0/file2
|
|
|
256ebe |
+
|
|
|
256ebe |
+# db in hot brick shows 4 record. 2 for file1 and 2 for file2
|
|
|
256ebe |
+ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
|
|
|
256ebe |
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
|
|
|
256ebe |
+TEST [ $ENTRY_COUNT -eq 4 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+#overwrite file2 with file1
|
|
|
256ebe |
+mv -f $M0/file1 $M0/file2
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Now the db in hot tier should have only 2 records for file1.
|
|
|
256ebe |
+ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
|
|
|
256ebe |
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
|
|
|
256ebe |
+TEST [ $ENTRY_COUNT -eq 2 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/file_lock.c b/tests/basic/tier/file_lock.c
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..20fdbc0
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/file_lock.c
|
|
|
256ebe |
@@ -0,0 +1,72 @@
|
|
|
256ebe |
+#include <stdio.h>
|
|
|
256ebe |
+#include <stdlib.h>
|
|
|
256ebe |
+#include <unistd.h>
|
|
|
256ebe |
+#include <fcntl.h>
|
|
|
256ebe |
+
|
|
|
256ebe |
+void
|
|
|
256ebe |
+usage(void)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ printf("Usage: testlock <filepath> [R|W]\n");
|
|
|
256ebe |
+ return;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
+main(int argc, char *argv[])
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ char *file_path = NULL;
|
|
|
256ebe |
+ int fd = -1;
|
|
|
256ebe |
+ struct flock lock = {0};
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ int c = 0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (argc != 3) {
|
|
|
256ebe |
+ usage();
|
|
|
256ebe |
+ exit(1);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ file_path = argv[1];
|
|
|
256ebe |
+ fd = open(file_path, O_RDWR);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (-1 == fd) {
|
|
|
256ebe |
+ printf("Failed to open file %s. %m\n", file_path);
|
|
|
256ebe |
+ exit(1);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* TODO: Check for invalid input*/
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (!strcmp(argv[2], "W")) {
|
|
|
256ebe |
+ lock.l_type = F_WRLCK;
|
|
|
256ebe |
+ printf("Taking write lock\n");
|
|
|
256ebe |
+
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ lock.l_type = F_RDLCK;
|
|
|
256ebe |
+ printf("Taking read lock\n");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ lock.l_whence = SEEK_SET;
|
|
|
256ebe |
+ lock.l_start = 0;
|
|
|
256ebe |
+ lock.l_len = 0;
|
|
|
256ebe |
+ lock.l_pid = getpid();
|
|
|
256ebe |
+
|
|
|
256ebe |
+ printf("Acquiring lock on %s\n", file_path);
|
|
|
256ebe |
+ ret = fcntl(fd, F_SETLK, &lock);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ printf("Failed to acquire lock on %s (%m)\n", file_path);
|
|
|
256ebe |
+ close(fd);
|
|
|
256ebe |
+ exit(1);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ sleep(10);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /*Unlock*/
|
|
|
256ebe |
+
|
|
|
256ebe |
+ printf("Releasing lock on %s\n", file_path);
|
|
|
256ebe |
+ lock.l_type = F_UNLCK;
|
|
|
256ebe |
+ ret = fcntl(fd, F_SETLK, &lock);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ printf("Failed to release lock on %s (%m)\n", file_path);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ close(fd);
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
diff --git a/tests/basic/tier/file_with_spaces.t b/tests/basic/tier/file_with_spaces.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..919b900
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/file_with_spaces.t
|
|
|
256ebe |
@@ -0,0 +1,71 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+NUM_BRICKS=3
|
|
|
256ebe |
+DEMOTE_FREQ=5
|
|
|
256ebe |
+DEMOTE_TIMEOUT=10
|
|
|
256ebe |
+PROMOTE_FREQ=5
|
|
|
256ebe |
+
|
|
|
256ebe |
+FILE_SPACE="Testing filenames with spaces.log"
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
256ebe |
+# Both hot and cold tiers will have an equal number of bricks.
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ mkdir $B0/cold
|
|
|
256ebe |
+ mkdir $B0/hot
|
|
|
256ebe |
+ TEST $CLI volume create $V0 $H0:$B0/cold/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 features.ctr-enabled on
|
|
|
256ebe |
+ TEST $CLI volume start $V0
|
|
|
256ebe |
+ TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.read-freq-threshold 0
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.write-freq-threshold 0
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Basic checks
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+TEST $CLI volume info
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a tiered volume
|
|
|
256ebe |
+create_dist_tier_vol $NUM_BRICKS
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Mount FUSE
|
|
|
256ebe |
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# The file will be created on the hot tier
|
|
|
256ebe |
+
|
|
|
256ebe |
+touch "$M0/$FILE_SPACE"
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the hot tier
|
|
|
256ebe |
+HPATH=`find $B0/hot/ -name "$FILE_SPACE"`
|
|
|
256ebe |
+echo "File path on hot tier: "$HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "yes" exists_and_regular_file $HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Wait for the tier process to demote the file
|
|
|
256ebe |
+sleep $DEMOTE_TIMEOUT
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the cold tier
|
|
|
256ebe |
+CPATH=`find $B0/cold/ -name "$FILE_SPACE"`
|
|
|
256ebe |
+echo "File path on cold tier: "$CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "yes" exists_and_regular_file $CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/fops-during-migration-pause.t b/tests/basic/tier/fops-during-migration-pause.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..46fc6e4
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/fops-during-migration-pause.t
|
|
|
256ebe |
@@ -0,0 +1,89 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+NUM_BRICKS=3
|
|
|
256ebe |
+DEMOTE_FREQ=10
|
|
|
256ebe |
+PROMOTE_FREQ=10
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST_STR="Testing write and truncate fops on tier migration"
|
|
|
256ebe |
+
|
|
|
256ebe |
+function is_sticky_set () {
|
|
|
256ebe |
+ echo $1
|
|
|
256ebe |
+ if [ -k $1 ];
|
|
|
256ebe |
+ then
|
|
|
256ebe |
+ echo "yes"
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ echo "no"
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
256ebe |
+# Both hot and cold tiers will have an equal number of bricks.
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ mkdir $B0/cold
|
|
|
256ebe |
+ mkdir $B0/hot
|
|
|
256ebe |
+ TEST $CLI volume create $V0 $H0:$B0/cold/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 features.ctr-enabled on
|
|
|
256ebe |
+ TEST $CLI volume start $V0
|
|
|
256ebe |
+ TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.read-freq-threshold 0
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.write-freq-threshold 0
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Basic checks
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+TEST $CLI volume info
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a tiered volume
|
|
|
256ebe |
+create_dist_tier_vol $NUM_BRICKS
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Mount FUSE
|
|
|
256ebe |
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST mkdir $M0/dir1
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create a large file (800MB), so that rebalance takes time
|
|
|
256ebe |
+# The file will be created on the hot tier
|
|
|
256ebe |
+sleep_until_mid_cycle $DEMOTE_FREQ
|
|
|
256ebe |
+dd if=/dev/zero of=$M0/dir1/FILE1 bs=256k count=5120
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the hot tier
|
|
|
256ebe |
+HPATH=`find $B0/hot/ -name FILE1`
|
|
|
256ebe |
+echo "File path on hot tier: "$HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Wait for the tier process to demote the file
|
|
|
256ebe |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "yes" is_sticky_set $HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-pause on
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Wait for the tier process to finish migrating the file
|
|
|
256ebe |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "no" is_sticky_set $HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the cold tier
|
|
|
256ebe |
+CPATH=`find $B0/cold/ -name FILE1`
|
|
|
256ebe |
+
|
|
|
256ebe |
+# make sure destination is empty
|
|
|
256ebe |
+TEST ! test -s $CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# make sure source exists and not empty
|
|
|
256ebe |
+TEST test -s $HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/fops-during-migration.t b/tests/basic/tier/fops-during-migration.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..458c01e
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/fops-during-migration.t
|
|
|
256ebe |
@@ -0,0 +1,105 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+NUM_BRICKS=3
|
|
|
256ebe |
+DEMOTE_FREQ=5
|
|
|
256ebe |
+PROMOTE_FREQ=5
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST_STR="Testing write and truncate fops on tier migration"
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
256ebe |
+# Both hot and cold tiers will have an equal number of bricks.
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ mkdir $B0/cold
|
|
|
256ebe |
+ mkdir $B0/hot
|
|
|
256ebe |
+ TEST $CLI volume create $V0 $H0:$B0/cold/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 features.ctr-enabled on
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.force-migration on
|
|
|
256ebe |
+ TEST $CLI volume start $V0
|
|
|
256ebe |
+ TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.read-freq-threshold 0
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.write-freq-threshold 0
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Checks that the contents of the file matches the input string
|
|
|
256ebe |
+#$1 : file_path
|
|
|
256ebe |
+#$2 : comparison string
|
|
|
256ebe |
+
|
|
|
256ebe |
+function check_file_content () {
|
|
|
256ebe |
+ contents=`cat $1`
|
|
|
256ebe |
+ echo $contents
|
|
|
256ebe |
+ if [ "$contents" = "$2" ]; then
|
|
|
256ebe |
+ echo "1"
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ echo "0"
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Basic checks
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a tiered volume
|
|
|
256ebe |
+create_dist_tier_vol $NUM_BRICKS
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Mount FUSE
|
|
|
256ebe |
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+$CLI volume set $V0 diagnostics.client-log-level DEBUG
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST mkdir $M0/dir1
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create a large file (320MB), so that rebalance takes time
|
|
|
256ebe |
+# The file will be created on the hot tier
|
|
|
256ebe |
+
|
|
|
256ebe |
+dd if=/dev/zero of=$M0/dir1/FILE1 bs=64k count=5120
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the hot tier
|
|
|
256ebe |
+HPATH=`find $B0/hot/ -name FILE1`
|
|
|
256ebe |
+echo "File path on hot tier: "$HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Wait for the tier process to demote the file
|
|
|
256ebe |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "yes" is_sticky_set $HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the cold tier
|
|
|
256ebe |
+CPATH=`find $B0/cold/ -name FILE1`
|
|
|
256ebe |
+echo "File path on cold tier: "$CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Test setxattr
|
|
|
256ebe |
+TEST setfattr -n "user.test_xattr" -v "qwerty" $M0/dir1/FILE1
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Change the file contents while it is being migrated
|
|
|
256ebe |
+echo $TEST_STR > $M0/dir1/FILE1
|
|
|
256ebe |
+
|
|
|
256ebe |
+# The file contents should have changed even if the file
|
|
|
256ebe |
+# is not done migrating
|
|
|
256ebe |
+EXPECT "1" check_file_content $M0/dir1/FILE1 "$TEST_STR"
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Wait for the tier process to finish migrating the file
|
|
|
256ebe |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "no" is_sticky_set $CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# The file contents should have changed
|
|
|
256ebe |
+EXPECT "1" check_file_content $M0/dir1/FILE1 "$TEST_STR"
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST getfattr -n "user.test_xattr" $M0/dir1/FILE1
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/frequency-counters.t b/tests/basic/tier/frequency-counters.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..08e05df
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/frequency-counters.t
|
|
|
256ebe |
@@ -0,0 +1,82 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+NUM_BRICKS=3
|
|
|
256ebe |
+DEMOTE_FREQ=10
|
|
|
256ebe |
+PROMOTE_FREQ=10
|
|
|
256ebe |
+NUM_FILES=5
|
|
|
256ebe |
+TEST_DIR=test
|
|
|
256ebe |
+# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
256ebe |
+# Both hot and cold tiers will have an equal number of bricks.
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_vol () {
|
|
|
256ebe |
+ mkdir $B0/cold
|
|
|
256ebe |
+ mkdir $B0/hot
|
|
|
256ebe |
+ TEST $CLI volume create $V0 $H0:$B0/cold/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+ TEST $CLI volume start $V0
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 features.record-counters on
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.read-freq-threshold 2
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.write-freq-threshold 2
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a tiered volume
|
|
|
256ebe |
+create_dist_vol $NUM_BRICKS
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Mount FUSE
|
|
|
256ebe |
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+# create some files
|
|
|
256ebe |
+mkdir $M0/$TEST_DIR
|
|
|
256ebe |
+cd $M0/${TEST_DIR}
|
|
|
256ebe |
+
|
|
|
256ebe |
+date > file1
|
|
|
256ebe |
+touch file2
|
|
|
256ebe |
+
|
|
|
256ebe |
+# attach tier
|
|
|
256ebe |
+create_dist_tier_vol $NUM_BRICKS
|
|
|
256ebe |
+
|
|
|
256ebe |
+sleep_until_mid_cycle $PROMOTE_FREQ
|
|
|
256ebe |
+
|
|
|
256ebe |
+# check if promotion on single hit, should fail
|
|
|
256ebe |
+date >> file2
|
|
|
256ebe |
+cat file1
|
|
|
256ebe |
+drop_cache $M0
|
|
|
256ebe |
+sleep $PROMOTE_FREQ
|
|
|
256ebe |
+EXPECT "0" check_counters 0 0
|
|
|
256ebe |
+
|
|
|
256ebe |
+# check if promotion on double hit, should suceed
|
|
|
256ebe |
+sleep_until_mid_cycle $PROMOTE_FREQ
|
|
|
256ebe |
+date >> file2
|
|
|
256ebe |
+drop_cache $M0
|
|
|
256ebe |
+cat file1
|
|
|
256ebe |
+date >> file2
|
|
|
256ebe |
+drop_cache $M0
|
|
|
256ebe |
+cat file1
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROMOTE_FREQ "0" check_counters 2 0
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST ! $CLI volume set $V0 features.record-counters off
|
|
|
256ebe |
+
|
|
|
256ebe |
+cd /
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/legacy-many.t b/tests/basic/tier/legacy-many.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..5795428
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/legacy-many.t
|
|
|
256ebe |
@@ -0,0 +1,92 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+LAST_BRICK=3
|
|
|
256ebe |
+CACHE_BRICK_FIRST=4
|
|
|
256ebe |
+CACHE_BRICK_LAST=5
|
|
|
256ebe |
+DEMOTE_TIMEOUT=12
|
|
|
256ebe |
+PROMOTE_TIMEOUT=12
|
|
|
256ebe |
+MIGRATION_TIMEOUT=10
|
|
|
256ebe |
+DEMOTE_FREQ=60
|
|
|
256ebe |
+PROMOTE_FREQ=10
|
|
|
256ebe |
+TEST_DIR="test_files"
|
|
|
256ebe |
+NUM_FILES=15
|
|
|
256ebe |
+
|
|
|
256ebe |
+function read_all {
|
|
|
256ebe |
+ for file in *
|
|
|
256ebe |
+ do
|
|
|
256ebe |
+ cat $file
|
|
|
256ebe |
+ done
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function tier_status () {
|
|
|
256ebe |
+ $CLI volume tier $V0 status | grep "success" | wc -l
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create distributed replica volume
|
|
|
256ebe |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0..$LAST_BRICK}
|
|
|
256ebe |
+TEST $CLI volume start $V0
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+TEST $CLI volume set $V0 features.ctr-enabled on
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create a number of "legacy" files before attaching tier
|
|
|
256ebe |
+mkdir $M0/${TEST_DIR}
|
|
|
256ebe |
+cd $M0/${TEST_DIR}
|
|
|
256ebe |
+TEST create_many_files file $NUM_FILES
|
|
|
256ebe |
+wait
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Attach tier
|
|
|
256ebe |
+TEST $CLI volume tier $V0 attach replica 2 $H0:$B0/${V0}$CACHE_BRICK_FIRST $H0:$B0/${V0}$CACHE_BRICK_LAST
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.read-freq-threshold 0
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.write-freq-threshold 0
|
|
|
256ebe |
+
|
|
|
256ebe |
+# wait a little for lookup heal to finish
|
|
|
256ebe |
+wait_for_tier_start
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" tier_status
|
|
|
256ebe |
+
|
|
|
256ebe |
+# make sure fix layout completed
|
|
|
256ebe |
+CPATH=$B0/${V0}0
|
|
|
256ebe |
+echo $CPATH > /tmp/out
|
|
|
256ebe |
+TEST getfattr -n "trusted.tier.fix.layout.complete" $CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Read "legacy" files
|
|
|
256ebe |
+drop_cache $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+sleep_until_mid_cycle $DEMOTE_FREQ
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST read_all
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Test to make sure files were promoted as expected
|
|
|
256ebe |
+sleep $PROMOTE_TIMEOUT
|
|
|
256ebe |
+EXPECT_WITHIN $PROMOTE_TIMEOUT "0" check_counters $NUM_FILES 0
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" detach_start $V0
|
|
|
256ebe |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" remove_brick_status_completed_field "$V0 $H0:$B0/${V0}${CACHE_BRICK_FIRST}"
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume tier $V0 detach commit
|
|
|
256ebe |
+
|
|
|
256ebe |
+# fix layout flag should be cleared
|
|
|
256ebe |
+TEST ! getfattr -n "trusted.tier.fix.layout.complete" $CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+cd;
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/locked_file_migration.t b/tests/basic/tier/locked_file_migration.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..7fb1717
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/locked_file_migration.t
|
|
|
256ebe |
@@ -0,0 +1,80 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+NUM_BRICKS=3
|
|
|
256ebe |
+DEMOTE_FREQ=7
|
|
|
256ebe |
+PROMOTE_FREQ=30
|
|
|
256ebe |
+DEMOTE_TIMEOUT=15
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST_STR="Testing write and truncate fops on tier migration"
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
256ebe |
+# Both hot and cold tiers will have an equal number of bricks.
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ mkdir $B0/cold
|
|
|
256ebe |
+ mkdir $B0/hot
|
|
|
256ebe |
+ TEST $CLI volume create $V0 $H0:$B0/cold/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 features.ctr-enabled on
|
|
|
256ebe |
+ TEST $CLI volume start $V0
|
|
|
256ebe |
+ TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+
|
|
|
256ebe |
+#We don't want promotes to happen in this test
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.read-freq-threshold 10
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.write-freq-threshold 10
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Basic checks
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+TEST $CLI volume info
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create and start a tiered volume
|
|
|
256ebe |
+create_dist_tier_vol $NUM_BRICKS
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Mount FUSE
|
|
|
256ebe |
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST mkdir $M0/dir1
|
|
|
256ebe |
+build_tester $(dirname $0)/file_lock.c -o file_lock
|
|
|
256ebe |
+cp $(dirname $0)/file_lock $M0/file_lock
|
|
|
256ebe |
+
|
|
|
256ebe |
+# The files will be created on the hot tier
|
|
|
256ebe |
+touch $M0/dir1/FILE1
|
|
|
256ebe |
+touch $M0/dir1/FILE2
|
|
|
256ebe |
+
|
|
|
256ebe |
+# For FILE1, take a POSIX write lock on the entire file.
|
|
|
256ebe |
+# Don't take a lock on FILE2
|
|
|
256ebe |
+
|
|
|
256ebe |
+./file_lock $M0/dir1/FILE1 W &
|
|
|
256ebe |
+
|
|
|
256ebe |
+sleep $DEMOTE_FREQ
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Wait for the tier process to demote the file
|
|
|
256ebe |
+# Only FILE2 and file_lock should be demoted
|
|
|
256ebe |
+# FILE1 should be skipped because of the lock held
|
|
|
256ebe |
+# on it
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $DEMOTE_TIMEOUT "0" check_counters 0 2
|
|
|
256ebe |
+
|
|
|
256ebe |
+sleep 10
|
|
|
256ebe |
+
|
|
|
256ebe |
+rm $(dirname $0)/file_lock
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/new-tier-cmds.t b/tests/basic/tier/new-tier-cmds.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..b9c9390
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/new-tier-cmds.t
|
|
|
256ebe |
@@ -0,0 +1,129 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+. $(dirname $0)/../../cluster.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
256ebe |
+# Both hot and cold tiers will have an equal number of bricks.
|
|
|
256ebe |
+
|
|
|
256ebe |
+function check_peers {
|
|
|
256ebe |
+ $CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ TEST $CLI_1 volume create $V0 disperse 6 redundancy 2 $H1:$B1/${V0}_b1 $H2:$B2/${V0}_b2 $H3:$B3/${V0}_b3 $H1:$B1/${V0}_b4 $H2:$B2/${V0}_b5 $H3:$B3/${V0}_b6
|
|
|
256ebe |
+ TEST $CLI_1 volume start $V0
|
|
|
256ebe |
+ TEST $CLI_1 volume tier $V0 attach replica 2 $H1:$B1/${V0}_h1 $H2:$B2/${V0}_h2 $H3:$B3/${V0}_h3 $H1:$B1/${V0}_h4 $H2:$B2/${V0}_h5 $H3:$B3/${V0}_h6
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function tier_daemon_status {
|
|
|
256ebe |
+ local _VAR=CLI_$1
|
|
|
256ebe |
+ local xpath_sel='//node[hostname="Tier Daemon"][path="localhost"]/status'
|
|
|
256ebe |
+ ${!_VAR} --xml volume status $V0 \
|
|
|
256ebe |
+ | xmllint --xpath "$xpath_sel" - \
|
|
|
256ebe |
+ | sed -n '/.*<status>\([0-9]*\).*/s//\1/p'
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function detach_xml_status {
|
|
|
256ebe |
+ $CLI_1 volume tier $V0 detach status --xml | sed -n \
|
|
|
256ebe |
+ '/.*<opErrstr>Detach tier status successful/p' | wc -l
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#setup cluster and test volume
|
|
|
256ebe |
+TEST launch_cluster 3; # start 3-node virtual cluster
|
|
|
256ebe |
+TEST $CLI_1 peer probe $H2; # peer probe server 2 from server 1 cli
|
|
|
256ebe |
+TEST $CLI_1 peer probe $H3; # peer probe server 3 from server 1 cli
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROBE_TIMEOUT 2 check_peers;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a tiered volume
|
|
|
256ebe |
+create_dist_tier_vol
|
|
|
256ebe |
+
|
|
|
256ebe |
+########### check failure for older commands #############
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST ! $CLI_1 volume rebalance $V0 tier status
|
|
|
256ebe |
+
|
|
|
256ebe |
+# failure for older command can be removed in 3.11
|
|
|
256ebe |
+
|
|
|
256ebe |
+##########################################################
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Issue detach tier on the tiered volume
|
|
|
256ebe |
+#Will throw error saying detach tier not started
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "Tier command failed" $CLI_1 volume tier $V0 detach status
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "0" detach_xml_status
|
|
|
256ebe |
+
|
|
|
256ebe |
+#kill a node
|
|
|
256ebe |
+TEST kill_node 2
|
|
|
256ebe |
+
|
|
|
256ebe |
+#check if we have the rest of the node available printed in the output of detach status
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" tier_status_node_down
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $glusterd_2;
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROBE_TIMEOUT 2 check_peers;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#after starting detach tier the detach tier status should display the status
|
|
|
256ebe |
+sleep 2
|
|
|
256ebe |
+$CLI_1 volume status
|
|
|
256ebe |
+TEST $CLI_1 volume tier $V0 detach start
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "1" detach_xml_status
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" tier_detach_status
|
|
|
256ebe |
+
|
|
|
256ebe |
+#kill a node
|
|
|
256ebe |
+TEST kill_node 2
|
|
|
256ebe |
+
|
|
|
256ebe |
+#check if we have the rest of the node available printed in the output of detach status
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" tier_detach_status_node_down
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $glusterd_2;
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROBE_TIMEOUT 2 check_peers;
|
|
|
256ebe |
+# Make sure we check that the *bricks* are up and not just the node. >:-(
|
|
|
256ebe |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT 1 cluster_brick_up_status 1 $V0 $H2 $B2/${V0}_b2
|
|
|
256ebe |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT 1 cluster_brick_up_status 1 $V0 $H2 $B2/${V0}_h2
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Parsing normal output doesn't work because of line-wrap issues on our
|
|
|
256ebe |
+# regression machines, and the version of xmllint there doesn't support --xpath
|
|
|
256ebe |
+# so we can't do it that way either. In short, there's no way for us to detect
|
|
|
256ebe |
+# when we can stop waiting, so we just have to wait the maximum time every time
|
|
|
256ebe |
+# and hope any failures will show up later in the script.
|
|
|
256ebe |
+sleep $PROCESS_UP_TIMEOUT
|
|
|
256ebe |
+#XPECT_WITHIN $PROCESS_UP_TIMEOUT 1 tier_daemon_status 2
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" tier_detach_status
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI_1 volume tier $V0 detach stop
|
|
|
256ebe |
+
|
|
|
256ebe |
+#If detach tier is stopped the detach tier command will fail
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "Tier command failed" $CLI_1 volume tier $V0 detach status
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI_1 volume tier $V0 detach start
|
|
|
256ebe |
+
|
|
|
256ebe |
+#wait for the detach to complete
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" tier_detach_commit
|
|
|
256ebe |
+
|
|
|
256ebe |
+#If detach tier is committed then the detach status should fail throwing an error
|
|
|
256ebe |
+#saying its not a tiered volume
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "Tier command failed" $CLI_1 volume tier $V0 detach status
|
|
|
256ebe |
+
|
|
|
256ebe |
+########### check failure for older commands #############
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST ! $CLI_1 volume rebalance $V0 tier start
|
|
|
256ebe |
+
|
|
|
256ebe |
+# failure for older command can be removed in 3.11
|
|
|
256ebe |
+
|
|
|
256ebe |
+##########################################################
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/readdir-during-migration.t b/tests/basic/tier/readdir-during-migration.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..292ca88
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/readdir-during-migration.t
|
|
|
256ebe |
@@ -0,0 +1,65 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+NUM_BRICKS=3
|
|
|
256ebe |
+DEMOTE_FREQ=5
|
|
|
256ebe |
+PROMOTE_FREQ=5
|
|
|
256ebe |
+NUM_FILES=30
|
|
|
256ebe |
+TEST_DIR=test
|
|
|
256ebe |
+# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
256ebe |
+# Both hot and cold tiers will have an equal number of bricks.
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ mkdir $B0/cold
|
|
|
256ebe |
+ mkdir $B0/hot
|
|
|
256ebe |
+ TEST $CLI volume create $V0 $H0:$B0/cold/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+ TEST $CLI volume start $V0
|
|
|
256ebe |
+ TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.read-freq-threshold 0
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.write-freq-threshold 0
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function check_file_count() {
|
|
|
256ebe |
+ if [ $(ls -1 | wc -l) == $1 ]; then
|
|
|
256ebe |
+ echo "1"
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ echo "0"
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a tiered volume
|
|
|
256ebe |
+create_dist_tier_vol $NUM_BRICKS
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Mount FUSE
|
|
|
256ebe |
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create a number of "legacy" files before attaching tier
|
|
|
256ebe |
+mkdir $M0/${TEST_DIR}
|
|
|
256ebe |
+cd $M0/${TEST_DIR}
|
|
|
256ebe |
+TEST create_many_files tfile $NUM_FILES
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "1" check_file_count $NUM_FILES
|
|
|
256ebe |
+
|
|
|
256ebe |
+sleep $DEMOTE_FREQ
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "1" check_file_count $NUM_FILES
|
|
|
256ebe |
+
|
|
|
256ebe |
+cd /
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/record-metadata-heat.t b/tests/basic/tier/record-metadata-heat.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..f6f35a8
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/record-metadata-heat.t
|
|
|
256ebe |
@@ -0,0 +1,106 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+NUM_BRICKS=3
|
|
|
256ebe |
+DEMOTE_FREQ=5
|
|
|
256ebe |
+DEMOTE_TIMEOUT=10
|
|
|
256ebe |
+PROMOTE_FREQ=5
|
|
|
256ebe |
+
|
|
|
256ebe |
+FILE="file1.txt"
|
|
|
256ebe |
+FILE_LINK="file2.txt"
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
256ebe |
+# Both hot and cold tiers will have an equal number of bricks.
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ mkdir $B0/cold
|
|
|
256ebe |
+ mkdir $B0/hot
|
|
|
256ebe |
+ TEST $CLI volume create $V0 $H0:$B0/cold/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 features.ctr-enabled on
|
|
|
256ebe |
+ TEST $CLI volume start $V0
|
|
|
256ebe |
+ TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.read-freq-threshold 4
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.write-freq-threshold 4
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Basic checks
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a tiered volume
|
|
|
256ebe |
+create_dist_tier_vol $NUM_BRICKS
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Mount FUSE
|
|
|
256ebe |
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# The file will be created on the hot tier
|
|
|
256ebe |
+touch "$M0/$FILE"
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the hot tier
|
|
|
256ebe |
+HPATH=`find $B0/hot/ -name "$FILE"`
|
|
|
256ebe |
+echo "File path on hot tier: "$HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+############################################
|
|
|
256ebe |
+# as per the changes on b8b050c3
|
|
|
256ebe |
+# To test the xttr set by EC
|
|
|
256ebe |
+TEST ! getfattr -n "trusted.ec.size" $HPATH
|
|
|
256ebe |
+############################################
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Expecting the file to be on the hot tier
|
|
|
256ebe |
+EXPECT "yes" exists_and_regular_file $HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+sleep_until_mid_cycle $DEMOTE_FREQ
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Try to heat the file using 5 metadata operations
|
|
|
256ebe |
+# WITHOUT setting ctr-record-metadata-heat on
|
|
|
256ebe |
+touch "$M0/$FILE"
|
|
|
256ebe |
+chmod +x "$M0/$FILE"
|
|
|
256ebe |
+chown root "$M0/$FILE"
|
|
|
256ebe |
+ln "$M0/$FILE" "$M0/$FILE_LINK"
|
|
|
256ebe |
+rm -rf "$M0/$FILE_LINK"
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Wait for the tier process to demote the file
|
|
|
256ebe |
+sleep $DEMOTE_TIMEOUT
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the cold tier
|
|
|
256ebe |
+CPATH=`find $B0/cold/ -name "$FILE"`
|
|
|
256ebe |
+echo "File path on cold tier: "$CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Expecting the file to be on cold tier
|
|
|
256ebe |
+EXPECT "yes" exists_and_regular_file $CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Set ctr-record-metadata-heat on
|
|
|
256ebe |
+TEST $CLI volume set $V0 ctr-record-metadata-heat on
|
|
|
256ebe |
+
|
|
|
256ebe |
+sleep_until_mid_cycle $DEMOTE_FREQ
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Heating the file using 5 metadata operations
|
|
|
256ebe |
+touch "$M0/$FILE"
|
|
|
256ebe |
+chmod +x "$M0/$FILE"
|
|
|
256ebe |
+chown root "$M0/$FILE"
|
|
|
256ebe |
+ln "$M0/$FILE" "$M0/$FILE_LINK"
|
|
|
256ebe |
+rm -rf "$M0/$FILE_LINK"
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Wait for the tier process to demote the file
|
|
|
256ebe |
+sleep $DEMOTE_TIMEOUT
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the hot tier
|
|
|
256ebe |
+echo "File path on hot tier: "$HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Expecting the file to be on the hot tier
|
|
|
256ebe |
+EXPECT "yes" exists_and_regular_file $HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/tier-heald.t b/tests/basic/tier/tier-heald.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..a8e634f
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/tier-heald.t
|
|
|
256ebe |
@@ -0,0 +1,98 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+# This test contains volume heal commands handled by glusterd.
|
|
|
256ebe |
+# Covers enable/disable at the moment. Will be enhanced later to include
|
|
|
256ebe |
+# the other commands as well.
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+volfile=$(gluster system:: getwd)"/glustershd/glustershd-server.vol"
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Commands should fail when both tiers are not of distribute type.
|
|
|
256ebe |
+# Glustershd shouldn't be running as long as there are no replicate/disperse
|
|
|
256ebe |
+# volumes
|
|
|
256ebe |
+TEST $CLI volume create dist_tier $H0:$B0/cold
|
|
|
256ebe |
+TEST $CLI volume start dist_tier
|
|
|
256ebe |
+TEST $CLI volume tier dist_tier attach $H0:$B0/hot
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST "[ -z $(get_shd_process_pid)]"
|
|
|
256ebe |
+TEST ! $CLI volume heal dist_tier enable
|
|
|
256ebe |
+TEST ! $CLI volume heal dist_tier disable
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Commands should work on replicate/disperse volume.
|
|
|
256ebe |
+TEST $CLI volume create r2 replica 2 $H0:$B0/r2_0 $H0:$B0/r2_1
|
|
|
256ebe |
+TEST "[ -z $(get_shd_process_pid)]"
|
|
|
256ebe |
+TEST $CLI volume start r2
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume tier r2 attach $H0:$B0/r2_hot
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid
|
|
|
256ebe |
+TEST $CLI volume heal r2 enable
|
|
|
256ebe |
+EXPECT "enable" volume_option r2 "cluster.self-heal-daemon"
|
|
|
256ebe |
+EXPECT "enable" volgen_volume_option $volfile r2-replicate-0 cluster replicate self-heal-daemon
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid
|
|
|
256ebe |
+TEST $CLI volume heal r2 disable
|
|
|
256ebe |
+EXPECT "disable" volume_option r2 "cluster.self-heal-daemon"
|
|
|
256ebe |
+EXPECT "disable" volgen_volume_option $volfile r2-replicate-0 cluster replicate self-heal-daemon
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid
|
|
|
256ebe |
+# Commands should work on disperse volume.
|
|
|
256ebe |
+TEST $CLI volume create ec2 disperse 3 redundancy 1 $H0:$B0/ec2_0 $H0:$B0/ec2_1 $H0:$B0/ec2_2
|
|
|
256ebe |
+TEST $CLI volume start ec2
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume tier ec2 attach replica 2 $H0:$B0/ec2_hot{1..4}
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid
|
|
|
256ebe |
+TEST $CLI volume heal ec2 enable
|
|
|
256ebe |
+EXPECT "enable" volume_option ec2 "cluster.disperse-self-heal-daemon"
|
|
|
256ebe |
+EXPECT "enable" volgen_volume_option $volfile ec2-disperse-0 cluster disperse self-heal-daemon
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid
|
|
|
256ebe |
+TEST $CLI volume heal ec2 disable
|
|
|
256ebe |
+EXPECT "disable" volume_option ec2 "cluster.disperse-self-heal-daemon"
|
|
|
256ebe |
+EXPECT "disable" volgen_volume_option $volfile ec2-disperse-0 cluster disperse self-heal-daemon
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Check that shd graph is rewritten correctly on volume stop/start
|
|
|
256ebe |
+EXPECT "Y" volgen_volume_exists $volfile ec2-disperse-0 cluster disperse
|
|
|
256ebe |
+EXPECT "Y" volgen_volume_exists $volfile r2-replicate-0 cluster replicate
|
|
|
256ebe |
+TEST $CLI volume stop r2
|
|
|
256ebe |
+EXPECT "Y" volgen_volume_exists $volfile ec2-disperse-0 cluster disperse
|
|
|
256ebe |
+EXPECT "N" volgen_volume_exists $volfile r2-replicate-0 cluster replicate
|
|
|
256ebe |
+TEST $CLI volume stop ec2
|
|
|
256ebe |
+# When both the volumes are stopped glustershd volfile is not modified just the
|
|
|
256ebe |
+# process is stopped
|
|
|
256ebe |
+TEST "[ -z $(get_shd_process_pid) ]"
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume start r2
|
|
|
256ebe |
+EXPECT "N" volgen_volume_exists $volfile ec2-disperse-0 cluster disperse
|
|
|
256ebe |
+EXPECT "Y" volgen_volume_exists $volfile r2-replicate-0 cluster replicate
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume start ec2
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "Y" volgen_volume_exists $volfile ec2-disperse-0 cluster disperse
|
|
|
256ebe |
+EXPECT "Y" volgen_volume_exists $volfile ec2-replicate-0 cluster replicate
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume tier ec2 detach force
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "Y" volgen_volume_exists $volfile ec2-disperse-0 cluster disperse
|
|
|
256ebe |
+EXPECT "N" volgen_volume_exists $volfile ec2-replicate-0 cluster replicate
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume set r2 self-heal-daemon on
|
|
|
256ebe |
+TEST $CLI volume set r2 cluster.self-heal-daemon off
|
|
|
256ebe |
+TEST ! $CLI volume set ec2 self-heal-daemon off
|
|
|
256ebe |
+TEST ! $CLI volume set ec2 cluster.self-heal-daemon on
|
|
|
256ebe |
+TEST ! $CLI volume set dist self-heal-daemon off
|
|
|
256ebe |
+TEST ! $CLI volume set dist cluster.self-heal-daemon on
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume set ec2 disperse-self-heal-daemon off
|
|
|
256ebe |
+TEST $CLI volume set ec2 cluster.disperse-self-heal-daemon on
|
|
|
256ebe |
+TEST ! $CLI volume set r2 disperse-self-heal-daemon on
|
|
|
256ebe |
+TEST ! $CLI volume set r2 cluster.disperse-self-heal-daemon off
|
|
|
256ebe |
+TEST ! $CLI volume set dist disperse-self-heal-daemon off
|
|
|
256ebe |
+TEST ! $CLI volume set dist cluster.disperse-self-heal-daemon on
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/tier-snapshot.t b/tests/basic/tier/tier-snapshot.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..8747c5d
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/tier-snapshot.t
|
|
|
256ebe |
@@ -0,0 +1,47 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../snapshot.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST init_n_bricks 4;
|
|
|
256ebe |
+TEST setup_lvm 4;
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST glusterd;
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume create $V0 replica 2 $H0:$L1 $H0:$L2 ;
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume start $V0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume tier $V0 attach replica 2 $H0:$L3 $H0:$L4 ;
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+for i in {1..10} ; do echo "file" > $M0/file$i ; done
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI snapshot config activate-on-create enable
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI snapshot create snap1 $V0 no-timestamp;
|
|
|
256ebe |
+
|
|
|
256ebe |
+for i in {11..20} ; do echo "file" > $M0/file$i ; done
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI snapshot create snap2 $V0 no-timestamp;
|
|
|
256ebe |
+
|
|
|
256ebe |
+mkdir $M0/dir1;
|
|
|
256ebe |
+mkdir $M0/dir2;
|
|
|
256ebe |
+
|
|
|
256ebe |
+for i in {1..10} ; do echo "foo" > $M0/dir1/foo$i ; done
|
|
|
256ebe |
+for i in {1..10} ; do echo "foo" > $M0/dir2/foo$i ; done
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI snapshot create snap3 $V0 no-timestamp;
|
|
|
256ebe |
+
|
|
|
256ebe |
+for i in {11..20} ; do echo "foo" > $M0/dir1/foo$i ; done
|
|
|
256ebe |
+for i in {11..20} ; do echo "foo" > $M0/dir2/foo$i ; done
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI snapshot create snap4 $V0 no-timestamp;
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI snapshot delete all;
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/tier.t b/tests/basic/tier/tier.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..1798541
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/tier.t
|
|
|
256ebe |
@@ -0,0 +1,219 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+LAST_BRICK=3
|
|
|
256ebe |
+CACHE_BRICK_FIRST=4
|
|
|
256ebe |
+CACHE_BRICK_LAST=5
|
|
|
256ebe |
+DEMOTE_TIMEOUT=12
|
|
|
256ebe |
+PROMOTE_TIMEOUT=5
|
|
|
256ebe |
+MIGRATION_TIMEOUT=10
|
|
|
256ebe |
+DEMOTE_FREQ=4
|
|
|
256ebe |
+PROMOTE_FREQ=12
|
|
|
256ebe |
+
|
|
|
256ebe |
+function file_on_slow_tier {
|
|
|
256ebe |
+ found=0
|
|
|
256ebe |
+
|
|
|
256ebe |
+ for i in `seq 0 $LAST_BRICK`; do
|
|
|
256ebe |
+ test -e "$B0/${V0}${i}/$1" && found=1 && break;
|
|
|
256ebe |
+ done
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if [ "$found" == "1" ]
|
|
|
256ebe |
+ then
|
|
|
256ebe |
+ slow_hash1=$2
|
|
|
256ebe |
+ slow_hash2=$(fingerprint "$B0/${V0}${i}/$1")
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if [ "$slow_hash1" == "$slow_hash2" ]
|
|
|
256ebe |
+ then
|
|
|
256ebe |
+ echo "0"
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ echo "2"
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ echo "1"
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+
|
|
|
256ebe |
+ # temporarily disable non-Linux tests.
|
|
|
256ebe |
+ case $OSTYPE in
|
|
|
256ebe |
+ NetBSD | FreeBSD | Darwin)
|
|
|
256ebe |
+ echo "0"
|
|
|
256ebe |
+ ;;
|
|
|
256ebe |
+ esac
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function file_on_fast_tier {
|
|
|
256ebe |
+ found=0
|
|
|
256ebe |
+
|
|
|
256ebe |
+ for j in `seq $CACHE_BRICK_FIRST $CACHE_BRICK_LAST`; do
|
|
|
256ebe |
+ test -e "$B0/${V0}${j}/$1" && found=1 && break;
|
|
|
256ebe |
+ done
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if [ "$found" == "1" ]
|
|
|
256ebe |
+ then
|
|
|
256ebe |
+ fast_hash1=$2
|
|
|
256ebe |
+ fast_hash2=$(fingerprint "$B0/${V0}${j}/$1")
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if [ "$fast_hash1" == "$fast_hash2" ]
|
|
|
256ebe |
+ then
|
|
|
256ebe |
+ echo "0"
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ echo "2"
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ echo "1"
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0..$LAST_BRICK}
|
|
|
256ebe |
+# testing bug 1215122, ie should fail if replica count and bricks are not compatible.
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST ! $CLI volume tier $V0 attach replica 5 $H0:$B0/${V0}$CACHE_BRICK_FIRST $H0:$B0/${V0}$CACHE_BRICK_LAST
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume start $V0
|
|
|
256ebe |
+
|
|
|
256ebe |
+# The following two commands instigate a graph switch. Do them
|
|
|
256ebe |
+# before attaching the tier. If done on a tiered volume the rebalance
|
|
|
256ebe |
+# daemon will terminate and must be restarted manually.
|
|
|
256ebe |
+TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Not a tier volume
|
|
|
256ebe |
+TEST ! $CLI volume set $V0 cluster.tier-demote-frequency 4
|
|
|
256ebe |
+
|
|
|
256ebe |
+#testing bug #1228112, glusterd crashed when trying to detach-tier commit force on a non-tiered volume.
|
|
|
256ebe |
+TEST ! $CLI volume tier $V0 detach commit force
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume tier $V0 attach replica 2 $H0:$B0/${V0}$CACHE_BRICK_FIRST $H0:$B0/${V0}$CACHE_BRICK_LAST
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+
|
|
|
256ebe |
+# create a file, make sure it can be deleted after attach tier.
|
|
|
256ebe |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
|
|
|
256ebe |
+cd $M0
|
|
|
256ebe |
+TEST touch delete_me.txt
|
|
|
256ebe |
+TEST rm -f delete_me.txt
|
|
|
256ebe |
+
|
|
|
256ebe |
+# confirm watermark CLI works
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.watermark-hi 85
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.watermark-low 75
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-max-mb 1000
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-max-files 1000
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-max-promote-file-size 1000
|
|
|
256ebe |
+TEST ! $CLI volume set $V0 cluster.tier-max-files -3
|
|
|
256ebe |
+TEST ! $CLI volume set $V0 cluster.watermark-low 90
|
|
|
256ebe |
+TEST ! $CLI volume set $V0 cluster.watermark-hi 75
|
|
|
256ebe |
+TEST ! $CLI volume set $V0 cluster.read-freq-threshold -12
|
|
|
256ebe |
+TEST ! $CLI volume set $V0 cluster.write-freq-threshold -12
|
|
|
256ebe |
+
|
|
|
256ebe |
+#check for watermark reset
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.watermark-low 10
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.watermark-hi 30
|
|
|
256ebe |
+TEST ! $CLI volume reset $V0 cluster.watermark-low
|
|
|
256ebe |
+TEST $CLI volume reset $V0 cluster.watermark-hi
|
|
|
256ebe |
+TEST $CLI volume reset $V0 cluster.watermark-low
|
|
|
256ebe |
+
|
|
|
256ebe |
+# stop the volume and restart it. The rebalance daemon should restart.
|
|
|
256ebe |
+cd /tmp
|
|
|
256ebe |
+umount $M0
|
|
|
256ebe |
+TEST $CLI volume stop $V0
|
|
|
256ebe |
+TEST $CLI volume start $V0
|
|
|
256ebe |
+
|
|
|
256ebe |
+wait_for_tier_start
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
|
|
|
256ebe |
+cd $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+sleep_first_cycle $DEMOTE_FREQ
|
|
|
256ebe |
+$CLI volume tier $V0 status
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Tier options expect non-negative value
|
|
|
256ebe |
+TEST ! $CLI volume set $V0 cluster.tier-promote-frequency -1
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Tier options expect non-negative value
|
|
|
256ebe |
+TEST ! $CLI volume set $V0 cluster.read-freq-threshold qwerty
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.read-freq-threshold 0
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.write-freq-threshold 0
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Basic operations.
|
|
|
256ebe |
+TEST stat .
|
|
|
256ebe |
+TEST mkdir d1
|
|
|
256ebe |
+TEST [ -d d1 ]
|
|
|
256ebe |
+TEST touch d1/file1
|
|
|
256ebe |
+TEST mkdir d1/d2
|
|
|
256ebe |
+TEST [ -d d1/d2 ]
|
|
|
256ebe |
+TEST find d1
|
|
|
256ebe |
+mkdir /tmp/d1
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create a file. It should be on the fast tier.
|
|
|
256ebe |
+uuidgen > /tmp/d1/data.txt
|
|
|
256ebe |
+md5data=$(fingerprint /tmp/d1/data.txt)
|
|
|
256ebe |
+mv /tmp/d1/data.txt ./d1/data.txt
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST file_on_fast_tier d1/data.txt $md5data
|
|
|
256ebe |
+
|
|
|
256ebe |
+uuidgen > /tmp/d1/data2.txt
|
|
|
256ebe |
+md5data2=$(fingerprint /tmp/d1/data2.txt)
|
|
|
256ebe |
+cp /tmp/d1/data2.txt ./d1/data2.txt
|
|
|
256ebe |
+
|
|
|
256ebe |
+#File with spaces and special characters.
|
|
|
256ebe |
+SPACE_FILE="file with spaces & $peci@l ch@r@cter$ @!@$%^$#@^^*&%$#$%.txt"
|
|
|
256ebe |
+
|
|
|
256ebe |
+uuidgen > "/tmp/d1/$SPACE_FILE"
|
|
|
256ebe |
+md5space=$(fingerprint "/tmp/d1/$SPACE_FILE")
|
|
|
256ebe |
+mv "/tmp/d1/$SPACE_FILE" "./d1/$SPACE_FILE"
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Check auto-demotion on write new.
|
|
|
256ebe |
+sleep $DEMOTE_TIMEOUT
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Check auto-promotion on write append.
|
|
|
256ebe |
+UUID=$(uuidgen)
|
|
|
256ebe |
+echo $UUID >> /tmp/d1/data2.txt
|
|
|
256ebe |
+md5data2=$(fingerprint /tmp/d1/data2.txt)
|
|
|
256ebe |
+
|
|
|
256ebe |
+sleep_until_mid_cycle $DEMOTE_FREQ
|
|
|
256ebe |
+drop_cache $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+echo $UUID >> ./d1/data2.txt
|
|
|
256ebe |
+cat "./d1/$SPACE_FILE"
|
|
|
256ebe |
+
|
|
|
256ebe |
+sleep $PROMOTE_TIMEOUT
|
|
|
256ebe |
+sleep $DEMOTE_FREQ
|
|
|
256ebe |
+EXPECT_WITHIN $DEMOTE_TIMEOUT "0" check_counters 2 6
|
|
|
256ebe |
+
|
|
|
256ebe |
+# stop gluster, when it comes back info file should have tiered volume
|
|
|
256ebe |
+killall glusterd
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "0" file_on_slow_tier d1/data.txt $md5data
|
|
|
256ebe |
+EXPECT "0" file_on_slow_tier d1/data2.txt $md5data2
|
|
|
256ebe |
+EXPECT "0" file_on_slow_tier "./d1/$SPACE_FILE" $md5space
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" detach_start $V0
|
|
|
256ebe |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" remove_brick_status_completed_field "$V0 $H0:$B0/${V0}${CACHE_BRICK_FIRST}"
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume tier $V0 detach commit
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "0" confirm_tier_removed ${V0}${CACHE_BRICK_FIRST}
|
|
|
256ebe |
+
|
|
|
256ebe |
+confirm_vol_stopped $V0
|
|
|
256ebe |
+
|
|
|
256ebe |
+cd;
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+rm -rf /tmp/d1
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/tier_lookup_heal.t b/tests/basic/tier/tier_lookup_heal.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..c7c7f27
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/tier_lookup_heal.t
|
|
|
256ebe |
@@ -0,0 +1,69 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+LAST_BRICK=1
|
|
|
256ebe |
+CACHE_BRICK_FIRST=2
|
|
|
256ebe |
+CACHE_BRICK_LAST=3
|
|
|
256ebe |
+PROMOTE_TIMEOUT=5
|
|
|
256ebe |
+
|
|
|
256ebe |
+function file_on_fast_tier {
|
|
|
256ebe |
+ local ret="1"
|
|
|
256ebe |
+
|
|
|
256ebe |
+ s1=$(md5sum $1)
|
|
|
256ebe |
+ s2=$(md5sum $B0/${V0}${CACHE_BRICK_FIRST}/$1)
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if [ -e $B0/${V0}${CACHE_BRICK_FIRST}/$1 ] && ! [ "$s1" == "$s2" ]; then
|
|
|
256ebe |
+ echo "0"
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ echo "1"
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0..$LAST_BRICK}
|
|
|
256ebe |
+TEST $CLI volume start $V0
|
|
|
256ebe |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create files before CTR xlator is on.
|
|
|
256ebe |
+cd $M0
|
|
|
256ebe |
+TEST stat .
|
|
|
256ebe |
+TEST touch file1
|
|
|
256ebe |
+TEST stat file1
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Attach tier and switch ON CTR Xlator.
|
|
|
256ebe |
+TEST $CLI volume tier $V0 attach replica 2 $H0:$B0/${V0}$CACHE_BRICK_FIRST $H0:$B0/${V0}$CACHE_BRICK_LAST
|
|
|
256ebe |
+TEST $CLI volume set $V0 features.ctr-enabled on
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-demote-frequency 4
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-promote-frequency 4
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.read-freq-threshold 0
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.write-freq-threshold 0
|
|
|
256ebe |
+TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+
|
|
|
256ebe |
+#The lookup should heal the database.
|
|
|
256ebe |
+TEST ls file1
|
|
|
256ebe |
+
|
|
|
256ebe |
+# gf_file_tb and gf_flink_tb should NOT be empty
|
|
|
256ebe |
+ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
|
|
|
256ebe |
+ sqlite3 $B0/${V0}$LAST_BRICK/.glusterfs/${V0}$LAST_BRICK.db | wc -l )
|
|
|
256ebe |
+TEST [ $ENTRY_COUNT -eq 2 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Heat-up the file
|
|
|
256ebe |
+uuidgen > file1
|
|
|
256ebe |
+sleep 5
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Check if the file is promoted
|
|
|
256ebe |
+EXPECT_WITHIN $PROMOTE_TIMEOUT "0" file_on_fast_tier file1
|
|
|
256ebe |
+
|
|
|
256ebe |
+cd;
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/tierd_check.t b/tests/basic/tier/tierd_check.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..5701fa9
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/tierd_check.t
|
|
|
256ebe |
@@ -0,0 +1,128 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+. $(dirname $0)/../../cluster.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
256ebe |
+# Both hot and cold tiers will have an equal number of bricks.
|
|
|
256ebe |
+
|
|
|
256ebe |
+function check_peers {
|
|
|
256ebe |
+ $CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ TEST $CLI_1 volume create $V0 $H1:$B1/${V0} $H2:$B2/${V0}
|
|
|
256ebe |
+ TEST $CLI_1 volume start $V0
|
|
|
256ebe |
+ TEST $CLI_1 volume tier $V0 attach $H1:$B1/${V0}_h1 $H2:$B2/${V0}_h2
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function tier_status () {
|
|
|
256ebe |
+ #$CLI_1 volume tier $V0 status | grep progress | wc -l
|
|
|
256ebe |
+ # I don't want to disable the entire test, but this part of it seems
|
|
|
256ebe |
+ # highly suspect. *Why* do we always expect the number of lines to be
|
|
|
256ebe |
+ # exactly two? What would it mean for it to be otherwise? Are we
|
|
|
256ebe |
+ # checking *correctness* of the result, or merely its *consistency*
|
|
|
256ebe |
+ # with what was observed at some unspecified time in the past? Does
|
|
|
256ebe |
+ # this check only serve to inhibit actual improvements? Until someone
|
|
|
256ebe |
+ # can answer these questions and explain why a hard-coded "2" is less
|
|
|
256ebe |
+ # arbitrary than what was here before, we might as well disable this
|
|
|
256ebe |
+ # part of the test.
|
|
|
256ebe |
+ echo "2"
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function tier_daemon_kill () {
|
|
|
256ebe |
+pkill -f "tierd/$V0"
|
|
|
256ebe |
+echo "$?"
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#setup cluster and test volume
|
|
|
256ebe |
+TEST launch_cluster 3; # start 3-node virtual cluster
|
|
|
256ebe |
+TEST $CLI_1 peer probe $H2; # peer probe server 2 from server 1 cli
|
|
|
256ebe |
+TEST $CLI_1 peer probe $H3; # peer probe server 3 from server 1 cli
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROBE_TIMEOUT 2 check_peers;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a tiered volume
|
|
|
256ebe |
+create_dist_tier_vol
|
|
|
256ebe |
+
|
|
|
256ebe |
+wait_for_tier_start
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 0 tier_daemon_check
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 0 tier_daemon_kill
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI_1 volume tier $V0 start
|
|
|
256ebe |
+
|
|
|
256ebe |
+wait_for_tier_start
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" tier_daemon_check
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" tier_daemon_kill
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI_3 volume tier $V0 start force
|
|
|
256ebe |
+
|
|
|
256ebe |
+wait_for_tier_start
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" tier_daemon_check
|
|
|
256ebe |
+
|
|
|
256ebe |
+#The pattern progress should occur twice only.
|
|
|
256ebe |
+#it shouldn't come up on the third node without tierd even
|
|
|
256ebe |
+#after the tier start force is issued on the node without
|
|
|
256ebe |
+#tierd
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
256ebe |
+
|
|
|
256ebe |
+#kill the node on which tier is not supposed to run
|
|
|
256ebe |
+TEST kill_node 3
|
|
|
256ebe |
+
|
|
|
256ebe |
+#bring the node back, it should not have tierd running on it
|
|
|
256ebe |
+TEST $glusterd_3;
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
256ebe |
+
|
|
|
256ebe |
+#after volume restart, check for tierd
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI_3 volume stop $V0
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI_3 volume start $V0
|
|
|
256ebe |
+
|
|
|
256ebe |
+wait_for_tier_start
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
256ebe |
+
|
|
|
256ebe |
+#check for detach start and stop
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI_3 volume tier $V0 detach start
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI_3 volume tier $V0 detach stop
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" tier_status
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI_1 volume tier $V0 start force
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" tier_daemon_check
|
|
|
256ebe |
+
|
|
|
256ebe |
+# To test for detach start fail while the brick is down
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST pkill -f "$B1/$V0"
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST ! $CLI_1 volume tier $V0 detach start
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+# This test isn't worth keeping. Besides the totally arbitrary tier_status
|
|
|
256ebe |
+# checks mentioned above, someone direct-coded pkill to kill bricks instead of
|
|
|
256ebe |
+# using the volume.rc function we already had. I can't be bothered fixing that,
|
|
|
256ebe |
+# and the next thing, and the next thing, unless there's a clear benefit to
|
|
|
256ebe |
+# doing so, and AFAICT the success or failure of this test tells us nothing
|
|
|
256ebe |
+# useful. Therefore, it's disabled until further notice.
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_CENTOS6=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/basic/tier/unlink-during-migration.t b/tests/basic/tier/unlink-during-migration.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..1330092
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/basic/tier/unlink-during-migration.t
|
|
|
256ebe |
@@ -0,0 +1,92 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+DEMOTE_FREQ=5
|
|
|
256ebe |
+PROMOTE_FREQ=5
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_rep_vol () {
|
|
|
256ebe |
+ mkdir $B0/cold
|
|
|
256ebe |
+ mkdir $B0/hot
|
|
|
256ebe |
+ TEST $CLI volume create $V0 replica 2 $H0:$B0/cold/${V0}{0..3}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 features.ctr-enabled on
|
|
|
256ebe |
+ TEST $CLI volume start $V0
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function attach_dist_rep_tier () {
|
|
|
256ebe |
+ TEST $CLI volume tier $V0 attach replica 2 $H0:$B0/hot/${V0}{0..3}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.read-freq-threshold 0
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.write-freq-threshold 0
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Basic checks
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+TEST $CLI volume info
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a volume
|
|
|
256ebe |
+create_dist_rep_vol
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Mount FUSE
|
|
|
256ebe |
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create a large file (320MB), so that rebalance takes time
|
|
|
256ebe |
+TEST dd if=/dev/zero of=$M0/foo bs=64k count=5120
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the cold tier
|
|
|
256ebe |
+CPATH=`find $B0/cold/ -name foo`
|
|
|
256ebe |
+echo "File path on cold tier: "$CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Now attach the tier
|
|
|
256ebe |
+attach_dist_rep_tier
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Write into the file to promote it
|
|
|
256ebe |
+echo "good morning">>$M0/foo
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Wait for the tier process to promote the file
|
|
|
256ebe |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "yes" is_sticky_set $CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the hot tier
|
|
|
256ebe |
+HPATH=`find $B0/hot/ -name foo`
|
|
|
256ebe |
+
|
|
|
256ebe |
+echo "File path on hot tier: "$HPATH
|
|
|
256ebe |
+TEST rm -rf $M0/foo
|
|
|
256ebe |
+TEST ! stat $HPATH
|
|
|
256ebe |
+TEST ! stat $CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+#unlink during demotion
|
|
|
256ebe |
+HPATH="";
|
|
|
256ebe |
+CPATH="";
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create a large file (320MB), so that rebalance takes time
|
|
|
256ebe |
+TEST dd if=/dev/zero of=$M0/foo1 bs=64k count=5120
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the hot tier
|
|
|
256ebe |
+HPATH=`find $B0/hot/ -name foo1`
|
|
|
256ebe |
+echo "File path on hot tier : "$HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "yes" is_sticky_set $HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the cold tier
|
|
|
256ebe |
+CPATH=`find $B0/cold/ -name foo1`
|
|
|
256ebe |
+echo "File path on cold tier : "$CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST rm -rf $M0/foo1
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST ! stat $HPATH
|
|
|
256ebe |
+TEST ! stat $CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/bugs/glusterd/bug-1303028-Rebalance-glusterd-rpc-connection-issue.t b/tests/bugs/glusterd/bug-1303028-Rebalance-glusterd-rpc-connection-issue.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..3b62a45
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/bugs/glusterd/bug-1303028-Rebalance-glusterd-rpc-connection-issue.t
|
|
|
256ebe |
@@ -0,0 +1,78 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
256ebe |
+# Both hot and cold tiers will have an equal number of bricks.
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ mkdir $B0/cold
|
|
|
256ebe |
+ mkdir $B0/hot
|
|
|
256ebe |
+ TEST $CLI volume create $V0 $H0:$B0/cold/${V0}{1..3}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+ TEST $CLI volume start $V0
|
|
|
256ebe |
+ TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{1..2}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function non_zero_check () {
|
|
|
256ebe |
+ if [ "$1" -ne 0 ]
|
|
|
256ebe |
+ then
|
|
|
256ebe |
+ echo "0"
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ echo "1"
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+function num_bricks_up {
|
|
|
256ebe |
+ local b
|
|
|
256ebe |
+ local n_up=0
|
|
|
256ebe |
+
|
|
|
256ebe |
+ for b in $B0/hot/${V0}{1..2} $B0/cold/${V0}{1..3}; do
|
|
|
256ebe |
+ if [ x"$(brick_up_status $V0 $H0 $b)" = x"1" ]; then
|
|
|
256ebe |
+ n_up=$((n_up+1))
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+ done
|
|
|
256ebe |
+
|
|
|
256ebe |
+ echo $n_up
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Basic checks
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+TEST $CLI volume status
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a tiered volume
|
|
|
256ebe |
+create_dist_tier_vol
|
|
|
256ebe |
+# Wait for the bricks to come up, *then* the tier daemon.
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 5 num_bricks_up
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 0 tier_daemon_check
|
|
|
256ebe |
+sleep 5 #wait for some time to run tier daemon
|
|
|
256ebe |
+time_before_restarting=$(rebalance_run_time $V0);
|
|
|
256ebe |
+
|
|
|
256ebe |
+#checking for elapsed time after sleeping for two seconds.
|
|
|
256ebe |
+EXPECT "0" non_zero_check $time_before_restarting;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Difference of elapsed time should be positive
|
|
|
256ebe |
+
|
|
|
256ebe |
+kill -9 $(pidof glusterd);
|
|
|
256ebe |
+TEST glusterd;
|
|
|
256ebe |
+sleep 2;
|
|
|
256ebe |
+# Wait for the bricks to come up, *then* the tier daemon.
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 5 num_bricks_up
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" tier_daemon_check;
|
|
|
256ebe |
+sleep 1;
|
|
|
256ebe |
+time1=$(rebalance_run_time $V0);
|
|
|
256ebe |
+EXPECT "0" non_zero_check $time1;
|
|
|
256ebe |
+sleep 2;
|
|
|
256ebe |
+time2=$(rebalance_run_time $V0);
|
|
|
256ebe |
+EXPECT "0" non_zero_check $time2;
|
|
|
256ebe |
+diff=`expr $time2 - $time1`
|
|
|
256ebe |
+EXPECT "0" non_zero_check $diff;
|
|
|
256ebe |
diff --git a/tests/bugs/quota/bug-1288474.t b/tests/bugs/quota/bug-1288474.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..b8f4ba3
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/bugs/quota/bug-1288474.t
|
|
|
256ebe |
@@ -0,0 +1,51 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+NUM_BRICKS=2
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ mkdir -p $B0/cold/${V0}{0..$1}
|
|
|
256ebe |
+ mkdir -p $B0/hot/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume create $V0 $H0:$B0/cold/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 nfs.disable false
|
|
|
256ebe |
+ TEST $CLI volume start $V0
|
|
|
256ebe |
+ TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{0..$1}
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Basic checks
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a tiered volume
|
|
|
256ebe |
+create_dist_tier_vol $NUM_BRICKS
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
|
|
|
256ebe |
+touch $M0/foobar
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume quota $V0 enable
|
|
|
256ebe |
+TEST $CLI volume quota $V0 limit-usage / 10MB
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "10.0MB" quota_list_field "/" 5
|
|
|
256ebe |
+
|
|
|
256ebe |
+#check quota list after detach tier
|
|
|
256ebe |
+TEST $CLI volume tier $V0 detach start
|
|
|
256ebe |
+sleep 1
|
|
|
256ebe |
+TEST $CLI volume tier $V0 detach force
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "10.0MB" quota_list_field "/" 5
|
|
|
256ebe |
+
|
|
|
256ebe |
+#check quota list after attach tier
|
|
|
256ebe |
+rm -rf $B0/hot
|
|
|
256ebe |
+mkdir $B0/hot
|
|
|
256ebe |
+TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{0..$1}
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "10.0MB" quota_list_field "/" 5
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST umount $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
diff --git a/tests/bugs/replicate/bug-1290965-detect-bitrotten-objects.t b/tests/bugs/replicate/bug-1290965-detect-bitrotten-objects.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..9863834
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/bugs/replicate/bug-1290965-detect-bitrotten-objects.t
|
|
|
256ebe |
@@ -0,0 +1,53 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+#Self-heal tests
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/brick{0,1}
|
|
|
256ebe |
+TEST $CLI volume set $V0 self-heal-daemon off
|
|
|
256ebe |
+TEST $CLI volume set $V0 entry-self-heal off
|
|
|
256ebe |
+TEST $CLI volume set $V0 metadata-self-heal off
|
|
|
256ebe |
+TEST $CLI volume set $V0 data-self-heal off
|
|
|
256ebe |
+TEST $CLI volume set $V0 performance.stat-prefetch off
|
|
|
256ebe |
+TEST $CLI volume start $V0
|
|
|
256ebe |
+TEST $CLI volume tier $V0 attach replica 2 $H0:$B0/brick{2,3}
|
|
|
256ebe |
+TEST $CLI volume bitrot $V0 enable
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_bitd_count
|
|
|
256ebe |
+TEST $CLI volume bitrot $V0 scrub-frequency hourly
|
|
|
256ebe |
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0
|
|
|
256ebe |
+TEST dd if=/dev/urandom of=$M0/FILE bs=1024 count=1
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Corrupt file from back-end
|
|
|
256ebe |
+TEST stat $B0/brick3/FILE
|
|
|
256ebe |
+echo "Corrupted data" >> $B0/brick3/FILE
|
|
|
256ebe |
+#Manually set bad-file xattr since we can't wait for an hour.
|
|
|
256ebe |
+TEST setfattr -n trusted.bit-rot.bad-file -v 0x3100 $B0/brick3/FILE
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST $CLI volume stop $V0
|
|
|
256ebe |
+TEST $CLI volume start $V0
|
|
|
256ebe |
+EXPECT 'Started' volinfo_field $V0 'Status';
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/brick0
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/brick1
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/brick2
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/brick3
|
|
|
256ebe |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
|
|
|
256ebe |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
|
|
|
256ebe |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 2
|
|
|
256ebe |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 3
|
|
|
256ebe |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_bitd_count
|
|
|
256ebe |
+#Trigger lookup so that bitrot xlator marks file as bad in its inode context.
|
|
|
256ebe |
+stat $M0/FILE
|
|
|
256ebe |
+# Remove hot-tier
|
|
|
256ebe |
+TEST $CLI volume tier $V0 detach start
|
|
|
256ebe |
+sleep 1
|
|
|
256ebe |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" detach_tier_status_field_complete $V0
|
|
|
256ebe |
+TEST $CLI volume tier $V0 detach commit
|
|
|
256ebe |
+#Test that file has migrated to cold tier.
|
|
|
256ebe |
+EXPECT "1024" stat -c "%s" $B0/brick0/FILE
|
|
|
256ebe |
+EXPECT "1024" stat -c "%s" $B0/brick1/FILE
|
|
|
256ebe |
+TEST umount $M0
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
diff --git a/tests/bugs/tier/bug-1205545-CTR-and-trash-integration.t b/tests/bugs/tier/bug-1205545-CTR-and-trash-integration.t
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..b2d382a
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/bugs/tier/bug-1205545-CTR-and-trash-integration.t
|
|
|
256ebe |
@@ -0,0 +1,72 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+LAST_BRICK=3
|
|
|
256ebe |
+CACHE_BRICK_FIRST=4
|
|
|
256ebe |
+CACHE_BRICK_LAST=5
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Start glusterd [1-2]
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Set-up tier cluster [3-4]
|
|
|
256ebe |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0..$LAST_BRICK}
|
|
|
256ebe |
+TEST $CLI volume start $V0
|
|
|
256ebe |
+TEST $CLI volume tier $V0 attach replica 2 $H0:$B0/${V0}$CACHE_BRICK_FIRST $H0:$B0/${V0}$CACHE_BRICK_LAST
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Start and mount the volume after enabling CTR and trash [5-8]
|
|
|
256ebe |
+TEST $CLI volume set $V0 features.ctr-enabled on
|
|
|
256ebe |
+TEST $CLI volume set $V0 features.trash on
|
|
|
256ebe |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create an empty file
|
|
|
256ebe |
+touch $M0/foo
|
|
|
256ebe |
+
|
|
|
256ebe |
+# gf_file_tb and gf_flink_tb should contain one entry each [9]
|
|
|
256ebe |
+ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
|
|
|
256ebe |
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
|
|
|
256ebe |
+TEST [ $ENTRY_COUNT -eq 2 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Create two hard links
|
|
|
256ebe |
+ln $M0/foo $M0/lnk1
|
|
|
256ebe |
+ln $M0/foo $M0/lnk2
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Now gf_flink_tb should contain 3 entries [10]
|
|
|
256ebe |
+ENTRY_COUNT=$(echo "select * from gf_flink_tb;" | \
|
|
|
256ebe |
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
|
|
|
256ebe |
+TEST [ $ENTRY_COUNT -eq 3 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Delete the hard link
|
|
|
256ebe |
+rm -rf $M0/lnk1
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Corresponding hard link entry must be removed from gf_flink_tb
|
|
|
256ebe |
+# but gf_file_tb should still contain the file entry [11]
|
|
|
256ebe |
+ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
|
|
|
256ebe |
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
|
|
|
256ebe |
+TEST [ $ENTRY_COUNT -eq 3 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Remove the file
|
|
|
256ebe |
+rm -rf $M0/foo
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Another hardlink removed [12]
|
|
|
256ebe |
+ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
|
|
|
256ebe |
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
|
|
|
256ebe |
+TEST [ $ENTRY_COUNT -eq 2 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Remove the last hardlink
|
|
|
256ebe |
+rm -rf $M0/lnk2
|
|
|
256ebe |
+
|
|
|
256ebe |
+# All entried must be removed from gf_flink_tb and gf_file_tb [13]
|
|
|
256ebe |
+ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
|
|
|
256ebe |
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
|
|
|
256ebe |
+TEST [ $ENTRY_COUNT -eq 0 ]
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/tests/bugs/tier/bug-1279376-rename-demoted-file.t b/tests/bugs/tier/bug-1279376-rename-demoted-file.t
|
|
|
256ebe |
new file mode 100755
|
|
|
256ebe |
index 0000000..c4a50d9
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/tests/bugs/tier/bug-1279376-rename-demoted-file.t
|
|
|
256ebe |
@@ -0,0 +1,93 @@
|
|
|
256ebe |
+#!/bin/bash
|
|
|
256ebe |
+
|
|
|
256ebe |
+. $(dirname $0)/../../include.rc
|
|
|
256ebe |
+. $(dirname $0)/../../volume.rc
|
|
|
256ebe |
+. $(dirname $0)/../../tier.rc
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+NUM_BRICKS=2
|
|
|
256ebe |
+DEMOTE_FREQ=15
|
|
|
256ebe |
+DEMOTE_TIMEOUT=10
|
|
|
256ebe |
+PROMOTE_FREQ=500
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Both src and dst files must hash to the same hot tier subvol
|
|
|
256ebe |
+SRC_FILE="file1.txt"
|
|
|
256ebe |
+DST_FILE="newfile1.txt"
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Creates a tiered volume with pure distribute hot and cold tiers
|
|
|
256ebe |
+# Both hot and cold tiers will have an equal number of bricks.
|
|
|
256ebe |
+
|
|
|
256ebe |
+function create_dist_tier_vol () {
|
|
|
256ebe |
+ mkdir $B0/cold
|
|
|
256ebe |
+ mkdir $B0/hot
|
|
|
256ebe |
+ TEST $CLI volume create $V0 $H0:$B0/cold/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.quick-read off
|
|
|
256ebe |
+ TEST $CLI volume set $V0 performance.io-cache off
|
|
|
256ebe |
+ TEST $CLI volume start $V0
|
|
|
256ebe |
+ TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{0..$1}
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.tier-mode test
|
|
|
256ebe |
+
|
|
|
256ebe |
+#We do not want any files to be promoted during this test
|
|
|
256ebe |
+ TEST $CLI volume set $V0 features.record-counters on
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.read-freq-threshold 50
|
|
|
256ebe |
+ TEST $CLI volume set $V0 cluster.write-freq-threshold 50
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Basic checks
|
|
|
256ebe |
+TEST glusterd
|
|
|
256ebe |
+TEST pidof glusterd
|
|
|
256ebe |
+TEST $CLI volume info
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+#Create and start a tiered volume
|
|
|
256ebe |
+create_dist_tier_vol $NUM_BRICKS
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Mount FUSE
|
|
|
256ebe |
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+# The file will be created on the hot tier
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST touch "$M0/$SRC_FILE"
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the hot tier
|
|
|
256ebe |
+HPATH=`find $B0/hot/ -name "$SRC_FILE"`
|
|
|
256ebe |
+echo "File path on hot tier: "$HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT "yes" exists_and_regular_file $HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Wait for the tier process to demote the file
|
|
|
256ebe |
+sleep $DEMOTE_FREQ
|
|
|
256ebe |
+
|
|
|
256ebe |
+# Get the path of the file on the cold tier
|
|
|
256ebe |
+CPATH=`find $B0/cold/ -name "$SRC_FILE"`
|
|
|
256ebe |
+echo "File path on cold tier: "$CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+EXPECT_WITHIN $DEMOTE_TIMEOUT "yes" exists_and_regular_file $CPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+#We don't want $DST_FILE to get demoted
|
|
|
256ebe |
+TEST $CLI volume set $V0 cluster.tier-demote-frequency $PROMOTE_FREQ
|
|
|
256ebe |
+
|
|
|
256ebe |
+#This will be created on the hot tier
|
|
|
256ebe |
+
|
|
|
256ebe |
+touch "$M0/$DST_FILE"
|
|
|
256ebe |
+HPATH=`find $B0/hot/ -name "$DST_FILE"`
|
|
|
256ebe |
+echo "File path on hot tier: "$HPATH
|
|
|
256ebe |
+
|
|
|
256ebe |
+TEST mv $M0/$SRC_FILE $M0/$DST_FILE
|
|
|
256ebe |
+
|
|
|
256ebe |
+# We expect a single file to exist at this point
|
|
|
256ebe |
+# when viewed on the mountpoint
|
|
|
256ebe |
+EXPECT 1 echo $(ls -l $M0 | grep $DST_FILE | wc -l)
|
|
|
256ebe |
+
|
|
|
256ebe |
+cleanup;
|
|
|
256ebe |
+
|
|
|
256ebe |
+#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=000000
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
256ebe |
index b7c7bd9..ed24858 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
256ebe |
@@ -1859,6 +1859,78 @@ out:
|
|
|
256ebe |
return ret;
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+#if USE_GFDB /* only add changetimerecorder when GFDB is enabled */
|
|
|
256ebe |
+static int
|
|
|
256ebe |
+brick_graph_add_changetimerecorder(volgen_graph_t *graph,
|
|
|
256ebe |
+ glusterd_volinfo_t *volinfo,
|
|
|
256ebe |
+ dict_t *set_dict,
|
|
|
256ebe |
+ glusterd_brickinfo_t *brickinfo)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ xlator_t *xl = NULL;
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ char *brickname = NULL;
|
|
|
256ebe |
+ char *path = NULL;
|
|
|
256ebe |
+ char index_basepath[PATH_MAX] = {0};
|
|
|
256ebe |
+ char *hotbrick = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (!graph || !volinfo || !set_dict || !brickinfo)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ path = brickinfo->path;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ xl = volgen_graph_add(graph, "features/changetimerecorder",
|
|
|
256ebe |
+ volinfo->volname);
|
|
|
256ebe |
+ if (!xl)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = xlator_set_fixed_option(xl, "db-type", "sqlite3");
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (!set_dict || dict_get_str(set_dict, "hot-brick", &hotbrick))
|
|
|
256ebe |
+ hotbrick = "off";
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = xlator_set_fixed_option(xl, "hot-brick", hotbrick);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ brickname = strrchr(path, '/') + 1;
|
|
|
256ebe |
+ snprintf(index_basepath, sizeof(index_basepath), "%s.db", brickname);
|
|
|
256ebe |
+ ret = xlator_set_fixed_option(xl, "db-name", index_basepath);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ snprintf(index_basepath, sizeof(index_basepath), "%s/%s", path,
|
|
|
256ebe |
+ ".glusterfs/");
|
|
|
256ebe |
+ ret = xlator_set_fixed_option(xl, "db-path", index_basepath);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = xlator_set_fixed_option(xl, "record-exit", "off");
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = xlator_set_fixed_option(xl, "ctr_link_consistency", "off");
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = xlator_set_fixed_option(xl, "ctr_lookupheal_link_timeout", "300");
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = xlator_set_fixed_option(xl, "ctr_lookupheal_inode_timeout", "300");
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = xlator_set_fixed_option(xl, "record-entry", "on");
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+#endif /* USE_GFDB */
|
|
|
256ebe |
+
|
|
|
256ebe |
static int
|
|
|
256ebe |
brick_graph_add_acl(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
|
|
|
256ebe |
dict_t *set_dict, glusterd_brickinfo_t *brickinfo)
|
|
|
256ebe |
@@ -2615,6 +2687,9 @@ static volgen_brick_xlator_t server_graph_table[] = {
|
|
|
256ebe |
{brick_graph_add_acl, "acl"},
|
|
|
256ebe |
{brick_graph_add_bitrot_stub, "bitrot-stub"},
|
|
|
256ebe |
{brick_graph_add_changelog, "changelog"},
|
|
|
256ebe |
+#if USE_GFDB /* changetimerecorder depends on gfdb */
|
|
|
256ebe |
+ {brick_graph_add_changetimerecorder, "changetimerecorder"},
|
|
|
256ebe |
+#endif
|
|
|
256ebe |
{brick_graph_add_bd, "bd"},
|
|
|
256ebe |
{brick_graph_add_trash, "trash"},
|
|
|
256ebe |
{brick_graph_add_arbiter, "arbiter"},
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
256ebe |
index c8f6e67..a877805 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
256ebe |
@@ -11,6 +11,474 @@ cases as published by the Free Software Foundation.
|
|
|
256ebe |
#include "glusterd-volgen.h"
|
|
|
256ebe |
#include "glusterd-utils.h"
|
|
|
256ebe |
|
|
|
256ebe |
+#if USE_GFDB /* no GFDB means tiering is disabled */
|
|
|
256ebe |
+
|
|
|
256ebe |
+static int
|
|
|
256ebe |
+get_tier_freq_threshold(glusterd_volinfo_t *volinfo, char *threshold_key)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int threshold = 0;
|
|
|
256ebe |
+ char *str_thresold = NULL;
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_ASSERT(this);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ glusterd_volinfo_get(volinfo, threshold_key, &str_thresold);
|
|
|
256ebe |
+ if (str_thresold) {
|
|
|
256ebe |
+ ret = gf_string2int(str_thresold, &threshold);
|
|
|
256ebe |
+ if (ret == -1) {
|
|
|
256ebe |
+ threshold = ret;
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INCOMPATIBLE_VALUE,
|
|
|
256ebe |
+ "Failed to convert "
|
|
|
256ebe |
+ "string to integer");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ return threshold;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+/*
|
|
|
256ebe |
+ * Validation function for record-counters
|
|
|
256ebe |
+ * if write-freq-threshold and read-freq-threshold both have non-zero values
|
|
|
256ebe |
+ * record-counters cannot be set to off
|
|
|
256ebe |
+ * if record-counters is set to on
|
|
|
256ebe |
+ * check if both the frequency thresholds are zero, then pop
|
|
|
256ebe |
+ * a note, but volume set is not failed.
|
|
|
256ebe |
+ * */
|
|
|
256ebe |
+static int
|
|
|
256ebe |
+validate_tier_counters(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
|
|
|
256ebe |
+ char *value, char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ char errstr[2048] = "";
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+ gf_boolean_t origin_val = -1;
|
|
|
256ebe |
+ int current_wt = 0;
|
|
|
256ebe |
+ int current_rt = 0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_ASSERT(this);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (volinfo->type != GF_CLUSTER_TYPE_TIER) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "Volume %s is not a tier "
|
|
|
256ebe |
+ "volume. Option %s is only valid for tier volume.",
|
|
|
256ebe |
+ volinfo->volname, key);
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = gf_string2boolean(value, &origin_val);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "%s is not a compatible "
|
|
|
256ebe |
+ "value. %s expects an boolean value",
|
|
|
256ebe |
+ value, key);
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ current_rt = get_tier_freq_threshold(volinfo,
|
|
|
256ebe |
+ "cluster.read-freq-threshold");
|
|
|
256ebe |
+ if (current_rt == -1) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ " Failed to retrieve value"
|
|
|
256ebe |
+ " of cluster.read-freq-threshold");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ current_wt = get_tier_freq_threshold(volinfo,
|
|
|
256ebe |
+ "cluster.write-freq-threshold");
|
|
|
256ebe |
+ if (current_wt == -1) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ " Failed to retrieve value "
|
|
|
256ebe |
+ "of cluster.write-freq-threshold");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ /* If record-counters is set to off */
|
|
|
256ebe |
+ if (!origin_val) {
|
|
|
256ebe |
+ /* Both the thresholds should be zero to set
|
|
|
256ebe |
+ * record-counters to off*/
|
|
|
256ebe |
+ if (current_rt || current_wt) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "Cannot set features.record-counters to \"%s\""
|
|
|
256ebe |
+ " as cluster.write-freq-threshold is %d"
|
|
|
256ebe |
+ " and cluster.read-freq-threshold is %d. Please"
|
|
|
256ebe |
+ " set both cluster.write-freq-threshold and "
|
|
|
256ebe |
+ " cluster.read-freq-threshold to 0, to set "
|
|
|
256ebe |
+ " features.record-counters to \"%s\".",
|
|
|
256ebe |
+ value, current_wt, current_rt, value);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ /* TODO give a warning message to the user. errstr without re = -1 will
|
|
|
256ebe |
+ * not result in a warning on cli for now.
|
|
|
256ebe |
+ else {
|
|
|
256ebe |
+ if (!current_rt && !current_wt) {
|
|
|
256ebe |
+ snprintf (errstr, sizeof (errstr),
|
|
|
256ebe |
+ " Note : cluster.write-freq-threshold is %d"
|
|
|
256ebe |
+ " and cluster.read-freq-threshold is %d. Please"
|
|
|
256ebe |
+ " set both cluster.write-freq-threshold and "
|
|
|
256ebe |
+ " cluster.read-freq-threshold to"
|
|
|
256ebe |
+ " appropriate positive values.",
|
|
|
256ebe |
+ current_wt, current_rt);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }*/
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = 0;
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INCOMPATIBLE_VALUE,
|
|
|
256ebe |
+ "%s", errstr);
|
|
|
256ebe |
+ *op_errstr = gf_strdup(errstr);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+/*
|
|
|
256ebe |
+ * Validation function for ctr sql params
|
|
|
256ebe |
+ * features.ctr-sql-db-cachesize (Range: 1000 to 262144 pages)
|
|
|
256ebe |
+ * features.ctr-sql-db-wal-autocheckpoint (Range: 1000 to 262144 pages)
|
|
|
256ebe |
+ * */
|
|
|
256ebe |
+static int
|
|
|
256ebe |
+validate_ctr_sql_params(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
|
|
|
256ebe |
+ char *value, char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+ char errstr[2048] = "";
|
|
|
256ebe |
+ int origin_val = -1;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_ASSERT(this);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = gf_string2int(value, &origin_val);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "%s is not a compatible "
|
|
|
256ebe |
+ "value. %s expects an integer value.",
|
|
|
256ebe |
+ value, key);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (origin_val < 0) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "%s is not a "
|
|
|
256ebe |
+ "compatible value. %s expects a positive"
|
|
|
256ebe |
+ "integer value.",
|
|
|
256ebe |
+ value, key);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (strstr(key, "sql-db-cachesize") ||
|
|
|
256ebe |
+ strstr(key, "sql-db-wal-autocheckpoint")) {
|
|
|
256ebe |
+ if ((origin_val < 1000) || (origin_val > 262144)) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "%s is not a "
|
|
|
256ebe |
+ "compatible value. %s "
|
|
|
256ebe |
+ "expects a value between : "
|
|
|
256ebe |
+ "1000 to 262144.",
|
|
|
256ebe |
+ value, key);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = 0;
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INCOMPATIBLE_VALUE,
|
|
|
256ebe |
+ "%s", errstr);
|
|
|
256ebe |
+ *op_errstr = gf_strdup(errstr);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+/* Validation for tiering frequency thresholds
|
|
|
256ebe |
+ * If any of the frequency thresholds are set to a non-zero value,
|
|
|
256ebe |
+ * switch record-counters on, if not already on
|
|
|
256ebe |
+ * If both the frequency thresholds are set to zero,
|
|
|
256ebe |
+ * switch record-counters off, if not already off
|
|
|
256ebe |
+ * */
|
|
|
256ebe |
+static int
|
|
|
256ebe |
+validate_tier_thresholds(glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
|
|
|
256ebe |
+ char *value, char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ char errstr[2048] = "";
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+ int origin_val = -1;
|
|
|
256ebe |
+ gf_boolean_t current_rc = _gf_false;
|
|
|
256ebe |
+ int current_wt = 0;
|
|
|
256ebe |
+ int current_rt = 0;
|
|
|
256ebe |
+ gf_boolean_t is_set_rc = _gf_false;
|
|
|
256ebe |
+ char *proposed_rc = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_ASSERT(this);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (volinfo->type != GF_CLUSTER_TYPE_TIER) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "Volume %s is not a tier "
|
|
|
256ebe |
+ "volume. Option %s is only valid for tier volume.",
|
|
|
256ebe |
+ volinfo->volname, key);
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = gf_string2int(value, &origin_val);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "%s is not a compatible "
|
|
|
256ebe |
+ "value. %s expects an integer value.",
|
|
|
256ebe |
+ value, key);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (origin_val < 0) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "%s is not a "
|
|
|
256ebe |
+ "compatible value. %s expects a positive"
|
|
|
256ebe |
+ "integer value.",
|
|
|
256ebe |
+ value, key);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* Get the record-counters value */
|
|
|
256ebe |
+ ret = glusterd_volinfo_get_boolean(volinfo, "features.record-counters");
|
|
|
256ebe |
+ if (ret == -1) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "Failed to retrieve value of"
|
|
|
256ebe |
+ "features.record-counters from volume info");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ current_rc = ret;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* if any of the thresholds are set to a non-zero value
|
|
|
256ebe |
+ * switch record-counters on, if not already on*/
|
|
|
256ebe |
+ if (origin_val > 0) {
|
|
|
256ebe |
+ if (!current_rc) {
|
|
|
256ebe |
+ is_set_rc = _gf_true;
|
|
|
256ebe |
+ current_rc = _gf_true;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ /* if the set is for write-freq-threshold */
|
|
|
256ebe |
+ if (strstr(key, "write-freq-threshold")) {
|
|
|
256ebe |
+ current_rt = get_tier_freq_threshold(volinfo,
|
|
|
256ebe |
+ "cluster.read-freq-threshold");
|
|
|
256ebe |
+ if (current_rt == -1) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ " Failed to retrieve value of"
|
|
|
256ebe |
+ "cluster.read-freq-threshold");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ current_wt = origin_val;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ /* else it should be read-freq-threshold */
|
|
|
256ebe |
+ else {
|
|
|
256ebe |
+ current_wt = get_tier_freq_threshold(
|
|
|
256ebe |
+ volinfo, "cluster.write-freq-threshold");
|
|
|
256ebe |
+ if (current_wt == -1) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ " Failed to retrieve value of"
|
|
|
256ebe |
+ "cluster.write-freq-threshold");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ current_rt = origin_val;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* Since both the thresholds are zero, set record-counters
|
|
|
256ebe |
+ * to off, if not already off */
|
|
|
256ebe |
+ if (current_rt == 0 && current_wt == 0) {
|
|
|
256ebe |
+ if (current_rc) {
|
|
|
256ebe |
+ is_set_rc = _gf_true;
|
|
|
256ebe |
+ current_rc = _gf_false;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* if record-counter has to be set to proposed value */
|
|
|
256ebe |
+ if (is_set_rc) {
|
|
|
256ebe |
+ if (current_rc) {
|
|
|
256ebe |
+ ret = gf_asprintf(&proposed_rc, "on");
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ ret = gf_asprintf(&proposed_rc, "off");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ if (ret < 0) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INCOMPATIBLE_VALUE,
|
|
|
256ebe |
+ "Failed to allocate memory to dict_value");
|
|
|
256ebe |
+ goto error;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ ret = dict_set_str(volinfo->dict, "features.record-counters",
|
|
|
256ebe |
+ proposed_rc);
|
|
|
256ebe |
+ error:
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "Failed to set features.record-counters"
|
|
|
256ebe |
+ "to \"%s\" automatically."
|
|
|
256ebe |
+ "Please try to set features.record-counters "
|
|
|
256ebe |
+ "\"%s\" manually. The options "
|
|
|
256ebe |
+ "cluster.write-freq-threshold and "
|
|
|
256ebe |
+ "cluster.read-freq-threshold can only "
|
|
|
256ebe |
+ "be set to a non zero value, if "
|
|
|
256ebe |
+ "features.record-counters is "
|
|
|
256ebe |
+ "set to \"on\".",
|
|
|
256ebe |
+ proposed_rc, proposed_rc);
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ ret = 0;
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INCOMPATIBLE_VALUE,
|
|
|
256ebe |
+ "%s", errstr);
|
|
|
256ebe |
+ *op_errstr = gf_strdup(errstr);
|
|
|
256ebe |
+ if (proposed_rc)
|
|
|
256ebe |
+ GF_FREE(proposed_rc);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+static int
|
|
|
256ebe |
+validate_tier(glusterd_volinfo_t *volinfo, dict_t *dict, char *key, char *value,
|
|
|
256ebe |
+ char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ char errstr[2048] = "";
|
|
|
256ebe |
+ int ret = 0;
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+ int origin_val = -1;
|
|
|
256ebe |
+ char *current_wm_hi = NULL;
|
|
|
256ebe |
+ char *current_wm_low = NULL;
|
|
|
256ebe |
+ uint64_t wm_hi = 0;
|
|
|
256ebe |
+ uint64_t wm_low = 0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_ASSERT(this);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (volinfo->type != GF_CLUSTER_TYPE_TIER) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "Volume %s is not a tier "
|
|
|
256ebe |
+ "volume. Option %s is only valid for tier volume.",
|
|
|
256ebe |
+ volinfo->volname, key);
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INCOMPATIBLE_VALUE,
|
|
|
256ebe |
+ "%s", errstr);
|
|
|
256ebe |
+ *op_errstr = gf_strdup(errstr);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (strstr(key, "cluster.tier-mode")) {
|
|
|
256ebe |
+ if (strcmp(value, "test") && strcmp(value, "cache")) {
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ } else if (strstr(key, "tier-pause")) {
|
|
|
256ebe |
+ if (strcmp(value, "off") && strcmp(value, "on")) {
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ } else if (strstr(key, "tier-compact")) {
|
|
|
256ebe |
+ if (strcmp(value, "on") && strcmp(value, "off")) {
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /*
|
|
|
256ebe |
+ * Rest of the volume set options for tier are expecting a positive
|
|
|
256ebe |
+ * Integer. Change the function accordingly if this constraint is
|
|
|
256ebe |
+ * changed.
|
|
|
256ebe |
+ */
|
|
|
256ebe |
+ ret = gf_string2int(value, &origin_val);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "%s is not a compatible "
|
|
|
256ebe |
+ "value. %s expects an integer value.",
|
|
|
256ebe |
+ value, key);
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INCOMPATIBLE_VALUE,
|
|
|
256ebe |
+ "%s", errstr);
|
|
|
256ebe |
+ *op_errstr = gf_strdup(errstr);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (strstr(key, "watermark-hi") || strstr(key, "watermark-low")) {
|
|
|
256ebe |
+ if ((origin_val < 1) || (origin_val > 99)) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "%s is not a "
|
|
|
256ebe |
+ "compatible value. %s expects a "
|
|
|
256ebe |
+ "percentage from 1-99.",
|
|
|
256ebe |
+ value, key);
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INCOMPATIBLE_VALUE,
|
|
|
256ebe |
+ "%s", errstr);
|
|
|
256ebe |
+ *op_errstr = gf_strdup(errstr);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (strstr(key, "watermark-hi")) {
|
|
|
256ebe |
+ wm_hi = origin_val;
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ glusterd_volinfo_get(volinfo, "cluster.watermark-hi",
|
|
|
256ebe |
+ ¤t_wm_hi);
|
|
|
256ebe |
+ gf_string2bytesize_uint64(current_wm_hi, &wm_hi);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (strstr(key, "watermark-low")) {
|
|
|
256ebe |
+ wm_low = origin_val;
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ glusterd_volinfo_get(volinfo, "cluster.watermark-low",
|
|
|
256ebe |
+ ¤t_wm_low);
|
|
|
256ebe |
+ gf_string2bytesize_uint64(current_wm_low, &wm_low);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ if (wm_low >= wm_hi) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "lower watermark"
|
|
|
256ebe |
+ " cannot be equal or exceed upper "
|
|
|
256ebe |
+ "watermark.");
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INCOMPATIBLE_VALUE,
|
|
|
256ebe |
+ "%s", errstr);
|
|
|
256ebe |
+ *op_errstr = gf_strdup(errstr);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ } else if (strstr(key, "tier-promote-frequency") ||
|
|
|
256ebe |
+ strstr(key, "tier-max-mb") ||
|
|
|
256ebe |
+ strstr(key, "tier-max-promote-file-size") ||
|
|
|
256ebe |
+ strstr(key, "tier-max-files") ||
|
|
|
256ebe |
+ strstr(key, "tier-demote-frequency") ||
|
|
|
256ebe |
+ strstr(key, "tier-hot-compact-frequency") ||
|
|
|
256ebe |
+ strstr(key, "tier-cold-compact-frequency") ||
|
|
|
256ebe |
+ strstr(key, "tier-query-limit")) {
|
|
|
256ebe |
+ if (origin_val < 1) {
|
|
|
256ebe |
+ snprintf(errstr, sizeof(errstr),
|
|
|
256ebe |
+ "%s is not a "
|
|
|
256ebe |
+ " compatible value. %s expects a positive "
|
|
|
256ebe |
+ "integer value greater than 0.",
|
|
|
256ebe |
+ value, key);
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INCOMPATIBLE_VALUE,
|
|
|
256ebe |
+ "%s", errstr);
|
|
|
256ebe |
+ *op_errstr = gf_strdup(errstr);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ gf_msg_debug(this->name, 0, "Returning %d", ret);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+#endif /* End for USE_GFDB */
|
|
|
256ebe |
+
|
|
|
256ebe |
static int
|
|
|
256ebe |
validate_cache_max_min_size(glusterd_volinfo_t *volinfo, dict_t *dict,
|
|
|
256ebe |
char *key, char *value, char **op_errstr)
|
|
|
256ebe |
@@ -2485,6 +2953,261 @@ struct volopt_map_entry glusterd_volopt_map[] = {
|
|
|
256ebe |
"/var/run/gluster/shared_storage on enabling this "
|
|
|
256ebe |
"option. Unmount and delete the shared storage volume "
|
|
|
256ebe |
" on disabling this option."},
|
|
|
256ebe |
+#if USE_GFDB /* no GFDB means tiering is disabled */
|
|
|
256ebe |
+ /* tier translator - global tunables */
|
|
|
256ebe |
+ {.key = "cluster.write-freq-threshold",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .value = "0",
|
|
|
256ebe |
+ .option = "write-freq-threshold",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_0,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier_thresholds,
|
|
|
256ebe |
+ .description = "Defines the number of writes, in a promotion/demotion"
|
|
|
256ebe |
+ " cycle, that would mark a file HOT for promotion. Any"
|
|
|
256ebe |
+ " file that has write hits less than this value will "
|
|
|
256ebe |
+ "be considered as COLD and will be demoted."},
|
|
|
256ebe |
+ {.key = "cluster.read-freq-threshold",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .value = "0",
|
|
|
256ebe |
+ .option = "read-freq-threshold",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_0,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier_thresholds,
|
|
|
256ebe |
+ .description = "Defines the number of reads, in a promotion/demotion "
|
|
|
256ebe |
+ "cycle, that would mark a file HOT for promotion. Any "
|
|
|
256ebe |
+ "file that has read hits less than this value will be "
|
|
|
256ebe |
+ "considered as COLD and will be demoted."},
|
|
|
256ebe |
+ {
|
|
|
256ebe |
+ .key = "cluster.tier-pause",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .option = "tier-pause",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_6,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ },
|
|
|
256ebe |
+ {
|
|
|
256ebe |
+ .key = "cluster.tier-promote-frequency",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .value = "120",
|
|
|
256ebe |
+ .option = "tier-promote-frequency",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_0,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ },
|
|
|
256ebe |
+ {
|
|
|
256ebe |
+ .key = "cluster.tier-demote-frequency",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .value = "3600",
|
|
|
256ebe |
+ .option = "tier-demote-frequency",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_0,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ },
|
|
|
256ebe |
+ {.key = "cluster.watermark-hi",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .value = "90",
|
|
|
256ebe |
+ .option = "watermark-hi",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_6,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ .description =
|
|
|
256ebe |
+ "Upper % watermark for promotion. If hot tier fills"
|
|
|
256ebe |
+ " above this percentage, no promotion will happen and demotion will "
|
|
|
256ebe |
+ "happen with high probability."},
|
|
|
256ebe |
+ {.key = "cluster.watermark-low",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .value = "75",
|
|
|
256ebe |
+ .option = "watermark-low",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_6,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ .description =
|
|
|
256ebe |
+ "Lower % watermark. If hot tier is less "
|
|
|
256ebe |
+ "full than this, promotion will happen and demotion will not happen. "
|
|
|
256ebe |
+ "If greater than this, promotion/demotion will happen at a "
|
|
|
256ebe |
+ "probability "
|
|
|
256ebe |
+ "relative to how full the hot tier is."},
|
|
|
256ebe |
+ {.key = "cluster.tier-mode",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .option = "tier-mode",
|
|
|
256ebe |
+ .value = "cache",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_6,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ .description =
|
|
|
256ebe |
+ "Either 'test' or 'cache'. Test mode periodically"
|
|
|
256ebe |
+ " demotes or promotes files automatically based on access."
|
|
|
256ebe |
+ " Cache mode does so based on whether the cache is full or not,"
|
|
|
256ebe |
+ " as specified with watermarks."},
|
|
|
256ebe |
+ {.key = "cluster.tier-max-promote-file-size",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .option = "tier-max-promote-file-size",
|
|
|
256ebe |
+ .value = "0",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_10,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ .description =
|
|
|
256ebe |
+ "The maximum file size in bytes that is promoted. If 0, there"
|
|
|
256ebe |
+ " is no maximum size (default)."},
|
|
|
256ebe |
+ {.key = "cluster.tier-max-mb",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .option = "tier-max-mb",
|
|
|
256ebe |
+ .value = "4000",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_6,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ .description = "The maximum number of MB that may be migrated"
|
|
|
256ebe |
+ " in any direction in a given cycle by a single node."},
|
|
|
256ebe |
+ {.key = "cluster.tier-max-files",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .option = "tier-max-files",
|
|
|
256ebe |
+ .value = "10000",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_6,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ .description = "The maximum number of files that may be migrated"
|
|
|
256ebe |
+ " in any direction in a given cycle by a single node."},
|
|
|
256ebe |
+ {.key = "cluster.tier-query-limit",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .option = "tier-query-limit",
|
|
|
256ebe |
+ .value = "100",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_9_1,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ .type = NO_DOC,
|
|
|
256ebe |
+ .description = "The maximum number of files that may be migrated "
|
|
|
256ebe |
+ "during an emergency demote. An emergency condition "
|
|
|
256ebe |
+ "is flagged when writes breach the hi-watermark."},
|
|
|
256ebe |
+ {.key = "cluster.tier-compact",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .option = "tier-compact",
|
|
|
256ebe |
+ .value = "on",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_9_0,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ .description = "Activate or deactivate the compaction of the DB"
|
|
|
256ebe |
+ " for the volume's metadata."},
|
|
|
256ebe |
+ {
|
|
|
256ebe |
+ .key = "cluster.tier-hot-compact-frequency",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .value = "604800",
|
|
|
256ebe |
+ .option = "tier-hot-compact-frequency",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_9_0,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ },
|
|
|
256ebe |
+ {
|
|
|
256ebe |
+ .key = "cluster.tier-cold-compact-frequency",
|
|
|
256ebe |
+ .voltype = "cluster/tier",
|
|
|
256ebe |
+ .value = "604800",
|
|
|
256ebe |
+ .option = "tier-cold-compact-frequency",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_9_0,
|
|
|
256ebe |
+ .flags = VOLOPT_FLAG_CLIENT_OPT,
|
|
|
256ebe |
+ .validate_fn = validate_tier,
|
|
|
256ebe |
+ },
|
|
|
256ebe |
+ {.key = "features.ctr-enabled",
|
|
|
256ebe |
+ .voltype = "features/changetimerecorder",
|
|
|
256ebe |
+ .value = "off",
|
|
|
256ebe |
+ .option = "ctr-enabled",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_0,
|
|
|
256ebe |
+ .description = "Enable CTR xlator"},
|
|
|
256ebe |
+ {.key = "features.record-counters",
|
|
|
256ebe |
+ .voltype = "features/changetimerecorder",
|
|
|
256ebe |
+ .value = "off",
|
|
|
256ebe |
+ .option = "record-counters",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_0,
|
|
|
256ebe |
+ .validate_fn = validate_tier_counters,
|
|
|
256ebe |
+ .description = "Its a Change Time Recorder Xlator option to "
|
|
|
256ebe |
+ "enable recording write "
|
|
|
256ebe |
+ "and read heat counters. The default is disabled. "
|
|
|
256ebe |
+ "If enabled, \"cluster.write-freq-threshold\" and "
|
|
|
256ebe |
+ "\"cluster.read-freq-threshold\" defined the number "
|
|
|
256ebe |
+ "of writes (or reads) to a given file are needed "
|
|
|
256ebe |
+ "before triggering migration."},
|
|
|
256ebe |
+ {.key = "features.ctr-record-metadata-heat",
|
|
|
256ebe |
+ .voltype = "features/changetimerecorder",
|
|
|
256ebe |
+ .value = "off",
|
|
|
256ebe |
+ .option = "ctr-record-metadata-heat",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_0,
|
|
|
256ebe |
+ .type = NO_DOC,
|
|
|
256ebe |
+ .description = "Its a Change Time Recorder Xlator option to "
|
|
|
256ebe |
+ "enable recording write heat on metadata of the file. "
|
|
|
256ebe |
+ "The default is disabled. "
|
|
|
256ebe |
+ "Metadata is inode attributes like atime, mtime,"
|
|
|
256ebe |
+ " permissions etc and "
|
|
|
256ebe |
+ "extended attributes of a file ."},
|
|
|
256ebe |
+ {.key = "features.ctr_link_consistency",
|
|
|
256ebe |
+ .voltype = "features/changetimerecorder",
|
|
|
256ebe |
+ .value = "off",
|
|
|
256ebe |
+ .option = "ctr_link_consistency",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_0,
|
|
|
256ebe |
+ .type = NO_DOC,
|
|
|
256ebe |
+ .description = "Enable a crash consistent way of recording hardlink "
|
|
|
256ebe |
+ "updates by Change Time Recorder Xlator. "
|
|
|
256ebe |
+ "When recording in a crash "
|
|
|
256ebe |
+ "consistent way the data operations will "
|
|
|
256ebe |
+ "experience more latency."},
|
|
|
256ebe |
+ {.key = "features.ctr_lookupheal_link_timeout",
|
|
|
256ebe |
+ .voltype = "features/changetimerecorder",
|
|
|
256ebe |
+ .value = "300",
|
|
|
256ebe |
+ .option = "ctr_lookupheal_link_timeout",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_2,
|
|
|
256ebe |
+ .type = NO_DOC,
|
|
|
256ebe |
+ .description = "Defines the expiry period of in-memory "
|
|
|
256ebe |
+ "hardlink of an inode,"
|
|
|
256ebe |
+ "used by lookup heal in Change Time Recorder."
|
|
|
256ebe |
+ "Once the expiry period"
|
|
|
256ebe |
+ "hits an attempt to heal the database per "
|
|
|
256ebe |
+ "hardlink is done and the "
|
|
|
256ebe |
+ "in-memory hardlink period is reset"},
|
|
|
256ebe |
+ {.key = "features.ctr_lookupheal_inode_timeout",
|
|
|
256ebe |
+ .voltype = "features/changetimerecorder",
|
|
|
256ebe |
+ .value = "300",
|
|
|
256ebe |
+ .option = "ctr_lookupheal_inode_timeout",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_2,
|
|
|
256ebe |
+ .type = NO_DOC,
|
|
|
256ebe |
+ .description = "Defines the expiry period of in-memory inode,"
|
|
|
256ebe |
+ "used by lookup heal in Change Time Recorder. "
|
|
|
256ebe |
+ "Once the expiry period"
|
|
|
256ebe |
+ "hits an attempt to heal the database per "
|
|
|
256ebe |
+ "inode is done"},
|
|
|
256ebe |
+ {.key = "features.ctr-sql-db-cachesize",
|
|
|
256ebe |
+ .voltype = "features/changetimerecorder",
|
|
|
256ebe |
+ .value = "12500",
|
|
|
256ebe |
+ .option = "sql-db-cachesize",
|
|
|
256ebe |
+ .validate_fn = validate_ctr_sql_params,
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_7,
|
|
|
256ebe |
+ .description = "Defines the cache size of the sqlite database of "
|
|
|
256ebe |
+ "changetimerecorder xlator."
|
|
|
256ebe |
+ "The input to this option is in pages."
|
|
|
256ebe |
+ "Each page is 4096 bytes. Default value is 12500 "
|
|
|
256ebe |
+ "pages."
|
|
|
256ebe |
+ "The max value is 262144 pages i.e 1 GB and "
|
|
|
256ebe |
+ "the min value is 1000 pages i.e ~ 4 MB. "},
|
|
|
256ebe |
+ {.key = "features.ctr-sql-db-wal-autocheckpoint",
|
|
|
256ebe |
+ .voltype = "features/changetimerecorder",
|
|
|
256ebe |
+ .value = "25000",
|
|
|
256ebe |
+ .option = "sql-db-wal-autocheckpoint",
|
|
|
256ebe |
+ .validate_fn = validate_ctr_sql_params,
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_7,
|
|
|
256ebe |
+ .description = "Defines the autocheckpoint of the sqlite database of "
|
|
|
256ebe |
+ " changetimerecorder. "
|
|
|
256ebe |
+ "The input to this option is in pages. "
|
|
|
256ebe |
+ "Each page is 4096 bytes. Default value is 25000 "
|
|
|
256ebe |
+ "pages."
|
|
|
256ebe |
+ "The max value is 262144 pages i.e 1 GB and "
|
|
|
256ebe |
+ "the min value is 1000 pages i.e ~4 MB."},
|
|
|
256ebe |
+ {.key = VKEY_FEATURES_SELINUX,
|
|
|
256ebe |
+ .voltype = "features/selinux",
|
|
|
256ebe |
+ .type = NO_DOC,
|
|
|
256ebe |
+ .value = "on",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_11_0,
|
|
|
256ebe |
+ .description = "Convert security.selinux xattrs to "
|
|
|
256ebe |
+ "trusted.gluster.selinux on the bricks. Recommended "
|
|
|
256ebe |
+ "to have enabled when clients and/or bricks support "
|
|
|
256ebe |
+ "SELinux."},
|
|
|
256ebe |
+
|
|
|
256ebe |
+#endif /* USE_GFDB */
|
|
|
256ebe |
{
|
|
|
256ebe |
.key = "locks.trace",
|
|
|
256ebe |
.voltype = "features/locks",
|
|
|
256ebe |
--
|
|
|
256ebe |
1.8.3.1
|
|
|
256ebe |
|