Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoucheng361 committed Jan 4, 2025
1 parent e1bdcb3 commit e8188c9
Showing 1 changed file with 36 additions and 43 deletions.
79 changes: 36 additions & 43 deletions .github/scripts/command/load_dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,50 +24,63 @@ mc alias set myminio http://localhost:9000 minioadmin minioadmin
python3 -c "import xattr" || sudo pip install xattr

test_dump_load_with_iflag(){
do_dump_load_with_iflag
}

test_dump_load_with_iflag_binary(){
do_dump_load_with_iflag --binary
}

do_dump_load_with_iflag(){
option=$@
prepare_test
./juicefs format $META_URL myjfs
./juicefs mount -d $META_URL /jfs --enable-ioctl
echo "hello" > /jfs/hello.txt
chattr +i /jfs/hello.txt
./juicefs dump $META_URL dump.json --fast
./juicefs dump $META_URL dump.json $option
umount_jfs /jfs $META_URL
python3 .github/scripts/flush_meta.py $META_URL
./juicefs load $META_URL dump.json
./juicefs load $META_URL dump.json $option
./juicefs mount -d $META_URL /jfs --enable-ioctl
echo "hello" > /jfs/hello.txt && echo "write should fail" && exit 1 || true
chattr -i /jfs/hello.txt
echo "world" > /jfs/hello.txt
cat /jfs/hello.txt | grep world
}

test_dump_with_keep_secret()
test_dump_load_with_keep_secret_key(){
do_dump_load_with_keep_secret_key
}

test_dump_load_with_keep_secret_key_in_binary(){
do_dump_load_with_keep_secret_key --binary
}

do_dump_load_with_keep_secret_key()
{
option=$@
prepare_test
./juicefs format $META_URL myjfs --storage minio --bucket http://localhost:9000/test --access-key minioadmin --secret-key minioadmin
./juicefs dump --keep-secret-key $META_URL dump.json --fast
cat dump.json
./juicefs dump --keep-secret-key $META_URL dump.json $option
python3 .github/scripts/flush_meta.py $META_URL
./juicefs load $META_URL dump.json
./juicefs load $META_URL dump.json $option
./juicefs mount -d $META_URL /jfs
echo "hello" > /jfs/hello.txt
cat /jfs/hello.txt | grep hello
}

test_dump_without_keep_secret()
{
prepare_test
./juicefs format $META_URL myjfs --storage minio --bucket http://localhost:9000/test --access-key minioadmin --secret-key minioadmin
./juicefs dump $META_URL dump.json --fast
cat dump.json
umount_jfs /jfs $META_URL
./juicefs dump $META_URL dump.json $option
python3 .github/scripts/flush_meta.py $META_URL
./juicefs load $META_URL dump.json
./juicefs load $META_URL dump.json $option
./juicefs mount -d $META_URL /jfs && echo "mount should fail" && exit 1 || true
./juicefs config --secret-key minioadmin $META_URL
./juicefs mount -d $META_URL /jfs
echo "hello" > /jfs/hello.txt
cat /jfs/hello.txt | grep hello
}


test_dump_load_with_trash_enable(){
do_dump_load_with_fsrand 1
}
Expand All @@ -81,48 +94,28 @@ do_dump_load_with_fsrand(){
./juicefs format $META_URL myjfs --trash-days $trash_days --enable-acl
./juicefs mount -d $META_URL /jfs --enable-xattr
SEED=$SEED LOG_LEVEL=WARNING MAX_EXAMPLE=30 STEP_COUNT=20 PROFILE=generate ROOT_DIR1=/jfs/fsrand ROOT_DIR2=/tmp/fsrand python3 .github/scripts/hypo/fs.py || true
# find /jfs/fsrand -mindepth 1 -maxdepth 1 ! -name "syly" -exec rm -rf {} \;
do_dump_load_and_compare
do_dump_load_and_compare --binary
do_dump_load_and_compare --fast
do_dump_load_and_compare --skip-trash
do_dump_load_and_compare --fast --skip-trash
}

test_dump_load_with_fsrand_binary(){
prepare_test
./juicefs format $META_URL myjfs --trash-days 1 --enable-acl
./juicefs mount -d $META_URL /jfs --enable-xattr
SEED=$SEED LOG_LEVEL=WARNING MAX_EXAMPLE=30 STEP_COUNT=20 PROFILE=generate ROOT_DIR1=/jfs/fsrand ROOT_DIR2=/tmp/fsrand python3 .github/scripts/hypo/fs.py || true
do_dump_load_and_compare_in_binary
}

do_dump_load_and_compare()
{
option=$@
echo option is $option
./juicefs dump $META_URL dump.json $option
rm -rf test2.db
./juicefs load sqlite3://test2.db dump.json
if [[ "$option" == *"--binary"* ]]; then
./juicefs load sqlite3://test2.db dump.json $option
else
./juicefs load sqlite3://test2.db dump.json
fi
./juicefs dump sqlite3://test2.db dump2.json $option
# compare_dump_json
./juicefs mount -d sqlite3://test2.db /jfs2
diff -ur /jfs/fsrand /jfs2/fsrand --no-dereference
compare_stat_acl_xattr /jfs/fsrand /jfs2/fsrand
umount /jfs2
}

do_dump_load_and_compare_in_binary()
{
option=$@
echo option is $option
./juicefs dump $META_URL dump.bin $option --binary
rm -rf test2.db
./juicefs load sqlite3://test2.db dump.bin --binary --stat | tee dump.stat
./juicefs load sqlite3://test2.db dump.bin --binary
./juicefs dump sqlite3://test2.db dump2.bin $option
./juicefs load sqlite3://test2.db dump2.bin --binary --stat | tee dump2.stat
diff dump.stat dump2.stat
# compare_dump_json
# if [[ "$option" != *"--binary"* ]]; then
# compare_dump_json
# fi
./juicefs mount -d sqlite3://test2.db /jfs2
diff -ur /jfs/fsrand /jfs2/fsrand --no-dereference
compare_stat_acl_xattr /jfs/fsrand /jfs2/fsrand
Expand Down

0 comments on commit e8188c9

Please sign in to comment.