summaryrefslogtreecommitdiffstats
path: root/geo-replication/src
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2014-01-28 17:42:21 -0800
committerVijay Bellur <vbellur@redhat.com>2014-02-06 07:31:23 -0800
commit055c02436fd6ef6984468b33158104770b41e422 (patch)
treed8989534448bb099faf8e58e116ffcdd016b096a /geo-replication/src
parent4d7764a73f4c504ebd369c61f46e569ebc62ecc9 (diff)
geo-replication: gverify should use disk_size and available_size
"commit ef4bb42382a5c9c3ca0907136669a659c2a20311" was incomplete since reduction in sizes doesn't really have any affect on the problem when disks sizes are similar. Actual fix is to verify disk_size and then verify available_size Change-Id: Idb57f606df229c0bdaeda8852c74e84d29109ffc BUG: 1020154 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/6844 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'geo-replication/src')
-rwxr-xr-xgeo-replication/src/gverify.sh41
1 files changed, 27 insertions, 14 deletions
diff --git a/geo-replication/src/gverify.sh b/geo-replication/src/gverify.sh
index 24580be44f5..c9b7acb301d 100755
--- a/geo-replication/src/gverify.sh
+++ b/geo-replication/src/gverify.sh
@@ -32,11 +32,12 @@ echo 0:0;
exit 1;
fi;
cd \$d;
-available_size=\$(df -B1 \$d | tail -1 | awk "{print \\\$2}");
+disk_size=\$(df -B1 \$d | tail -1 | awk "{print \\\$2}");
+used_size=\$(df -B1 \$d | tail -1 | awk "{print \\\$3}");
umount -l \$d;
rmdir \$d;
ver=\$(gluster --version | head -1 | cut -f2 -d " ");
-echo \$available_size:\$ver;
+echo \$disk_size:\$used_size:\$ver;
};
cd /tmp;
[ x$VOL != x ] && do_verify $VOL;
@@ -61,12 +62,13 @@ echo 0:0;
exit 1;
fi;
cd \$d;
-available_size=\$(df -B1 \$d | tail -1 | awk "{print \\\$4}");
+disk_size=\$(df -B1 \$d | tail -1 | awk "{print \\\$2}");
+available_size=\$(df -B1 \$d | tail -1 | awk "{print \\\$3}");
no_of_files=\$(find \$d -maxdepth 0 -empty);
umount -l \$d;
rmdir \$d;
ver=\$(gluster --version | head -1 | cut -f2 -d " ");
-echo \$available_size:\$ver:\$no_of_files:;
+echo \$disk_size:\$used_size:\$ver:\$no_of_files;
};
cd /tmp;
[ x$VOL != x ] && do_verify $VOL;
@@ -118,11 +120,13 @@ function main()
ERRORS=0;
master_data=$(master_stats $1);
slave_data=$(slave_stats $2 $3);
- master_size=$(echo $master_data | cut -f1 -d':');
- slave_size=$(echo $slave_data | cut -f1 -d':');
- master_version=$(echo $master_data | cut -f2 -d':');
- slave_version=$(echo $slave_data | cut -f2 -d':');
- slave_no_of_files=$(echo $slave_data | cut -f3 -d':');
+ master_disk_size=$(echo $master_data | cut -f1 -d':');
+ slave_disk_size=$(echo $slave_data | cut -f1 -d':');
+ master_used_size=$(echo $master_data | cut -f2 -d':');
+ slave_used_size=$(echo $slave_data | cut -f2 -d':');
+ master_version=$(echo $master_data | cut -f3 -d':');
+ slave_version=$(echo $slave_data | cut -f3 -d':');
+ slave_no_of_files=$(echo $slave_data | cut -f4 -d':');
if [[ "x$master_size" = "x" || "x$master_version" = "x" || "$master_size" -eq "0" ]]; then
echo "FORCE_BLOCKER|Unable to fetch master volume details. Please check the master cluster and master volume." > $log_file;
@@ -138,16 +142,25 @@ function main()
# if they fail. The checks below can be bypassed if force option is
# provided hence no FORCE_BLOCKER flag.
- if [ ! $slave_size -ge $(($master_size - $BUFFER_SIZE )) ]; then
- echo "Total size of master is greater than available size of slave." >> $log_file;
- ERRORS=$(($ERRORS + 1));
- fi;
+ if [ "$slave_disk_size" -lt "$master_disk_size" ]; then
+ echo "Total disk size of master is greater than disk size of slave." >> $log_file;
+ ERRORS=$(($ERRORS + 1));
+ fi
+
+ effective_master_used_size=$(( $master_used_size + $BUFFER_SIZE ))
+ slave_available_size=$(( $slave_disk_size - $slave_used_size ))
+ master_available_size=$(( $master_disk_size - $effective_master_used_size ));
+
+ if [ "$slave_available_size" -lt "$master_available_size" ]; then
+ echo "Total available size of master is greater than available size of slave" >> $log_file;
+ ERRORS=$(($ERRORS + 1));
+ fi
if [ -z $slave_no_of_files ]; then
echo "$2::$3 is not empty. Please delete existing files in $2::$3 and retry, or use force to continue without deleting the existing files." >> $log_file;
ERRORS=$(($ERRORS + 1));
fi;
-
+
if [[ $master_version > $slave_version ]]; then
echo "Gluster version mismatch between master and slave." >> $log_file;
ERRORS=$(($ERRORS + 1));