summaryrefslogtreecommitdiffstats
path: root/tests/bugs/shard/bug-1272986.t
blob: 7bcda0b1bdaa732b0c7ff53d4676b542c897a713 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

. $(dirname $0)/../../include.rc

cleanup

TEST glusterd
TEST pidof glusterd
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1,2,3}
TEST $CLI volume set $V0 features.shard on
TEST $CLI volume start $V0

# $M0 is where the reads will be done and $M1 is where files will be created,
# written to, etc.
TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0
TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M1

# Write some data into a file, such that its size crosses the shard block size.
TEST dd if=/dev/urandom of=$M1/file bs=1M count=5 conv=notrunc oflag=direct

md5sum1_reader=$(md5sum $M0/file | awk '{print $1}')

EXPECT "$md5sum1_reader" echo `md5sum $M1/file | awk '{print $1}'`

# Append some more data into the file.
TEST dd if=/dev/urandom of=$M1/file bs=256k count=1 conv=notrunc oflag=direct

md5sum2_reader=$(dd if=$M0/file iflag=direct | md5sum | awk '{print $1}')

# Test to see if the reader refreshes its cache correctly as part of the reads
# triggered through md5sum. If it does, then the md5sum on the reader and writer
# must match.
EXPECT "$md5sum2_reader" echo `md5sum $M1/file | awk '{print $1}'`

cleanup