|
| 1 | +timeout_set 25 minutes |
| 2 | + |
| 3 | +CHUNKSERVERS=8 \ |
| 4 | + USE_RAMDISK=YES \ |
| 5 | + MOUNT_EXTRA_CONFIG="sfscachemode=NEVER,sfswriteworkers=30,sfsioretries=13" \ |
| 6 | + CHUNKSERVER_EXTRA_CONFIG="NR_OF_NETWORK_WORKERS = 1|NR_OF_HDD_WORKERS_PER_NETWORK_WORKER = 1" \ |
| 7 | + MASTER_EXTRA_CONFIG="CHUNKS_WRITE_REP_LIMIT = 10|CHUNKS_READ_REP_LIMIT = 10|` |
| 8 | + `CHUNKS_LOOP_MIN_TIME = 1|CHUNKS_LOOP_MAX_CPU = 90|CHUNKS_LOOP_PERIOD = 50|` |
| 9 | + `OPERATIONS_DELAY_INIT = 0" \ |
| 10 | + MASTER_CUSTOM_GOALS="8 ec62: \$ec(6,2)" |
| 11 | + setup_local_empty_saunafs info |
| 12 | + |
| 13 | +cd ${info[mount0]} |
| 14 | + |
| 15 | +number_of_files=1000 |
| 16 | + |
| 17 | +for i in $(seq 1 ${number_of_files}); do |
| 18 | + dd if=/dev/random of=${TEMP_DIR}/file_$i bs=64K count=6 conv=fsync &> /dev/null |
| 19 | +done |
| 20 | + |
| 21 | +mkdir dir |
| 22 | +saunafs setgoal ec62 dir |
| 23 | +saunafs settrashtime 0 dir |
| 24 | + |
| 25 | +for test_loop in {1..10}; do |
| 26 | + for i in $(seq 1 ${number_of_files}); do |
| 27 | + dd if="${TEMP_DIR}/file_${i}" of="dir/file_${i}" bs=384K count=1 status=none &> /dev/null & |
| 28 | + done |
| 29 | + |
| 30 | + # Write some files with all CSs available, then kill some CSs and write more files, to increase |
| 31 | + # the probability of having chunks with parts being written at a time when the chunkservers are |
| 32 | + # killed. |
| 33 | + sleep 0.3 |
| 34 | + |
| 35 | + saunafs_chunkserver_daemon 0 kill |
| 36 | + saunafs_chunkserver_daemon 1 kill |
| 37 | + echo "Chunkservers killed, now starting them again" |
| 38 | + |
| 39 | + wait |
| 40 | + echo "All files written" |
| 41 | + |
| 42 | + # Wait enough time for the chunks to have increased their version because of the lost copies, |
| 43 | + # which will prevent the chunks from having copies with wrong data. |
| 44 | + sleep 10 |
| 45 | + echo "Starting chunkservers" |
| 46 | + |
| 47 | + saunafs_chunkserver_daemon 0 start |
| 48 | + saunafs_chunkserver_daemon 1 start |
| 49 | + saunafs_wait_for_all_ready_chunkservers |
| 50 | + |
| 51 | + # Wait for the chunkservers to fix the chunks, which may take some time because of the number of |
| 52 | + # missing parts and the fact that we have only 1 worker thread per chunkserver. |
| 53 | + while true; do |
| 54 | + current_chunk_ok=0 |
| 55 | + for i in $(seq 1 ${number_of_files}); do |
| 56 | + if saunafs fileinfo dir/file_$i | tail -n1 | grep -E \ |
| 57 | + '^[[:space:]]*copy 8:' > /dev/null; then |
| 58 | + current_chunk_ok=$((current_chunk_ok + 1)) |
| 59 | + fi |
| 60 | + done |
| 61 | + |
| 62 | + echo "Checked all files, ${current_chunk_ok} copies are OK" |
| 63 | + if (( current_chunk_ok == number_of_files )); then |
| 64 | + break |
| 65 | + fi |
| 66 | + |
| 67 | + sleep 5 |
| 68 | + done |
| 69 | + |
| 70 | + saunafs_chunkserver_daemon 6 stop |
| 71 | + saunafs_chunkserver_daemon 7 stop |
| 72 | + |
| 73 | + # Test if we can read files with only 6 copies, specially when reading from chunkservers 0 and |
| 74 | + # 1, which were killed and restarted. |
| 75 | + for i in $(seq 1 ${number_of_files}); do |
| 76 | + assert_success dd if="dir/file_$i" of=/dev/null bs=384K count=1 status=none |
| 77 | + cmp "${TEMP_DIR}/file_$i" "dir/file_$i" || \ |
| 78 | + { echo "File $i is different after reading back"; exit 1; } |
| 79 | + done |
| 80 | + |
| 81 | + saunafs_chunkserver_daemon 6 start |
| 82 | + saunafs_chunkserver_daemon 7 start |
| 83 | + saunafs_wait_for_all_ready_chunkservers |
| 84 | + |
| 85 | + rm dir/file_* |
| 86 | + |
| 87 | + # Ensure all CS report zero chunks before starting the next loop, to reuse the space |
| 88 | + while true; do |
| 89 | + cs_with_chunks=$(saunafs-admin list-chunkservers localhost "${info[matocl]}" | \ |
| 90 | + awk '/chunks:/ && $2!=0 {print $0}' | wc -l) |
| 91 | + |
| 92 | + echo "${cs_with_chunks} CSs report non-zero chunk counts" |
| 93 | + if (( cs_with_chunks == 0 )); then |
| 94 | + break |
| 95 | + fi |
| 96 | + |
| 97 | + sleep 1 |
| 98 | + done |
| 99 | + |
| 100 | + echo "Test loop ${test_loop} completed" |
| 101 | +done |
0 commit comments