-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
make NextCloud WORM file system friendly #24596
Conversation
8136009
to
75b3261
Compare
@kofemann as far I know you have been running with this in production for some time now right? |
@rullzer We would like to run some tests to validate that other things (like apps) are not broken. Do you have a testsuite that we can run locally? |
the code looks fine to me in general, I'm hoping that the extra unlink will not cause much extra overhead, but we're talking about local storage anyway so should be fine. @icewind1991 thoughts ? |
@kofemann please rebase and resolve the conflicts |
regarding tests, at least the ones with regular storage, are already running in our CI so if something is broken we'll likely see this immediately |
@PVince81 Thanks for the update. Actually, since 2 weeks we run this code with nextcloud 22.2.3 in a production. Up to now we haven't seen any issues. |
that's great to hear! I took the liberty to click "ready for review" |
some strange errors in multiple places:
I'm wondering if the change in this PR somehow interferes with test cleanup, but I can't see how |
This is obviously something that I have to look at. Is it possible to run the test manually? |
this is how I usually test locally: |
I would expect a filesystem to be smart enough to handle the "truncate an existing file and write to it" case, but I'm fine adding some logic for it. It should only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a check if the file exists before deleting it
I have added a coifing option control this behavior. A check before unlink will issue unnecessary stat call. |
@icewind1991 any plans to include this into NC24? |
Some filesystems run as a Write-Once-Read-Many storages. This makes them impossible to use with NexeCloud, as the file system layers uses `truncate` syscall (through file_put_contents function). As Nextcloud is never updates existing files, removing the old entry and creatint a new one on update will allow NextCoud to update on such file systems. Update Local#fopen and Local#file_put_contents to remote existing file before truncating. Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
677382f
to
9bf9c94
Compare
rebased on top of current master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@kofemann the code looks fine. please sign off your commits, see https://github.com/nextcloud/server/pull/24596/checks?check_run_id=8012932504 I'll try and find a second reviewer to get this in. thanks! |
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
9bf9c94
to
b77e205
Compare
To avoid extra truncate on non WORM file systems, add a new config option `localstorage.unlink_on_truncate`, which defaults to false. The OC\Files\Storage\Local is update to respect that option. Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
b77e205
to
f41209a
Compare
No description provided.