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

occ files:scan -all Makes all folders show that they were just changed #1583

Open
kwstone opened this issue Sep 29, 2016 · 22 comments
Open

occ files:scan -all Makes all folders show that they were just changed #1583

kwstone opened this issue Sep 29, 2016 · 22 comments
Labels
1. to develop Accepted and waiting to be taken care of 25-feedback 27-feedback bug feature: external storage feature: filesystem hotspot: file time handling ctime, mtime, etc. handling during various operations needs review Needs review to determine if still applicable

Comments

@kwstone
Copy link

kwstone commented Sep 29, 2016

Steps to reproduce

  1. Setup Nextcloud 10
  2. Connect to external SMB folders
  3. Use occ files:scan -all to scan for changes

Expected behaviour

New files or folders should be shown but no changes to their last update time and date unless it did change.

Actual behaviour

All folders on SMB shares show that they were updated or modified when the scan took place.

Server configuration

Ubuntu 16.4

Web server:
Apache

Database:
MySQL

PHP version:
7.0.8

Nextcloud version: (see Nextcloud admin page)
10

Updated from an older Nextcloud/ownCloud or fresh install:
Fresh install

Where did you install Nextcloud from:
Downloaded from Nextcloud.com

Signing status:

Signing status

Login as admin user into your Nextcloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

List of activated apps:

App list

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder

The content of config/config.php:

Config report

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your Nextcloud installation folder

or 

Insert your config.php content here
(Without the database password, passwordsalt and secret)

Are you using external storage, if yes which one: local/smb/sftp/...
SMB
Are you using encryption: yes/no
No
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
No

LDAP configuration (delete this part if not used)

LDAP config

With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your Nextcloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.
### Client configuration

Browser:

Operating system:

Logs

Web server error log

Web server error log

Insert your webserver log here
#### Nextcloud log (data/nextcloud.log)

Nextcloud log

Insert your Nextcloud log here
#### Browser log

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...
@nickvergessen
Copy link
Member

Well the files:scan command is not recommended for daily use.

@kwstone
Copy link
Author

kwstone commented Sep 30, 2016

It's the only way I have been able to get Nextcloud to pick up or recognize new files placed on the smb server. With only a few files it works without but after several gigs of files have been accessed and hundreds of folders, It just doesn't seem to look any further. I do have Check for Changes set to Once every direct access. But does that mean once every access via a sync client? Because that is the access most of my clients are using. If the check for changes should be working then I believe that is also listed as a bug that I found yesterday.

@it-consult
Copy link

Same problem. 37 GiG of data, the only way ist to use "occ files:scan -all"
Version 10.0.2

@kabzo

This comment was marked as duplicate.

@nickvergessen
Copy link
Member

But does that mean once every access via a sync client? Because that is the access most of my clients are using.

I think it does yes. But let's confirm by @icewind1991

@icewind1991
Copy link
Member

The sync client only accesses the users home folder and will thus only find top level changes.

With SMB, you can run an occ command that actively listen for smb changes.

This issue will be fixed with #3449

@bestouff
Copy link

#3449 is merged, is that bug fixed ?

@seblu
Copy link

seblu commented Jan 14, 2018

I scanned (occ files:scan -all) new local folders with 12.0.4 and there modification date is not correctly reported.

@nickvergessen
Copy link
Member

Well as per it's description: will rescan all files of all known users

Maybe --unscanned helps preventing that?

@seblu
Copy link

seblu commented Jan 15, 2018

I dropped oc_filecache and launched occ files:scan -all --unscanned. All directory are 1s hold. I don't get why directory are managed differently than files on this.

@nickvergessen
Copy link
Member

You should not drop oc_filecache, it's not a cache but an index.
The naming can't be changed easily which is why we are still using it.

@seblu
Copy link

seblu commented Jan 15, 2018

Yes thanks, I know that not a cache. I should have tested by creating a new directory. I got excited.

@nextcloud-bot nextcloud-bot added the stale Ticket or PR with no recent activity label Jun 20, 2018
@LibreGit
Copy link

Had this issue with nc 12 too. I saw that there was a storage_mtime field with the correct values in the oc_filecache table.

Just execute this sql statement after each occ files:scan :

UPDATE oc_filecache SET mtime=storage_mtime

or from the shell :

mysql -u root -p -e "UPDATE oc_filecache SET mtime=storage_mtime" nextcloud

@dvergeylen
Copy link

Had this issue with nc 12 too. I saw that there was a storage_mtime field with the correct values in the oc_filecache table.

Just execute this sql statement after each occ files:scan :

UPDATE oc_filecache SET mtime=storage_mtime

or from the shell :

mysql -u root -p -e "UPDATE oc_filecache SET mtime=storage_mtime" nextcloud

Briliant, works like a charm as a workaround 👌 Thanks!

@hboetes
Copy link

hboetes commented Oct 15, 2019

What would be the postgresql command that does the same?

Edit:

su - postgres
postgres@example ~ % psql
postgres=# \l
                              List of databases
   Name    |  Owner   | Encoding | Collate |  Ctype  |   Access privileges
-----------+----------+----------+---------+---------+-----------------------
 nextcloud | something   | UTF8     | C.UTF-8 | C.UTF-8 | something=CTc/something
[snip]
(4 rows)
postgres=# \connect nextcloud
You are now connected to database "nextcloud" as user "postgres".
nextcloud=# UPDATE oc_filecache SET mtime=storage_mtime;
UPDATE 38594

@skjnldsv skjnldsv added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Aug 20, 2020
@alpsayin
Copy link

alpsayin commented Feb 23, 2022

I just had this issue with Nextcloud 23.0.2, Ubuntu 20.04, MariaDB 10.3.32, apache2.
Solution mentioned by @LibreGit works.
Are there any logs I can provide?
Edit:
Server error log is literally empty.
Nextcloud log also didn't have anything new after the scan --all command.

@szaimen

This comment was marked as outdated.

@szaimen szaimen removed the 1. to develop Accepted and waiting to be taken care of label Nov 26, 2022
@szaimen szaimen added needs info 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Nov 26, 2022
@alpsayin

This comment was marked as outdated.

@szaimen

This comment was marked as outdated.

@alpsayin

This comment was marked as outdated.

@viulian
Copy link

viulian commented Dec 5, 2022

I too confirm the bug with the latest 25.0.1.1 version. While migrating the data between two virtual machines, I have used:

scp -rp source destination

to preserve the modification times. The folder stats are correct.

However, after triggering the scan, all folders appear to have been last modified at the moment of the copy. Values in the storage_mtime column are correct, but the mtime defaulted to what seem to be the time of the operation.

@FlexMcMurphy
Copy link

Thank you all for this very useful thread.
I also see this behaviour in Nextcloud 25.0.0 RC3

When a folder is added to Nexcloud either by dropping it in to the WebUI OR rsync'ing it in to the datadir and then running occ files:scan --all that folder is given a current Timestamp and not the os-level modified TS of the folder.

However, under normal usage perhaps that behavior makes sense? It's only a problem when you are setting up a new NC instance with your OLD data and for the first sync only you want to keep all the timestamps from the "old" NC instance.

So I wonder if the fix here is not to change the existing code but to add a new parameter to occ files:scan -all?
e.g: occ files:scan --all --preserve_os_mod_ts that tells it to use the folders os-level modified TS in the mtime and storage_mtime columns of the NC oc_filecache table. And then just using occ files:scan --all could continue to work as it currently does?

Just my two cents!

Flex

@joshtrichards joshtrichards changed the title occ files:scan -all Makes all folders show that they were just changed. occ files:scan -all Makes all folders show that they were just changed Aug 27, 2024
@DorraJaouad DorraJaouad added 27-feedback 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Sep 17, 2024
@joshtrichards joshtrichards added needs review Needs review to determine if still applicable hotspot: file time handling ctime, mtime, etc. handling during various operations labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of 25-feedback 27-feedback bug feature: external storage feature: filesystem hotspot: file time handling ctime, mtime, etc. handling during various operations needs review Needs review to determine if still applicable
Projects
None yet
Development

No branches or pull requests