summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorJiffin Tony Thottan <jthottan@redhat.com>2015-03-25 15:04:19 +0530
committerVijay Bellur <vbellur@redhat.com>2015-05-04 23:21:06 -0700
commitc85b7c2c0c7b8b9e576ebd20e7446b9051c733e4 (patch)
tree16d2075b2ff5ab8ed524197fc0eaeeddf8e81030 /tests/bugs
parent3933109fa34d2e405364b57103f8b6a427acc8ec (diff)
features/trash : Notify CTR translator if an unlink happens to a file
Backport of http://review.gluster.org/#/c/9989/ 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: 1218032 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/10513 Reviewed-by: Joseph Fernandes Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'tests/bugs')
-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
+
+
+