summaryrefslogtreecommitdiffstats
path: root/tests/basic/distribute
diff options
context:
space:
mode:
authorBarak Sason Rofman <bsasonro@redhat.com>2020-05-06 13:28:40 +0300
committerSusant Palai <spalai@redhat.com>2020-06-01 10:47:33 +0000
commit7b7559733ca0c25c63f9d56cb7f4650dbd694c40 (patch)
tree1c800340e4731dd532db96cf282aec8584a0eeb4 /tests/basic/distribute
parent4ccd078a00403e526b5406226e0661d217f49545 (diff)
downloadglusterfs-7b7559733ca0c25c63f9d56cb7f4650dbd694c40.tar.gz
glusterfs-7b7559733ca0c25c63f9d56cb7f4650dbd694c40.tar.xz
glusterfs-7b7559733ca0c25c63f9d56cb7f4650dbd694c40.zip
dht - sparse files rebalance enhancements
Currently data migration in rebalance reads sparse file sequentially, disregarding which segments are holes and which are data. This can lead to extremely long migration time for large sparse file. Data migration mechanism needs to be enhanced so only data segments are read and migrated. This can be achieved using lseek to seek for holes and data in the file. This enhancement is a consequence of https://bugzilla.redhat.com/show_bug.cgi?id=1823703 fixes: #1222 Change-Id: If5f448a0c532926464e1f34f504c5c94749b08c3 Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
Diffstat (limited to 'tests/basic/distribute')
-rw-r--r--tests/basic/distribute/spare_file_rebalance.t51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/basic/distribute/spare_file_rebalance.t b/tests/basic/distribute/spare_file_rebalance.t
new file mode 100644
index 0000000000..061c02f739
--- /dev/null
+++ b/tests/basic/distribute/spare_file_rebalance.t
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../dht.rc
+
+# Initialize
+#------------------------------------------------------------
+cleanup;
+
+# Start glusterd
+TEST glusterd;
+TEST pidof glusterd;
+TEST $CLI volume info;
+
+# Create a volume
+TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2};
+
+# Verify volume creation
+EXPECT "$V0" volinfo_field $V0 'Volume Name';
+EXPECT 'Created' volinfo_field $V0 'Status';
+
+# Start volume and verify successful start
+TEST $CLI volume start $V0;
+EXPECT 'Started' volinfo_field $V0 'Status';
+TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 --entry-timeout=0 $M0;
+
+#------------------------------------------------------------
+
+# Test case - Create sparse files on MP and verify
+# file info after rebalance
+#------------------------------------------------------------
+
+# Create some sparse files and get their size
+TEST cd $M0;
+dd if=/dev/urandom of=sparse_file bs=10k count=1 seek=2M
+cp --sparse=always sparse_file sparse_file_3;
+
+# Add a 3rd brick
+TEST $CLI volume add-brick $V0 $H0:$B0/${V0}3;
+
+# Trigger rebalance
+TEST $CLI volume rebalance $V0 start force;
+EXPECT_WITHIN $REBALANCE_TIMEOUT "0" rebalance_completed;
+
+# Compare original and rebalanced files
+TEST cd $B0/${V0}2
+TEST cmp sparse_file $B0/${V0}3/sparse_file_3
+EXPECT_WITHIN 30 "";
+
+cleanup;