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

Move files + update cache one by one instead of bulk update #13775

Closed
PVince81 opened this issue Jan 29, 2015 · 5 comments
Closed

Move files + update cache one by one instead of bulk update #13775

PVince81 opened this issue Jan 29, 2015 · 5 comments
Labels

Comments

@PVince81
Copy link
Contributor

When moving a huge folder, the following happens:

  1. Every file is moved one by one to the target folders (sometimes even copied in cross-storage situations)
  2. The cache is updated at the very end, for all files

If a PHP timeout occurs and/or the process is killed, the discrepancy between cache and filesystem is very big.

We should rather move the files one by one, and for each moved file, update the cache directly.
This way at if there is a crash, the database would still be in sync with the last change. The unmoved files would still be in their old location with their matching cache entries. The most damage that would happen is a single broken file.

@icewind1991 @MorrisJobke @DeepDiver1975 what do you think ?

But on a local FS I'd still expect the FS rename() to be atomic, so the benefit would mostly be on non-local storages. But even for local storages, the huge final DB update for all the entries might be huge and take time.

@PVince81
Copy link
Contributor Author

PVince81 commented Feb 6, 2015

@icewind1991 can you please comment on this ? It might be the solution for #13391

@icewind1991
Copy link
Contributor

For cross storage moves this seems good

@PVince81
Copy link
Contributor Author

PVince81 commented Feb 6, 2015

@icewind1991 I think the problem here #13391 was about local moves. It's just the cache that takes too much time to update at the end, or there is a time window where the disk content and cache are completely different. We need to shrink that time window as much as possible (unless we can come up with a better solution, some kind of locking?)

@icewind1991
Copy link
Contributor

#13948 for the cache issue

@PVince81
Copy link
Contributor Author

PVince81 commented Aug 3, 2015

Problem was fixed through transactional file locking.

@PVince81 PVince81 closed this as completed Aug 3, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Aug 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants