Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Fixed burst_corruption_tests.sh to make sure errors are block aligned
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenldl committed Mar 19, 2018
1 parent 8aac346 commit 7b471c5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/burst_corruption_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exit_code=0
VERSIONS=(17 18 19)

corrupt() {
dd if=/dev/zero of=$3 bs=1 count=$2 seek=$1 conv=notrunc &>/dev/null
dd if=/dev/zero of=$3 bs=$2 count=$3 seek=$1 conv=notrunc &>/dev/null
}

file_size=$[1024 * 1024 * 1]
Expand Down Expand Up @@ -37,18 +37,18 @@ for ver in ${VERSIONS[*]}; do
--burst $burst &>/dev/null

if [[ $ver == 17 ]]; then
byte_count=$[$burst * 512]
block_size=512
elif [[ $ver == 18 ]]; then
byte_count=$[$burst * 128]
block_size=128
else
byte_count=$[$burst * 4096]
block_size=4096
fi

echo "Corrupting at $parity_shards random positions, burst error size is $burst"
for (( p=0; p < $parity_shards; p++ )); do
pos=$((RANDOM % $file_size))
pos=$(( (RANDOM % $file_size) / $block_size ))
# echo "#$p corruption, corrupting byte at position : $pos"
corrupt $pos $byte_count $container_name
corrupt $pos $block_size $burst $container_name
done

echo "Repairing"
Expand Down

0 comments on commit 7b471c5

Please sign in to comment.