From baac2c28ee98e47a3fc0ecf1db3779c7372df526 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Mon, 13 Apr 2015 20:28:21 +0530 Subject: features/changelog: Consider only changelog on/off as changelog breakage Earlier, both chagelog on/off and brick restart were considered to be changelog breakage and treated as changelog not being continuous. As a result, new HTIME.TSTAMP file was created on both the above cases. Now the change is made such that only on changelog enable/disable, the changelog is considered to be discontinuous. New HTIME.TSTAMP file is not created on brick restart, the changelogs files are appended to last HTIME.TSTAMP file. Treating changelog as continuous in above scenario is important as changelog history API will fail otherwise. It can successfully get changes between start and end timestamps only when changelog is continuous (Changelogs in single HTIME.TSTAMP file are treated as continuous). Without this change, changelog history API would fail, and it would become necessary to fallback to other mechanisms like xsync FSCrawl in case geo-rep to detect changes in this time window. But Xsync FSCrawl would not be applicable to other consumers like glusterfind. Rationale: 1. In plain distributed volume, if brick goes down, no I/O can happen onto the brick. Hence changelog is intact with data on disk. 2. In distributed replicate volume, if brick goes down, since self-heal traffic is captured in changelog. Eventually, I/O happened whend brick down is captured in changelog. BUG: 1217944 Change-Id: Ifa6d932818fe1a3a914e87ac84f1d2ded01c1288 Signed-off-by: Kotresh HR Reviewed-on: http://review.gluster.org/10222 Reviewed-on: http://review.gluster.org/10507 Tested-by: Gluster Build System Reviewed-by: Aravinda VK Reviewed-by: Vijay Bellur --- tests/bugs/changelog/bug-1211327.t | 48 ++++++++++++++++++++++++++++++++++++++ tests/changelog.rc | 4 ++++ tests/volume.rc | 5 ++++ 3 files changed, 57 insertions(+) create mode 100644 tests/bugs/changelog/bug-1211327.t create mode 100644 tests/changelog.rc (limited to 'tests') diff --git a/tests/bugs/changelog/bug-1211327.t b/tests/bugs/changelog/bug-1211327.t new file mode 100644 index 00000000000..19d6e76ecab --- /dev/null +++ b/tests/bugs/changelog/bug-1211327.t @@ -0,0 +1,48 @@ +#!/bin/bash + +#Testcase: +#On brick restart, new HTIME.TSTAMP file should not be created. +#But on changelog disable/enable HTIME.TSTAMP should be created. + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../changelog.rc +cleanup; + +## Start and create a volume +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume create $V0 $H0:$B0/$V0"1"; + +## Verify volume is is created +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; + +## Start volume and verify +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +TEST $CLI volume set $V0 changelog.changelog on; +##Let changelog init complete before killing gluster processes +sleep 1 + +TEST killall_gluster; +sleep 1 +EXPECT 0 online_brick_count; + +TEST glusterd; +TEST pidof glusterd; +##Let the brick processes starts +sleep 1; + +EXPECT 1 online_brick_count; + +##On brick restart only one HTIME should be found. +EXPECT 1 count_htime_files; + +##On changelog disable/enable, new HTIME should be created. +TEST $CLI volume set $V0 changelog.changelog off; +TEST $CLI volume set $V0 changelog.changelog on; +EXPECT 2 count_htime_files; + +cleanup; diff --git a/tests/changelog.rc b/tests/changelog.rc new file mode 100644 index 00000000000..e3b040226ec --- /dev/null +++ b/tests/changelog.rc @@ -0,0 +1,4 @@ + +function count_htime_files { + ls -l $B0/$V0"1"/.glusterfs/changelogs/htime/ | grep HTIME | wc -l +} diff --git a/tests/volume.rc b/tests/volume.rc index f2a56888fb8..75e244f3cc4 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -410,6 +410,11 @@ function volume_exists() { fi } +function killall_gluster() { + pkill gluster + sleep 1 +} + function afr_get_index_count { local brick=$1 ls $1/.glusterfs/indices/xattrop | grep -v xattrop | wc -l -- cgit