The tests which are related to changelog did not deregister
changelog when any failure was encountered, because of which
any changes afterward were also recorded leading to huge
test stdouts. I have added the functions changelog_cleanup
which will deregister the changelog client created by the
test before exiting. This function is to be used in place
of changelog deregister in any test that registers a changelog
client and a trap statement is included to execute this
function on EXIT.
Test-Parameters: trivial
Seagate-bug-id: MRP-3063
Signed-off-by: Kirtankumar Krishna Shetty <kirtan.shetty@seagate.com>
Change-Id: I7f26f266ba8bda294b75ff5619d95c26704fd83f
Reviewed-on: http://review.whamcloud.com/17506
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
run_test 156 "Verification of tunables"
#Changelogs
run_test 156 "Verification of tunables"
#Changelogs
+cleanup_changelog () {
+ trap 0
+ echo "Deregistering changelog client $CL_USER"
+ do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister $CL_USER
+}
+
err17935 () {
if [[ $MDSCOUNT -gt 1 ]]; then
error_ignore bz17935 $*
err17935 () {
if [[ $MDSCOUNT -gt 1 ]]; then
error_ignore bz17935 $*
local CL_USERS="mdd.$MDT0.changelog_users"
local GET_CL_USERS="do_facet $SINGLEMDS $LCTL get_param -n $CL_USERS"
local CL_USERS="mdd.$MDT0.changelog_users"
local GET_CL_USERS="do_facet $SINGLEMDS $LCTL get_param -n $CL_USERS"
- USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_register -n)
- echo "Registered as changelog user $USER"
- $GET_CL_USERS | grep -q $USER ||
- error "User $USER not found in changelog_users"
+ CL_USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+ changelog_register -n)
+ echo "Registered as changelog user $CL_USER"
+ trap cleanup_changelog EXIT
+ $GET_CL_USERS | grep -q $CL_USER ||
+ error "User $CL_USER not found in changelog_users"
# change something
test_mkdir -p $DIR/$tdir/pics/2008/zachy
# change something
test_mkdir -p $DIR/$tdir/pics/2008/zachy
[ "$fidc" == "$fidf" ] ||
err17935 "pfid in changelog $fidc != dir fid $fidf"
[ "$fidc" == "$fidf" ] ||
err17935 "pfid in changelog $fidc != dir fid $fidf"
- USER_REC1=$($GET_CL_USERS | awk "\$1 == \"$USER\" {print \$2}")
- $LFS changelog_clear $MDT0 $USER $(($USER_REC1 + 5))
- USER_REC2=$($GET_CL_USERS | awk "\$1 == \"$USER\" {print \$2}")
+ USER_REC1=$($GET_CL_USERS | awk "\$1 == \"$CL_USER\" {print \$2}")
+ $LFS changelog_clear $MDT0 $CL_USER $(($USER_REC1 + 5))
+ USER_REC2=$($GET_CL_USERS | awk "\$1 == \"$CL_USER\" {print \$2}")
echo "verifying user clear: $(( $USER_REC1 + 5 )) == $USER_REC2"
[ $USER_REC2 == $(($USER_REC1 + 5)) ] ||
err17935 "user index expected $(($USER_REC1 + 5)) is $USER_REC2"
echo "verifying user clear: $(( $USER_REC1 + 5 )) == $USER_REC2"
[ $USER_REC2 == $(($USER_REC1 + 5)) ] ||
err17935 "user index expected $(($USER_REC1 + 5)) is $USER_REC2"
# LU-3446 changelog index reset on MDT restart
local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
CUR_REC1=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
# LU-3446 changelog index reset on MDT restart
local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
CUR_REC1=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
- $LFS changelog_clear $MDT0 $USER 0
+ $LFS changelog_clear $MDT0 $CL_USER 0
stop $SINGLEMDS || error "Fail to stop MDT."
start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "Fail to start MDT."
CUR_REC2=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
stop $SINGLEMDS || error "Fail to stop MDT."
start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "Fail to start MDT."
CUR_REC2=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
err17935 "current index should be $CUR_REC1 is $CUR_REC2"
echo "verifying user deregister"
err17935 "current index should be $CUR_REC1 is $CUR_REC2"
echo "verifying user deregister"
- do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister $USER
- $GET_CL_USERS | grep -q $USER &&
- error "User $USER still in changelog_users"
+ cleanup_changelog
+ $GET_CL_USERS | grep -q $CL_USER &&
+ error "User $CL_USER still in changelog_users"
USERS=$(( $($GET_CL_USERS | wc -l) - 2 ))
USERS=$(( $($GET_CL_USERS | wc -l) - 2 ))
- if [ $USERS -eq 0 ]; then
+ if [ $CL_USER -eq 0 ]; then
LAST_REC1=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
touch $DIR/$tdir/chloe
LAST_REC2=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
echo "verify changelogs are off: $LAST_REC1 == $LAST_REC2"
[ $LAST_REC1 == $LAST_REC2 ] || error "changelogs not off"
else
LAST_REC1=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
touch $DIR/$tdir/chloe
LAST_REC2=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
echo "verify changelogs are off: $LAST_REC1 == $LAST_REC2"
[ $LAST_REC1 == $LAST_REC2 ] || error "changelogs not off"
else
- echo "$USERS other changelog users; can't verify off"
+ echo "$CL_USER other changelog users; can't verify off"
fi
}
run_test 160a "changelog sanity"
fi
}
run_test 160a "changelog sanity"
local CL_USERS="mdd.$MDT0.changelog_users"
local GET_CL_USERS="do_facet $SINGLEMDS $LCTL get_param -n $CL_USERS"
local CL_USERS="mdd.$MDT0.changelog_users"
local GET_CL_USERS="do_facet $SINGLEMDS $LCTL get_param -n $CL_USERS"
- USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_register -n)
- echo "Registered as changelog user $USER"
- $GET_CL_USERS | grep -q $USER ||
- error "User $USER not found in changelog_users"
+ CL_USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+ changelog_register -n)
+ echo "Registered as changelog user $CL_USER"
+ trap cleanup_changelog EXIT
+ $GET_CL_USERS | grep -q $CL_USER ||
+ error "User $CL_USER not found in changelog_users"
local LONGNAME1=$(str_repeat a 255)
local LONGNAME2=$(str_repeat b 255)
local LONGNAME1=$(str_repeat a 255)
local LONGNAME2=$(str_repeat b 255)
mv $LONGNAME1 $LONGNAME2
$LFS changelog $MDT0 | grep RENME
mv $LONGNAME1 $LONGNAME2
$LFS changelog $MDT0 | grep RENME
-
- echo "deregistering $USER"
- do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister $USER
-
}
run_test 160b "Verify that very long rename doesn't crash in changelog"
}
run_test 160b "Verify that very long rename doesn't crash in changelog"
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
# Registration step
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
# Registration step
- local USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+ CL_USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+ trap cleanup_changelog EXIT
rm -rf $DIR/$tdir
mkdir -p $DIR/$tdir
rm -rf $DIR/$tdir
mkdir -p $DIR/$tdir
$LFS changelog $MDT0
TRUNCS=$($LFS changelog $MDT0 | tail -5 | grep -c "TRUNC")
[ $TRUNCS -eq 1 ] || err17935 "TRUNC changelog mask count $TRUNCS != 1"
$LFS changelog $MDT0
TRUNCS=$($LFS changelog $MDT0 | tail -5 | grep -c "TRUNC")
[ $TRUNCS -eq 1 ] || err17935 "TRUNC changelog mask count $TRUNCS != 1"
- $LFS changelog_clear $MDT0 $USER 0
+ $LFS changelog_clear $MDT0 $CL_USER 0
- echo "deregistering $USER"
- do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister $USER
}
run_test 160c "verify that changelog log catch the truncate event"
}
run_test 160c "verify that changelog log catch the truncate event"
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
# Registration step
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
# Registration step
- local USER=$(do_facet mds1 $LCTL --device $MDT0 \
+ CL_USER=$(do_facet mds1 $LCTL --device $MDT0 \
+ trap cleanup_changelog EXIT
mkdir -p $DIR/$tdir/migrate_dir
mkdir -p $DIR/$tdir/migrate_dir
- $LFS changelog_clear $MDT0 $USER 0
+ $LFS changelog_clear $MDT0 $CL_USER 0
$LFS migrate -m 1 $DIR/$tdir/migrate_dir || error "migrate fails"
$LFS changelog $MDT0
MIGRATES=$($LFS changelog $MDT0 | tail -5 | grep -c "MIGRT")
$LFS migrate -m 1 $DIR/$tdir/migrate_dir || error "migrate fails"
$LFS changelog $MDT0
MIGRATES=$($LFS changelog $MDT0 | tail -5 | grep -c "MIGRT")
- $LFS changelog_clear $MDT0 $USER 0
+ $LFS changelog_clear $MDT0 $CL_USER 0
[ $MIGRATES -eq 1 ] ||
error "MIGRATE changelog mask count $MIGRATES != 1"
# Deregistration step
[ $MIGRATES -eq 1 ] ||
error "MIGRATE changelog mask count $MIGRATES != 1"
# Deregistration step
- do_facet mds1 $LCTL --device $MDT0 changelog_deregister $USER
}
run_test 160d "verify that changelog log catch the migrate event"
}
run_test 160d "verify that changelog log catch the migrate event"
# define CLF_RENAME_LAST 0x0001
# rename overwrite a target having nlink = 1 (changelog flag 0x1)
# define CLF_RENAME_LAST 0x0001
# rename overwrite a target having nlink = 1 (changelog flag 0x1)
- local USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+ CL_USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+
+ trap cleanup_changelog EXIT
rm -rf $DIR/$tdir
mkdir -p $DIR/$tdir
touch $DIR/$tdir/foo_161c
rm -rf $DIR/$tdir
mkdir -p $DIR/$tdir
touch $DIR/$tdir/foo_161c
$LFS changelog $MDT0 | grep RENME
local flags=$($LFS changelog $MDT0 | grep RENME | tail -1 | \
cut -f5 -d' ')
$LFS changelog $MDT0 | grep RENME
local flags=$($LFS changelog $MDT0 | grep RENME | tail -1 | \
cut -f5 -d' ')
- $LFS changelog_clear $MDT0 $USER 0
+ $LFS changelog_clear $MDT0 $CL_USER 0
if [ x$flags != "x0x1" ]; then
if [ x$flags != "x0x1" ]; then
- do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister \
- $USER
error "flag $flags is not 0x1"
fi
echo "rename overwrite a target having nlink = 1," \
error "flag $flags is not 0x1"
fi
echo "rename overwrite a target having nlink = 1," \
mv -f $DIR/$tdir/foo_161c $DIR/$tdir/bar_161c
$LFS changelog $MDT0 | grep RENME
flags=$($LFS changelog $MDT0 | grep RENME | tail -1 | cut -f5 -d' ')
mv -f $DIR/$tdir/foo_161c $DIR/$tdir/bar_161c
$LFS changelog $MDT0 | grep RENME
flags=$($LFS changelog $MDT0 | grep RENME | tail -1 | cut -f5 -d' ')
- $LFS changelog_clear $MDT0 $USER 0
+ $LFS changelog_clear $MDT0 $CL_USER 0
if [ x$flags != "x0x0" ]; then
if [ x$flags != "x0x0" ]; then
- do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister \
- $USER
error "flag $flags is not 0x0"
fi
echo "rename overwrite a target having nlink > 1," \
error "flag $flags is not 0x0"
fi
echo "rename overwrite a target having nlink > 1," \
mv -f $DIR/$tdir/foo_161c $DIR/$tdir/foo2_161c
$LFS changelog $MDT0 | grep RENME
flags=$($LFS changelog $MDT0 | grep RENME | tail -1 | cut -f5 -d' ')
mv -f $DIR/$tdir/foo_161c $DIR/$tdir/foo2_161c
$LFS changelog $MDT0 | grep RENME
flags=$($LFS changelog $MDT0 | grep RENME | tail -1 | cut -f5 -d' ')
- $LFS changelog_clear $MDT0 $USER 0
+ $LFS changelog_clear $MDT0 $CL_USER 0
if [ x$flags != "x0x0" ]; then
if [ x$flags != "x0x0" ]; then
- do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister \
- $USER
error "flag $flags is not 0x0"
fi
echo "rename doesn't overwrite a target," \
error "flag $flags is not 0x0"
fi
echo "rename doesn't overwrite a target," \
rm -f $DIR/$tdir/foo2_161c
$LFS changelog $MDT0 | grep UNLNK
flags=$($LFS changelog $MDT0 | grep UNLNK | tail -1 | cut -f5 -d' ')
rm -f $DIR/$tdir/foo2_161c
$LFS changelog $MDT0 | grep UNLNK
flags=$($LFS changelog $MDT0 | grep UNLNK | tail -1 | cut -f5 -d' ')
- $LFS changelog_clear $MDT0 $USER 0
+ $LFS changelog_clear $MDT0 $CL_USER 0
if [ x$flags != "x0x1" ]; then
if [ x$flags != "x0x1" ]; then
- do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister \
- $USER
error "flag $flags is not 0x1"
fi
echo "unlink a file having nlink = 1," \
error "flag $flags is not 0x1"
fi
echo "unlink a file having nlink = 1," \
rm -f $DIR/$tdir/foobar_161c
$LFS changelog $MDT0 | grep UNLNK
flags=$($LFS changelog $MDT0 | grep UNLNK | tail -1 | cut -f5 -d' ')
rm -f $DIR/$tdir/foobar_161c
$LFS changelog $MDT0 | grep UNLNK
flags=$($LFS changelog $MDT0 | grep UNLNK | tail -1 | cut -f5 -d' ')
- $LFS changelog_clear $MDT0 $USER 0
+ $LFS changelog_clear $MDT0 $CL_USER 0
if [ x$flags != "x0x0" ]; then
if [ x$flags != "x0x0" ]; then
- do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister \
- $USER
error "flag $flags is not 0x0"
fi
echo "unlink a file having nlink > 1," \
"changelog record has flags of $flags"
error "flag $flags is not 0x0"
fi
echo "unlink a file having nlink > 1," \
"changelog record has flags of $flags"
- do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister $USER
}
run_test 161c "check CL_RENME[UNLINK] changelog record flags"
}
run_test 161c "check CL_RENME[UNLINK] changelog record flags"
do_facet $SINGLEMDS \
$LCTL set_param mdt.*.job_cleanup_interval=$OLD_INTERVAL
[ $OLD_JOBENV != $JOBENV ] && jobstats_set $OLD_JOBENV
do_facet $SINGLEMDS \
$LCTL set_param mdt.*.job_cleanup_interval=$OLD_INTERVAL
[ $OLD_JOBENV != $JOBENV ] && jobstats_set $OLD_JOBENV
- do_facet $SINGLEMDS lctl --device $MDT0 changelog_deregister $CL_USER
}
test_205() { # Job stats
}
test_205() { # Job stats