diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index c839c1f3..1122fd89 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -828,6 +828,24 @@ jobs: echo "" done + test_snapshot_pool2: + runs-on: ubuntu-latest + needs: build + container: ${{env.TEST_IMAGE}}:${{github.sha}} + steps: + - name: Run test + id: test + timeout-minutes: 3 + run: /root/vitastor/tests/test_snapshot_pool2.sh + - name: Print logs + if: always() && steps.test.outcome == 'failure' + run: | + for i in /root/vitastor/testdata/*.log /root/vitastor/testdata/*.txt; do + echo "-------- $i --------" + cat $i + echo "" + done + test_osd_tags: runs-on: ubuntu-latest needs: build diff --git a/src/client/cluster_client.cpp b/src/client/cluster_client.cpp index f8f2cacf..01dd81a2 100644 --- a/src/client/cluster_client.cpp +++ b/src/client/cluster_client.cpp @@ -955,7 +955,7 @@ void cluster_client_t::slice_rw(cluster_op_t *op) ? (stripe + pg_block_size) : (op->offset + op->len); op->parts[i].iov.reset(); op->parts[i].flags = 0; - if (op->cur_inode != op->inode || op->opcode == OSD_OP_READ && dirty_copied) + if (op->opcode != OSD_OP_READ_CHAIN_BITMAP && op->cur_inode != op->inode || op->opcode == OSD_OP_READ && dirty_copied) { // Read remaining parts from upper layers uint64_t prev = begin, cur = begin; diff --git a/tests/run_3osds.sh b/tests/run_3osds.sh index 901fa266..52e6763d 100644 --- a/tests/run_3osds.sh +++ b/tests/run_3osds.sh @@ -83,16 +83,19 @@ fi POOLCFG='"name":"testpool","failure_domain":"osd",'$POOLCFG $ETCDCTL put /vitastor/config/pools '{"1":{'$POOLCFG',"pg_size":'$PG_SIZE',"pg_minsize":'$PG_MINSIZE',"pg_count":'$PG_COUNT'}}' -wait_up() +wait_pool_up() { local sec=$1 + local pool=$2 + local pgsize=$3 + local pgcount=$4 local i=0 local configured=0 while [[ $i -lt $sec ]]; do - if $ETCDCTL get /vitastor/pg/config --print-value-only | jq -s -e '(. | length) != 0 and ([ .[0].items["1"][] | - select(((.osd_set | select(. != 0) | sort | unique) | length) == '$PG_SIZE') ] | length) == '$PG_COUNT; then + if $ETCDCTL get /vitastor/pg/config --print-value-only | jq -s -e '(. | length) != 0 and ([ .[0].items["'$pool'"][] | + select(((.osd_set | select(. != 0) | sort | unique) | length) == '$pgsize') ] | length) == '$pgcount; then configured=1 - if $ETCDCTL get /vitastor/pg/state/1/ --prefix --print-value-only | jq -s -e '[ .[] | select(.state == ["active"]) ] | length == '$PG_COUNT; then + if $ETCDCTL get /vitastor/pg/state/$pool/ --prefix --print-value-only | jq -s -e '[ .[] | select(.state == ["active"]) ] | length == '$pgcount; then break fi fi @@ -107,6 +110,11 @@ wait_up() done } +wait_up() +{ + wait_pool_up "$1" 1 $PG_SIZE $PG_COUNT +} + if [[ $OSD_COUNT -gt 0 ]]; then wait_up 120 fi diff --git a/tests/run_tests.sh b/tests/run_tests.sh index b193cb9e..d59b1f7b 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -68,6 +68,8 @@ TEST_NAME=csum_4k_dmj OSD_ARGS="--data_csum_type crc32c --inmemory_metadata fal TEST_NAME=csum_4k_dj OSD_ARGS="--data_csum_type crc32c --inmemory_journal false" OFFSET_ARGS=$OSD_ARGS ./test_heal.sh TEST_NAME=csum_4k OSD_ARGS="--data_csum_type crc32c" OFFSET_ARGS=$OSD_ARGS ./test_heal.sh +./test_snapshot_pool2.sh + ./test_osd_tags.sh ./test_enospc.sh diff --git a/tests/test_snapshot_pool2.sh b/tests/test_snapshot_pool2.sh new file mode 100755 index 00000000..2cd97faa --- /dev/null +++ b/tests/test_snapshot_pool2.sh @@ -0,0 +1,38 @@ +#!/bin/bash -ex + +. `dirname $0`/run_3osds.sh +check_qemu + +# snapshot in another pool + +build/src/cmd/vitastor-cli --etcd_address $ETCD_URL create-pool testpool2 -s 3 -n 4 --failure_domain osd + +wait_pool_up 30 2 3 4 + +build/src/cmd/vitastor-cli --etcd_address $ETCD_URL create -s 128M testchain -p testpool + +LD_PRELOAD="build/src/client/libfio_vitastor.so" \ + fio -thread -name=test -ioengine=build/src/client/libfio_vitastor.so -bs=1M -direct=1 -iodepth=4 -fsync=1 -rw=write \ + -etcd=$ETCD_URL -image=testchain -mirror_file=./testdata/bin/mirror.bin -buffer_pattern=0xabcd + +build/src/cmd/vitastor-cli --etcd_address $ETCD_URL snap-create testchain@snap1 -p testpool2 + +LD_PRELOAD="build/src/client/libfio_vitastor.so" \ + fio -thread -name=test -ioengine=build/src/client/libfio_vitastor.so -bs=4k -direct=1 -iodepth=4 -end_fsync=1 -rw=randwrite -number_ios=32 \ + -etcd=$ETCD_URL -image=testchain -mirror_file=./testdata/bin/mirror.bin -buffer_pattern=0xabcd + +build/src/cmd/vitastor-cli --etcd_address $ETCD_URL dd iimg=testchain of=./testdata/bin/res.bin bs=128k iodepth=4 + +cmp ./testdata/bin/res.bin ./testdata/bin/mirror.bin + +build/src/cmd/vitastor-cli --etcd_address $ETCD_URL dd iimg=testchain of=./testdata/bin/res.bin bs=32k iodepth=4 conv=nosparse + +cmp ./testdata/bin/res.bin ./testdata/bin/mirror.bin + +qemu-img convert -p \ + -f raw "vitastor:etcd_host=127.0.0.1\:$ETCD_PORT/v3:image=testchain" \ + -O raw ./testdata/bin/res.bin + +cmp ./testdata/bin/res.bin ./testdata/bin/mirror.bin + +format_green OK