-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
occ files_external:notify does not propogate changes to clients. #3524
Comments
I have the same issue. Update : I can not see the reference of the new file in the table oc_filecache |
This issue is a major problem for us because file change by a local SMB Share are not propagate to the nextcloud client. We can help you to fix this issue if we can understand how the sync process works and how the SMB notify works in Nextcloud. |
up ? |
I'm working on this issue, and I have a question. |
If I understand the process correctly, another issue is possible. So, if a user push a file (from web ou client), it is refer in his storage, but all other are not updated ... |
Anyone could explained how NextCloud get file data to store it in the filecache table? |
The notify command doesn't write the new info to the filecache itself. It marks a folder as out-of-date (setting it's size to -1), the background scanner (cron) will then detect that and handle updating the cache. If you're running into issues with the cache not being updated while the notify command works fine, please verify that nextcloud's cron job is running correctly |
So notify works only if a file or folder is changed, what's happen if we add a file ? In addition, scan must have the credential to access to the share especially if we use credential session (ldap user). |
For new files the folder is also marked as outdated and the scanner will find the new files. session credentials might indeed cause issues, not sure, will investigate later |
If we use the session credential, scan can occur only if the user is connected to the web interface. |
If I correctly understand, the windows client use WebDAV to connect with NextCloud. |
is it possible to run two cron jobs? one every minute that only for checking if a folder has been marked as updated? and the other for everything else. I have my cron time set to 15min, so it takes up to 15 minutes before a change is synced. |
I think you can not solve this problem with two cron. |
Multiple parallel cron jobs are supported since NC 10 I think |
Up ? |
I think that the best way to fix this issue is to create a "new" way to scan the files. |
Is it possible to have informations about the file_cache table (column description and waiting values) |
I think a problem exist with the markParentAsOutdated function because it use dirname() php method. |
In addition, path is return from notify with / at the beginning, but files in filecache don't have this (path column). |
Hi |
cc @icewind1991 |
Using 'Login credentials, save in database' instead of 'Login credentials, save in session' should make the file scanner pickup the changes correctly. As for decreasing the "sync interval" you can run |
@icewind1991 Could you add this to the documentation for the notify command? Thanks |
Is this working now with official nextcloud docker image + smbclient? |
@theroch Is things working for you with your patch now? |
@cowai I'm using now nextcloud 15.04 with desktop client 2.5.1. The sync works in this versions now much better, so I didn't test it with my patch. |
@theroch Same versions here. Do each of the files show up in your client? For mine its totally random. |
@MorrisJobke is this a known working feature now? |
Yep - we have quite some instances where this is actively used for big external storages and there it propagates properly the changed files :/ |
@MorrisJobke @icewind1991 I have tried multiple times the last couple of years. Maybe there is something wrong/different with my setup? The smb server is using Windows Server 2012 R2 Standard. The main bug/problem I have is this: The "occ files:scan --unscanned --all" command does not always list every change that the occ files_external:notify command did. This is the procedure to reproduce:
|
@icewind1991 @MorrisJobke In my test 33 bytes are added to testfile1.txt, testfile2.txt and testfile3.txt select path,size from oc_filecache where path like "SHARE/%" #before doing changes: #after changes, parent folders are marked with size -1 correctly: #after running occ files:scan --unscanned --all, note wrong sizes for testfile3.txt and testfile2.txt: #after full scan, now have correct sizes: |
@icewind1991 @MorrisJobke FINALLY I got to the bottom of this. I got the hint here where there was a "FIXME" line: https://github.com/nextcloud/server/blob/master//lib/private/Files/Cache/Scanner.php#L523 It seems that for some reason the sorting of getIncomplete makes a difference. I believe this bug only happens when the entry with the highest fileid is further down in the tree then the other changes. @icewind1991 I am not sure if making getIncomplete() returning an array is the right solution to all this. I am willing to help if you have any thoughts. If you are not convinced this is not a bug or I am not making myself understood clearly, please tell :) |
Okay so the bug only presents it self if there is more than folder with size -1 + that they are in the same tree + that the folder created last (highest id) and is the one deepest into the tree. Like test1/test.txt and test1/subfolder/test2.txt A quick change of ordering in getIncomplete() fixes the problem it seems.
|
Looking at the code it shouldn't make a difference. But maybe @icewind1991 knows more? |
There could also be a potential fix related to and in calculateFolderSize() if it somehow did not calculate size for parent folders more than 1 level up, that also had size -1. That is the core of the issue but I am not sure how to fix that. Just returning a sorted result in getIncomplete() where top most folder is returned it also avoids the issue with wrong calculated folder sizes. |
I think I remembered the reasoning behind the sorting Now I'm not sure if this is still a relevant "advantage", I remember there being logic somewhere that ran the background scanner one "chunk" at a time, but I can't find it so it might have been removed. I think switching to |
@theroch A couple of PRs here will probably help for the issues listed in this thread: #14425 (Fixes where some folders to not get scanned properly) There is still also this issue that makes the very first registered change in occ files_external:notify not be registered: #14441 With all these bugs it makes me wonder if I am the only one actually using the SMB share outside of Nextcloud :D |
To avoid running into performance issues we definitely need a db index on |
@cowai I'will try your changes this week. |
Do not calculate folder size for parent that also needs proper scan, fixes #3524
[stable15] Do not calculate folder size for parent that also needs proper scan, fixes #3524
[stable14] Do not calculate folder size for parent that also needs proper scan, fixes #3524
Steps to reproduce
Expected behaviour
The desktop clients should propogate the changes that happened directly to the SMB share.
Actual behaviour
I get the changes listed out in the terminal output of the occ files_external:notify command, but nothing else happens.
Server configuration
Operating system:
Ubuntu Server 16.04
Web server:
Nginx 1.10
Database:
Mariadb 10
PHP version:
7.0/7.1 (tried both)
Nextcloud version: (see Nextcloud admin page)
11.0.1 and 11.0.2 (tried both)
Updated from an older Nextcloud/ownCloud or fresh install:
Upgrade.
Where did you install Nextcloud from:
Wonderfall/nextcloud:latest
Client configuration
Operating system:
Elementary with nextcloud-client 2.2.4
The text was updated successfully, but these errors were encountered: