-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Use transactions when renaming directory contents #13948
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
Conversation
Wow, okay |
While this might speed up database update, the time window where the filesystem contents and cache do not match will still exist (and any file operation happening in-between will trigger a scanner process that will try and update it). So that ticket will probably need additional fixes. |
Do we have a unit test that tests this part of code ? (I suppose we do) |
Wow o.O We should check our code more often for such stuff. |
Agree, this should solve the majority of the issues though |
@icewind1991 So this is for a rename of a folder, right? |
Yes, for my test I created a folder with 5k small files in it |
Yes |
The inspection completed: 4 new issues |
Refer to this link for build results (access rights to CI server needed): |
Let me test with mysql and postgres again. |
Works with Postgres 9.4 and Mysql 5.6 too. |
I guess this reduces my problem with the data loss while renaming such a folder a lot. @DeepDiver1975 @karlitschek I would propose this for backporting at least to stable8 (for 8.0.1 maybe) |
Sorry. We only backport serious bugfixes. The risk for something is too high. |
We can do even better: #13956 uses some dark sql rituals to bring the whole thing down to a single query. |
Black magic has been verified by me: 👍 |
Use transactions when renaming directory contents
@karlitscheck so... data loss on folder renames isn't a serious bug ? |
If you care about a users opinion (using it at our company, ~25 users): I consider this issue to be critical, not just serious. We started to plan migrating to another sync solution because of occasional data loss with OC. |
@bcg-didi Same for us (~31 users). I reported various bugs related to file operations, none of them was fixed so far, and some of them was closed for no reason. If these bugs are not resolved soon, we will migrate to another sync solution too (which we are already testing). |
@karlitschek Should I prepare a backport PR? |
yes please - thx |
Backport: #14752 |
Hey guys, So to conclude this, please prove me wrong, but I can see no error handling here which could corrupt the data! |
@icewind1991 @PVince81 Please have a look at the comment. Is there an error handling in place? I don't think so. What can we do in this case? Retry for ourself? or rollback this somehow? |
Not sure. It seems we have autocommit enabled here https://github.com/owncloud/core/blob/master/lib/private/db/connectionfactory.php#L109. We probably need to find all locations in the code that have transactions and add a catch block that rolls back, as advised here: http://doctrine-dbal.readthedocs.org/en/latest/reference/transactions.html#transactions |
@Helios07 @icewind1991 @PVince81 to not forget about this I opened a technical debt ticket: #16445 |
Thank you very much. |
Ping? We just got owncloud/client#3275, and I think it's really serious to resolve this properly. /cc @DeepDiver1975 |
@danimo this PR was already merged a while ago |
@icewind1991 any reason why the update of the actual parent folder isn't inside the transaction ? https://github.com/owncloud/core/pull/13948/files#diff-fb4e3a03c02988e8dde2af0b55f7b96fR421 |
Or "how to save 99% execution time with 2 simple lines" 😄
From 33s to ~600ms when moving ~5000 files (comparison)
For #13391
cc @PVince81 @DeepDiver1975