diff options
author | Joseph Fernandes <josferna@redhat.com> | 2015-11-21 01:04:21 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-11-25 08:21:35 -0800 |
commit | 9b151f4ddc2636607b15424c94a09f619f2e5cb8 (patch) | |
tree | b3f8646b4981fd92ef87748c47e3f89898fccea6 /tests | |
parent | 03f731a8b32db7bef7c5e9ffc11c16f670ffe960 (diff) |
tier/ctr: Correcting rename logic
Problem: When a file with old_file_name and GFID_1 is renamed with a new_file_name
which already exists and with GFID_2, this is what happens in linux internaly.
a. "new_file_name" is unlinked for GFID_2
b. a hardlink "new_file_name" is created to GFID_1
c. "old_file_name" hardlink is unlinked for GFID_2.
Well this is all internal to linux, and gluster just issues a rename system call
at POSIX layer. But CTR Xlator doesn't delete the entries corresponding to the
"new_file_name" and GFID_2. Thus leaving the stale entry in the DB.
The following are the implications.
a. Promotion are tried on these stale entries which will fail and show
false results in the status of migration,
b. GFID_2 Files with 2 hardlinks, which will have only one hardlink
after the rename will not be promoted or demoted as the DB shows 2 entries.
Solution: Delete the older database entry for the replaced hardlink
Change-Id: I4eafa0872253e29ff1f0bec4283bcfc579ecf0e2
BUG: 1284090
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Reviewed-on: http://review.gluster.org/12711
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/basic/tier/ctr-rename-overwrite.t | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/basic/tier/ctr-rename-overwrite.t b/tests/basic/tier/ctr-rename-overwrite.t new file mode 100755 index 00000000000..a1d5af03a39 --- /dev/null +++ b/tests/basic/tier/ctr-rename-overwrite.t @@ -0,0 +1,49 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../tier.rc + +LAST_BRICK=1 +CACHE_BRICK_FIRST=4 +CACHE_BRICK_LAST=5 + +DEMOTE_FREQ=5 +PROMOTE_FREQ=5 + +cleanup + +# Start glusterd +TEST glusterd +TEST pidof glusterd + +# Set-up tier cluster +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0..$LAST_BRICK} +TEST $CLI volume start $V0 +TEST $CLI volume attach-tier $V0 replica 2 $H0:$B0/${V0}$CACHE_BRICK_FIRST $H0:$B0/${V0}$CACHE_BRICK_LAST + +TEST $CLI volume set $V0 cluster.tier-demote-frequency $DEMOTE_FREQ +TEST $CLI volume set $V0 cluster.tier-promote-frequency $PROMOTE_FREQ + +# Start and mount the volume after enabling CTR +TEST $CLI volume set $V0 features.ctr-enabled on +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0; + +# create two files +echo "hello world" > $M0/file1 +echo "hello world" > $M0/file2 + +# db in hot brick shows 4 record. 2 for file1 and 2 for file2 +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 4 ] + +#overwrite file2 with file1 +mv -f $M0/file1 $M0/file2 + +# Now the db in hot tier should have only 2 records for file1. +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 ] + +cleanup |