@@ -42,6 +42,42 @@ test_sync_dir_stat()
42
42
./juicefs info -r /jfs/d | tee info1.log
43
43
./juicefs info -r /jfs/d --strict | tee info2.log
44
44
diff info1.log info2.log
45
+ rm info* .log
46
+ ./juicefs fsck $META_URL --path / --sync-dir-stat --repair -r
47
+ ./juicefs info -r /jfs | tee info1.log
48
+ ./juicefs info -r /jfs --strict | tee info2.log
49
+ diff info1.log info2.log
50
+ }
51
+
52
+ test_fsck_with_random_test ()
53
+ {
54
+ prepare_test
55
+ ./juicefs format $META_URL myjfs
56
+ ./juicefs mount -d $META_URL /jfs
57
+ ./random-test runOp -baseDir /jfs/test -files 500000 -ops 5000000 -threads 50 -dirSize 10 -duration 30s -createOp 30,uniform -deleteOp 5,end --linkOp 10,uniform --removeLinkOp 1,end --symlinkOp 20,uniform --setXattrOp 10,uniform --truncateOp 10,uniform
58
+ ./juicefs fsck $META_URL --path /test --sync-dir-stat --repair -r
59
+ ./juicefs info -r /jfs | tee info1.log
60
+ ./juicefs info -r /jfs --strict | tee info2.log
61
+ diff info1.log info2.log
62
+ }
63
+
64
+ test_fsck_delete_object ()
65
+ {
66
+ prepare_test
67
+ ./juicefs format $META_URL myjfs
68
+ ./juicefs mount -d $META_URL /jfs
69
+ echo " test" > /jfs/test.txt
70
+ sleep 1
71
+ object=$( ./juicefs info /jfs/test.txt | grep chunks | awk ' {print $4}' )
72
+ rm /var/jfs/$object
73
+ ./juicefs fsck $META_URL 2>&1 | tee fsck.log
74
+ grep -q " 1 objects are lost" fsck.log || exit 1
75
+ rm fsck.log
76
+ # ./juicefs fsck $META_URL --path / --sync-dir-stat --repair -r 2>&1 | tee fsck.log
77
+ # grep -q "1 objects are lost" fsck.log || exit 1
78
+ # rm fsck.log
79
+ ./juicefs rmr /jfs/test.txt --skip-trash
80
+ ./juicefs fsck $META_URL || { echo " files is deleted, fsck should success" ; exit 1; }
45
81
}
46
82
47
83
source .github/scripts/common/run_test.sh && run_test $@
0 commit comments