summaryrefslogtreecommitdiffstats
path: root/tests/bugs/tier
diff options
context:
space:
mode:
authorJiffin Tony Thottan <jthottan@redhat.com>2015-03-25 15:04:19 +0530
committerVijay Bellur <vbellur@redhat.com>2015-04-24 11:07:25 -0700
commitb72bc58ecc108a2fddbdb6f606cd86a57ca5a68f (patch)
treefbc1af361c628aa9cead9a2a979fbe2faadcf6d0 /tests/bugs/tier
parent4973d0ea608147ff186f13ab51090f59986f1c9f (diff)
features/trash : Notify CTR translator if an unlink happens to a file
This implementation is same as the posix_unlink_cbk() where CTR sends a request during a unlink to send the number of links to the inode and posix obliges sending it using the unwind xdata dict. For Trash xlator a unlink is stat + mkdir(if parent is not present) + rename. And hence this is handled in trash_unlink_rename_cbk(). Change-Id: I402e83567b88e3c9fe171379693c82937af567f9 BUG: 1205545 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Signed-off-by: Joseph Fernandes <josferna@redhat.com> Signed-off-by: Anoop C S <achiraya@redhat.com> Reviewed-on: http://review.gluster.org/9989 Tested-by: NetBSD Build System Tested-by: Joseph Fernandes Reviewed-by: Joseph Fernandes Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'tests/bugs/tier')
-rw-r--r--tests/bugs/tier/bug-1205545-CTR-and-trash-integration.t71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/bugs/tier/bug-1205545-CTR-and-trash-integration.t b/tests/bugs/tier/bug-1205545-CTR-and-trash-integration.t
new file mode 100644
index 00000000000..979c3e8c83a
--- /dev/null
+++ b/tests/bugs/tier/bug-1205545-CTR-and-trash-integration.t
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+LAST_BRICK=3
+CACHE_BRICK_FIRST=4
+CACHE_BRICK_LAST=5
+
+cleanup
+
+# Start glusterd [1-2]
+TEST glusterd
+TEST pidof glusterd
+
+# Set-up tier cluster [3-4]
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0..$LAST_BRICK}
+TEST $CLI volume attach-tier $V0 replica 2 $H0:$B0/${V0}$CACHE_BRICK_FIRST $H0:$B0/${V0}$CACHE_BRICK_LAST
+
+# Start and mount the volume after enabling CTR and trash [5-8]
+TEST $CLI volume set $V0 features.ctr-enabled on
+TEST $CLI volume set $V0 features.trash on
+TEST $CLI volume start $V0
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
+
+# Create an empty file
+touch $M0/foo
+
+# gf_file_tb and gf_flink_tb should contain one entry each [9]
+ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
+TEST [ $ENTRY_COUNT -eq 2 ]
+
+# Create two hard links
+ln $M0/foo $M0/lnk1
+ln $M0/foo $M0/lnk2
+
+# Now gf_flink_tb should contain 3 entries [10]
+ENTRY_COUNT=$(echo "select * from gf_flink_tb;" | \
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
+TEST [ $ENTRY_COUNT -eq 3 ]
+
+# Delete the hard link
+rm -rf $M0/lnk1
+
+# Corresponding hard link entry must be removed from gf_flink_tb
+# but gf_file_tb should still contain the file entry [11]
+ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
+TEST [ $ENTRY_COUNT -eq 3 ]
+
+# Remove the file
+rm -rf $M0/foo
+
+# Another hardlink removed [12]
+ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
+TEST [ $ENTRY_COUNT -eq 2 ]
+
+# Remove the last hardlink
+rm -rf $M0/lnk2
+
+# All entried must be removed from gf_flink_tb and gf_file_tb [13]
+ENTRY_COUNT=$(echo "select * from gf_file_tb; select * from gf_flink_tb;" | \
+ sqlite3 $B0/${V0}5/.glusterfs/${V0}5.db | wc -l )
+TEST [ $ENTRY_COUNT -eq 0 ]
+
+cleanup
+
+
+