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

fix update mtime before close #3552

Merged
merged 2 commits into from
May 5, 2023
Merged

fix update mtime before close #3552

merged 2 commits into from
May 5, 2023

Conversation

davies
Copy link
Contributor

@davies davies commented May 4, 2023

Currently, it updates mtime as it updates the chunks in meta engine after data persisted. Actually, the mtime should be the time when data was written from kernel or application, not the time when data is persisted.

Especially, a setattr could be called to update mtime before data is persisted, then the mtime could be lost (overwritten by data persistency).

close #3204

@github-actions
Copy link

github-actions bot commented May 4, 2023

Mutate Test Report
pkg/fs/fs_test.go-4-4: score:0.00 failed:0, passed:0, compile error:0, out of coverage:110, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4883640473/jobs/8715354301

pkg/meta/benchmarks_test.go-1-1: score:0.00 failed:0, passed:0, compile error:0, out of coverage:0, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4883640473/jobs/8715354450

pkg/meta/load_dump_test.go-1-1: score:0.00 failed:0, passed:0, compile error:0, out of coverage:0, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4883640473/jobs/8715354587

pkg/fs/fs_test.go-3-4: score:0.00 failed:0, passed:0, compile error:0, out of coverage:112, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4883640473/jobs/8715354158

pkg/fs/fs_test.go-2-4: score:0.00 failed:0, passed:0, compile error:2, out of coverage:110, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4883640473/jobs/8715353991

pkg/fs/fs_test.go-1-4: score:0.67 failed:2, passed:4, compile error:0, out of coverage:106, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4883640473/jobs/8715353833

pkg/object/object_storage_test.go-1-1: score:0.17 failed:10, passed:2, compile error:1, out of coverage:0, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4883640473/jobs/8715355413

pkg/meta/sql_test.go-2-4: score:0.24 failed:107, passed:34, compile error:28, out of coverage:228, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4883640473/jobs/8715354951

pkg/meta/sql_test.go-1-4: score:0.36 failed:148, passed:84, compile error:82, out of coverage:83, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4883640473/jobs/8715354780

pkg/meta/sql_test.go-4-4: score:0.46 failed:130, passed:112, compile error:40, out of coverage:112, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4883640473/jobs/8715355250

pkg/meta/sql_test.go-3-4: score:0.30 failed:215, passed:92, compile error:41, out of coverage:49, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4883640473/jobs/8715355108

Usage: https://github.com/juicedata/juicefs/blob/main/.github/scripts/mutate/how_to_use_mutate_test.md

@davies davies requested review from SandyXSD and Hexilee May 5, 2023 05:26
@SandyXSD
Copy link
Contributor

SandyXSD commented May 5, 2023

ext4 keeps only mtime when calling cp -p, while this patch keeps both mtime & ctime.

@SandyXSD
Copy link
Contributor

SandyXSD commented May 5, 2023

2023.05.05 13:36:13.120396 [uid:0,gid:0,pid:2766215] create (1,f6,-rw-------:0100600): OK (106,[-rw-------:0100600,1,0,0,1683264973,1683264973,1683264973,0]) [fh:11] <0.005093>
2023.05.05 13:36:13.120639 [uid:0,gid:0,pid:2766215] write (106,6,0,11): OK <0.000080>
2023.05.05 13:36:13.124289 [uid:0,gid:0,pid:2766215] setattr (106,0x30,[atime=1683264362,mtime=1683264360]): OK (106,[-rw-------:0100600,1,0,0,1683264362,1683264360,1683264973,6]) <0.003587>
2023.05.05 13:36:13.127715 [uid:0,gid:0,pid:2766215] setattr (106,0x1,[mode=-rw-r--r--:00644]): OK (106,[-rw-r--r--:0100644,1,0,0,1683264362,1683264360,1683264973,6]) <0.003295>
2023.05.05 13:36:13.132018 [uid:0,gid:0,pid:2766215] flush (106,11,084FBC3B32EACE4F): OK <0.004193>
2023.05.05 13:36:13.132120 [uid:0,gid:0,pid:0] release (106,11): OK <0.000015>

Access log shows that it sets the atime & mtime explicitly after write.

@codecov-commenter
Copy link

codecov-commenter commented May 5, 2023

Codecov Report

Patch coverage: 67.85% and project coverage change: +0.04 🎉

Comparison is base (11bac39) 56.47% compared to head (def0353) 56.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3552      +/-   ##
==========================================
+ Coverage   56.47%   56.51%   +0.04%     
==========================================
  Files         149      149              
  Lines       36323    36511     +188     
==========================================
+ Hits        20514    20635     +121     
- Misses      13552    13618      +66     
- Partials     2257     2258       +1     
Impacted Files Coverage Δ
cmd/mdtest.go 26.70% <0.00%> (ø)
pkg/meta/interface.go 55.00% <ø> (ø)
pkg/meta/sql.go 58.61% <33.33%> (-0.33%) ⬇️
pkg/meta/tkv.go 71.51% <33.33%> (-0.07%) ⬇️
pkg/vfs/writer.go 78.24% <71.42%> (+0.76%) ⬆️
pkg/meta/redis.go 66.82% <100.00%> (-0.11%) ⬇️
pkg/vfs/vfs_unix.go 91.36% <100.00%> (+0.12%) ⬆️

... and 13 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link

github-actions bot commented May 5, 2023

Mutate Test Report
pkg/meta/benchmarks_test.go-1-1: score:0.00 failed:0, passed:0, compile error:0, out of coverage:0, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4890437351/jobs/8729932946

pkg/meta/load_dump_test.go-1-1: score:0.00 failed:0, passed:0, compile error:0, out of coverage:0, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4890437351/jobs/8729933023

pkg/fs/fs_test.go-3-4: score:0.00 failed:0, passed:0, compile error:0, out of coverage:112, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4890437351/jobs/8729932801

pkg/fs/fs_test.go-2-4: score:0.00 failed:0, passed:0, compile error:2, out of coverage:110, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4890437351/jobs/8729932726

pkg/fs/fs_test.go-4-4: score:0.00 failed:0, passed:0, compile error:0, out of coverage:110, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4890437351/jobs/8729932879

pkg/object/object_storage_test.go-1-1: score:0.17 failed:10, passed:2, compile error:1, out of coverage:0, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4890437351/jobs/8729933324

pkg/fs/fs_test.go-1-4: score:0.67 failed:2, passed:4, compile error:0, out of coverage:106, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4890437351/jobs/8729932637

pkg/meta/sql_test.go-2-4: score:0.25 failed:105, passed:35, compile error:28, out of coverage:230, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4890437351/jobs/8729933144

pkg/meta/sql_test.go-1-4: score:0.36 failed:148, passed:85, compile error:82, out of coverage:83, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4890437351/jobs/8729933088

pkg/meta/sql_test.go-4-4: score:0.46 failed:130, passed:109, compile error:40, out of coverage:115, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4890437351/jobs/8729933258

pkg/meta/sql_test.go-3-4: score:0.32 failed:208, passed:100, compile error:41, out of coverage:49, skip by comment:0, others:0
Job detail: https://github.com/juicedata/juicefs/actions/runs/4890437351/jobs/8729933200

Usage: https://github.com/juicedata/juicefs/blob/main/.github/scripts/mutate/how_to_use_mutate_test.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cp -p in the filesystem updates both mtime and ctime when it should only update ctime.
4 participants