Fix inode creation when /index/maxid is out of sync

This commit is contained in:
Vitaliy Filippov
2022-06-06 16:35:51 +03:00
parent 3b7c6dcac2
commit 1eec4407ab
3 changed files with 25 additions and 1 deletions
+2
View File
@@ -12,6 +12,8 @@ SCHEME=ec ./test_change_pg_count.sh
./test_change_pg_size.sh
./test_create_nomaxid.sh
./test_etcd_fail.sh
./test_failure_domain.sh
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash -ex
# Test vitastor-cli create when /index/maxid is out of sync
. `dirname $0`/run_3osds.sh
$ETCDCTL put /vitastor/config/inode/1/120 '{"name":"testimg","size":'$((1024*1024*1024))'}'
build/src/vitastor-cli create --etcd_address $ETCD_URL -s 1G testimg2
t=$($ETCDCTL get --print-value-only /vitastor/config/inode/1/121 | jq -r .name)
if [[ "$t" != "testimg2" ]]; then
format_error "testimg2 should've been created as inode 121"
fi
t=$($ETCDCTL get --print-value-only /vitastor/index/maxid/1)
if [[ "$t" != 121 ]]; then
format_error "/index/maxid should've been set to 121"
fi
format_green OK