-
-
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
Prevent hitting the directory limit when creating image previews (#13091) #16747
Conversation
Signed-off-by: Aldo Mazzeo <aldo.mazzeo@gmail.com>
Signed-off-by: Aldo Mazzeo <aldo.mazzeo@gmail.com>
@kesselb looks like the CI failed, but I don't think that it's related to my changes: what do you think about it? |
@gbmaster the tests need to be adjusted for the new folder ids. |
@kesselb the remaining tests are failing mostly because the amount of files in the preview folder is different from before. It is failing at /drone/src/tests/lib/Preview/BackgroundCleanupJobTest.php:121 is there any elegant way on how to fix these? I am failing to find one, at the moment. |
Me too 🙈 |
Signed-off-by: Aldo Mazzeo <aldo.mazzeo@gmail.com>
@kesselb I managed to write a function that returns the amount of files a preview has been generated for. However, BackgroundCleanupJob is still failing in deleting the previews when its file is removed. I tried to fix the getFolder statement, but it seems to me that the query should be adjusted as well. |
Hello, I'm facing the same issue there : Too many links (FreeBSD with "freebsd-ufs" filesystem). Regards, -- |
Hi @pousterlus |
Understood ! -- |
|
Yeah, obviously, I wasn't talking about the filesystems limitations, but I meant Nextcloud's implementation preview system, as a cloud solution is likely to store years of unnecessary pictures and backups. -- |
How is that related to this pull request? This pull requests puts previews into subfolders to workaround the 32k preview limit on ufs. Does not happen on ext3/ext4/etc... |
Now I understand it's not a Nextcloud bug but a filesystem limitation I wasn't aware of. -- |
Unfortunately 😞 It's somehow related to the way how we detect previews of deleted files.
Somehow it tries to delete the first folder instead of the matching preview. I have no idea right now how to traverse from the first folder to the matching preview file. It's a "convention" that the folder name is the id of the source file. |
Yeah, @kesselb . I think we're very close... the query needs to be readjusted somehow... I'm still struggling to find a decent solution :( |
I think we need to include the original fileid again:
Then change the above query to select every row that matches I don't know if this is possible with sql (and works for sqlite, oracle, postgres and mysql) and is somehow performant. |
I have had time to think about this. But we should abstract more. I will tackel this once we branch off. If it is not to intrusive we can backport. |
This comment has been minimized.
This comment has been minimized.
This comment is not off-topic because ext3/ext4 may have a limit on the number of sub-directories, too. |
Oh dear. We are already beyond this point. All previews in on folder is bad. That's probably also happening for FAT16, FAT32, NTFS, ReiserFS, ZFS, add your file system here. The solution you (and others) proposed is accepted. We are discussing a potential patch already (this pull request). Turns out putting previews in sub folders will break the current way how previews are removed if a file is deleted.
He will look into if the development window for Nextcloud 19 starts. That's sometime after Nextcloud 18 has been released. If you have the same issue please use 👍 (on the first post). The solution will put previews in sub folders. That should work for most file systems. Contributing to Nextcloud is appreciated. You can contribute in many ways like triaging issues, submitting patches, helping to specify features, suggest new features or develop apps. Check https://nextcloud.com/contribute/ for more details 😃 |
Just as an idea: Other idea: |
Abandoning in favor of #19214 |
Fix #13091 #14169
When creating image previews, the previous code was creating a folder in the "preview" folder using the file ID as a name. When the number of folders exceeds 32767, it is impossible to create further preview on some filesystems because of the "Too many links" error.
I changed the code in order to split the file ID into digits and using them to create a tree of folders, preventing the hit of the directory limit. This fixes the issue experienced by @giraudeo on FreeBSD and by me on OpenBSD.
Please consider this pull request.