Fix test_scrub with BIG_INTENTs
This commit is contained in:
@@ -171,6 +171,9 @@ bool journal_flusher_co::loop()
|
||||
else if (wait_state == 16) goto resume_16;
|
||||
else if (wait_state == 17) goto resume_17;
|
||||
else if (wait_state == 18) goto resume_18;
|
||||
else if (wait_state == 19) goto resume_19;
|
||||
else if (wait_state == 20) goto resume_20;
|
||||
else if (wait_state == 21) goto resume_21;
|
||||
resume_0:
|
||||
wait_state = 0;
|
||||
wait_count = 0;
|
||||
@@ -182,7 +185,12 @@ resume_0:
|
||||
bs->intent_write_counter = 0;
|
||||
resume_17:
|
||||
resume_18:
|
||||
if (!trim_lsn(17))
|
||||
resume_19:
|
||||
if (!fsync_buffer(17))
|
||||
return false;
|
||||
resume_20:
|
||||
resume_21:
|
||||
if (!trim_lsn(20))
|
||||
return false;
|
||||
}
|
||||
if (res == ENOENT && flusher->force_start > 0 && co_id == 0 &&
|
||||
|
||||
@@ -224,7 +224,6 @@ enospc:
|
||||
PRIV(op)->lsn = obj->lsn;
|
||||
}
|
||||
prepare_meta_block_write(PRIV(op)->modified_block);
|
||||
intent_write_counter++;
|
||||
PRIV(op)->pending_ops++;
|
||||
PRIV(op)->op_state = 9;
|
||||
write_iodepth++;
|
||||
@@ -421,16 +420,27 @@ resume_8:
|
||||
printf("Ack write %jx:%jx v%ju\n", op->oid.inode, op->oid.stripe, op->version);
|
||||
#endif
|
||||
op->retval = op->len;
|
||||
if (PRIV(op)->write_type == BS_HEAP_BIG_INTENT ||
|
||||
PRIV(op)->write_type == BS_HEAP_INTENT_WRITE ||
|
||||
PRIV(op)->write_type == BS_HEAP_SMALL_WRITE)
|
||||
heap->complete_lsn_write(PRIV(op)->lsn);
|
||||
if (PRIV(op)->write_type == BS_HEAP_BIG_WRITE ||
|
||||
PRIV(op)->write_type == BS_HEAP_BIG_INTENT ||
|
||||
PRIV(op)->write_type == BS_HEAP_INTENT_WRITE)
|
||||
if (PRIV(op)->write_type == BS_HEAP_BIG_WRITE)
|
||||
{
|
||||
unsynced_data_write_count++;
|
||||
else if (PRIV(op)->write_type != BS_HEAP_DELETE)
|
||||
}
|
||||
else if (PRIV(op)->write_type == BS_HEAP_SMALL_WRITE)
|
||||
{
|
||||
unsynced_buffer_write_count++;
|
||||
heap->complete_lsn_write(PRIV(op)->lsn);
|
||||
}
|
||||
else if (PRIV(op)->write_type == BS_HEAP_BIG_INTENT ||
|
||||
PRIV(op)->write_type == BS_HEAP_INTENT_WRITE)
|
||||
{
|
||||
unsynced_data_write_count++;
|
||||
intent_write_counter++;
|
||||
heap->complete_lsn_write(PRIV(op)->lsn);
|
||||
}
|
||||
else if (PRIV(op)->write_type == _REDIRECT_INTENT)
|
||||
{
|
||||
unsynced_data_write_count++;
|
||||
intent_write_counter++;
|
||||
}
|
||||
write_iodepth--;
|
||||
FINISH_OP(op);
|
||||
return 2;
|
||||
|
||||
+9
-3
@@ -7,14 +7,16 @@ if [[ ("$SCHEME" = "" || "$SCHEME" = "replicated") && ("$PG_SIZE" = "" || "$PG_S
|
||||
OSD_COUNT=2
|
||||
fi
|
||||
|
||||
OSD_ARGS="--scrub_list_limit 1000 $OSD_ARGS"
|
||||
IMG_SIZE=128
|
||||
|
||||
# OSD uses BIG_INTENTs, so we set journal_trim_interval exactly equal to the object count
|
||||
# to force it do it just 1 trim_lsn().
|
||||
OSD_ARGS="--scrub_list_limit 1000 --journal_trim_interval $((IMG_SIZE*8)) $OSD_ARGS"
|
||||
|
||||
. `dirname $0`/run_3osds.sh
|
||||
|
||||
check_qemu
|
||||
|
||||
IMG_SIZE=128
|
||||
|
||||
$ETCDCTL put /vitastor/config/inode/1/1 '{"name":"testimg","size":'$((IMG_SIZE*1024*1024))'}'
|
||||
|
||||
# Write
|
||||
@@ -22,6 +24,8 @@ 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 \
|
||||
-mirror_file=./testdata/bin/mirror.bin -end_fsync=1 -rw=write -etcd=$ETCD_URL -image=testimg
|
||||
|
||||
sleep 1
|
||||
|
||||
# Save PG primary
|
||||
primary=$($ETCDCTL get --print-value-only /vitastor/pg/config | jq -r '.items["1"]["1"].primary')
|
||||
|
||||
@@ -34,6 +38,7 @@ data_offset=$(build/src/disk_tool/vitastor-disk simple-offsets ./testdata/bin/te
|
||||
truncate -s $data_offset ./testdata/bin/test_osd$ZERO_OSD.bin
|
||||
dd if=/dev/zero of=./testdata/bin/test_osd$ZERO_OSD.bin bs=1024 count=1 seek=$((OSD_SIZE*1024-1))
|
||||
$ETCDCTL del /vitastor/osd/state/$ZERO_OSD
|
||||
mv ./testdata/osd$ZERO_OSD.log ./testdata/osd${ZERO_OSD}_pre.log
|
||||
start_osd $ZERO_OSD
|
||||
|
||||
# Wait until start
|
||||
@@ -50,6 +55,7 @@ wait_condition 300 "$ETCDCTL get --prefix /vitastor/pg/history/ --print-value-on
|
||||
|
||||
if [[ ($SCHEME = replicated && $PG_SIZE < 3) || ($SCHEME != replicated && $((PG_SIZE-PG_DATA_SIZE)) < 2) ]]; then
|
||||
# Check that objects are marked as inconsistent if 2 replicas or EC/XOR 2+1
|
||||
build/src/cmd/vitastor-cli describe --etcd_address $ETCD_URL --json &>./testdata/describe.log
|
||||
build/src/cmd/vitastor-cli describe --etcd_address $ETCD_URL --json | jq -e '[ .[] | select(.inconsistent) ] | length == '$((IMG_SIZE * 8 * PG_SIZE / (SCHEME = replicated ? 1 : PG_DATA_SIZE)))
|
||||
|
||||
# Fix objects using vitastor-cli fix
|
||||
|
||||
Reference in New Issue
Block a user