Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nlink incorrect when dump with --skip-trash #4624

Open
zhoucheng361 opened this issue Apr 1, 2024 · 1 comment
Open

nlink incorrect when dump with --skip-trash #4624

zhoucheng361 opened this issue Apr 1, 2024 · 1 comment
Labels
priority/normal The default priority

Comments

@zhoucheng361
Copy link
Contributor

What happened:


./juicefs format tikv://localhost:2379/test myjfs --trash-days $trash_days --enable-acl
./juicefs mount -d tikv://localhost:2379/test /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/fsrand2.py || true
./juicefs dump  tikv://localhost:2379/test dump.json --skip-trash
rm -rf test2.db
./juicefs load sqlite3://test2.db dump.json
./juicefs dump sqlite3://test2.db dump2.json --skip-trash

diff dump.json dump2.json
--- dump.json.bak	2024-04-01 15:03:43.232752299 +0800
+++ dump2.json.bak	2024-04-01 15:03:43.232752299 +0800
@@ -152,7 +152,7 @@
             }
           },
           "fnnw": {
-            "attr": {"inode":0,"type":"regular","mode":440,"uid":0,"gid":0,"atime":1711954992,"mtime":1711954992,"ctime":1711954997,"atimensec":743978721,"mtimensec":746723565,"ctimensec":474743498,"nlink":5,"length":4},
+            "attr": {"inode":0,"type":"regular","mode":440,"uid":0,"gid":0,"atime":1711954992,"mtime":1711954992,"ctime":1711954997,"atimensec":743978721,"mtimensec":746723565,"ctimensec":474743498,"nlink":3,"length":4},
             "posix_acl_access": {"owner":6,"group":0,"other":0,"mask":7,"users":[{"id":0,"perm":2},{"id":1005,"perm":7},{"id":1006,"perm":0},{"id":1007,"perm":7}],"groups":[{"id":0,"perm":6},{"id":1005,"perm":7},{"id":1006,"perm":0},{"id":1007,"perm":7},{"id":1009,"perm":2},{"id":1010,"perm":1},{"id":1011,"perm":1}]},
             "chunks": [{"index":0,"slices":[{"id":54,"size":4,"len":4}]}]
           },
@@ -216,7 +216,7 @@
             "chunks": [{"index":0,"slices":[{"id":48,"size":5,"len":5}]}]
           },
           "inla": {
-            "attr": {"inode":0,"type":"regular","mode":440,"uid":0,"gid":0,"atime":1711954993,"mtime":1711954993,"ctime":1711954997,"atimensec":490562418,"mtimensec":493838365,"ctimensec":499122371,"nlink":2,"length":8},
+            "attr": {"inode":0,"type":"regular","mode":440,"uid":0,"gid":0,"atime":1711954993,"mtime":1711954993,"ctime":1711954997,"atimensec":490562418,"mtimensec":493838365,"ctimensec":499122371,"nlink":1,"length":8},
             "posix_acl_access": {"owner":6,"group":0,"other":0,"mask":7,"users":[{"id":0,"perm":2},{"id":1005,"perm":7},{"id":1006,"perm":0},{"id":1007,"perm":7}],"groups":[{"id":0,"perm":6},{"id":1005,"perm":7},{"id":1006,"perm":0},{"id":1007,"perm":7},{"id":1009,"perm":2},{"id":1010,"perm":1},{"id":1011,"perm":1}]},
             "chunks": [{"index":0,"slices":[{"id":55,"size":8,"len":8}]}]
           },
@@ -385,7 +385,7 @@
             }
           },
           "pjad": {
-            "attr": {"inode":0,"type":"regular","mode":440,"uid":0,"gid":0,"atime":1711954992,"mtime":1711954992,"ctime":1711954997,"atimensec":743978721,"mtimensec":746723565,"ctimensec":474743498,"nlink":5,"length":4},
+            "attr": {"inode":0,"type":"regular","mode":440,"uid":0,"gid":0,"atime":1711954992,"mtime":1711954992,"ctime":1711954997,"atimensec":743978721,"mtimensec":746723565,"ctimensec":474743498,"nlink":3,"length":4},
             "posix_acl_access": {"owner":6,"group":0,"other":0,"mask":7,"users":[{"id":0,"perm":2},{"id":1005,"perm":7},{"id":1006,"perm":0},{"id":1007,"perm":7}],"groups":[{"id":0,"perm":6},{"id":1005,"perm":7},{"id":1006,"perm":0},{"id":1007,"perm":7},{"id":1009,"perm":2},{"id":1010,"perm":1},{"id":1011,"perm":1}]},
             "chunks": [{"index":0,"slices":[{"id":54,"size":4,"len":4}]}]
           },
@@ -749,7 +749,7 @@
             }
           },
           "ynyc": {
-            "attr": {"inode":0,"type":"regular","mode":440,"uid":0,"gid":0,"atime":1711954992,"mtime":1711954992,"ctime":1711954997,"atimensec":743978721,"mtimensec":746723565,"ctimensec":474743498,"nlink":5,"length":4},
+            "attr": {"inode":0,"type":"regular","mode":440,"uid":0,"gid":0,"atime":1711954992,"mtime":1711954992,"ctime":1711954997,"atimensec":743978721,"mtimensec":746723565,"ctimensec":474743498,"nlink":3,"length":4},
             "posix_acl_access": {"owner":6,"group":0,"other":0,"mask":7,"users":[{"id":0,"perm":2},{"id":1005,"perm":7},{"id":1006,"perm":0},{"id":1007,"perm":7}],"groups":[{"id":0,"perm":6},{"id":1005,"perm":7},{"id":1006,"perm":0},{"id":1007,"perm":7},{"id":1009,"perm":2},{"id":1010,"perm":1},{"id":1011,"perm":1}]},
             "chunks": [{"index":0,"slices":[{"id":54,"size":4,"len":4}]}]
           },

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?

Environment:

  • JuiceFS version (use juicefs --version) or Hadoop Java SDK version:
  • Cloud provider or hardware configuration running JuiceFS:
  • OS (e.g cat /etc/os-release):
  • Kernel (e.g. uname -a):
  • Object storage (cloud provider and region, or self maintained):
  • Metadata engine info (version, cloud provider managed or self maintained):
  • Network connectivity (JuiceFS to metadata engine, JuiceFS to object storage):
  • Others:
@zhoucheng361 zhoucheng361 added the kind/bug Something isn't working label Apr 1, 2024
@davies davies removed the kind/bug Something isn't working label Apr 2, 2024
@zhijian-pro
Copy link
Contributor

A certain file has 4 hard links, of which 2 have been deleted and moved to the trash. At this time, its nlink is 5. When using dump --skip-trash, the nlink in the resulting JSON file is also 5. However, during loading, the nlink was recalculated and after loading it became 3.

@SandyXSD SandyXSD added the priority/normal The default priority label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/normal The default priority
Projects
None yet
Development

No branches or pull requests

4 participants