Skip to content

Commit

Permalink
test: EC Small parallel writings
Browse files Browse the repository at this point in the history
This test checks issues found during development of the new write
approach. The idea is to test the client behavior when many small (1
byte long) random writes are being handled in parallel (10 mounts).
  • Loading branch information
dmga44 committed Oct 24, 2024
1 parent c4ef0ac commit d2bd754
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
if is_windows_system; then
timeout_set 5 minutes
else
timeout_set 3 minutes
fi


CHUNKSERVERS=4 \
MOUNTS=10 \
MOUNT_EXTRA_CONFIG="sfscachemode=NEVER" \
MASTER_CUSTOM_GOALS="10 ec_3_1: \$ec(3,1)" \
USE_RAMDISK=YES \
setup_local_empty_saunafs info

# Create an empty file on the SaunaFS filesystem with ec_3_1 goal
file="${info[mount0]}/file"
touch "$file"
saunafs setgoal ec_3_1 "$file"

# Create a temporary file with 25 megabytes of generated data
tmpf=$RAMDISK_DIR/tmpf
FILE_SIZE=64K file-generate "$tmpf"

# Run 10 tasks, each of them will copy every tenth kilobyte from the temporary file to the file
# on SaunaFS using 5 concurrent writers and a dedicated mountpoint
for i in {0..9}; do
(
file="${info[mount${i}]}/file"
seq $i 10 $((64*1024-1)) | shuf | expect_success xargs -P5 -IXX \
dd if="$tmpf" of="$file" bs=1 count=1 seek=XX skip=XX conv=notrunc 2>/dev/null
) &
done
wait

# Validate the result
MESSAGE="Data is corrupted after writing" expect_success file-validate "$file"

# Validate the parity part
csid=$(find_first_chunkserver_with_chunks_matching 'chunk_ec2_1_of_3*')
saunafs_chunkserver_daemon $csid stop

MESSAGE="Parity is corrupted after writing" expect_success file-validate "$file"

0 comments on commit d2bd754

Please sign in to comment.