Nextcloud version (eg, 20.0.5): 25.0.1
Operating system and version (eg, Ubuntu 20.04): CentOS Linux release 7.9.2009
Apache or nginx version (eg, Apache 2.4.25): 2.4.6
PHP version (eg, 7.4): 7.4.32
The issue you are facing:
Some Files have incorrect Timestamps. Most of them have 01.01.1970. But also I found 25.05.1917. This timestamp is also on the file on the filesystem (stat
was used).
I also have found the nearly the same issues from other people. But there are some differences to my problem.
It only affected around 400 Files of more than 3 million files.
Not all files in a folder were affected.
Also files were affected, which weren’t synced with a client. We have the user “trash”, which owns all old files which weren’t sorted out when we moved to Nextcloud. These files aren’t shared with anybody and only I have access to this account. Other issues are referring to a client error - I can exclude that this is a client error.
I’ve changed the mtime
of all affected files to the ctime
of the file on the machine. Found with find /nextcloud_data/ -type f -newermt "1800-01-01" ! -newermt "1971-01-01"
.
Then I ran occ files:scan --path
for all folders which had files with incorrect timestamps.
In the table oc_filecache
are still some files with mtime
and storage_mtime
set to a negative value, for example -1660064354, despite running the occ files:scan --path
for the corresponding path, where the file now has the correct mtime
.
I digged a little bit deeper and checked for a specific file.
SELECT * FROM oc_filecache WHERE path LIKE '%/XYZ/tmp/apache_php_win7/PHP/tmp/PEAR-1.9.0/README';
+----------+---------+--------------------------------------------------------------------+----------------------------------+----------+--------+----------+----------+------+------------+---------------+-----------+------------------+----------------------------------+-------------+----------+
| fileid | storage | path | path_hash | parent | name | mimetype | mimepart | size | mtime | storage_mtime | encrypted | unencrypted_size | etag | permissions | checksum |
+----------+---------+--------------------------------------------------------------------+----------------------------------+----------+--------+----------+----------+------+------------+---------------+-----------+------------------+----------------------------------+-------------+----------+
| 3726043 | 88 | files/XYZ/tmp/apache_php_win7/PHP/tmp/PEAR-1.9.0/README | d97c2482f7a269d154c9f463b026e901 | 3725896 | README | 12 | 3 | 1190 | 1497335767 | 1497335767 | 0 | 0 | f83b9a6c94a6dedd166bced1c69662c6 | 27 | |
| 11435339 | 25 | TRASH/files/XYZ/tmp/apache_php_win7/PHP/tmp/PEAR-1.9.0/README. | fc319e5ce87a1beed22f650e9b65c13a | 11435192 | README | 12 | 3 | 1190 |-1660064354 | -1660064354 | 0 | 0 | 70086ed42fe2bb4eb366aefb14d021f1 | 27 | |
+----------+---------+--------------------------------------------------------------------+----------------------------------+----------+--------+----------+----------+------+------------+---------------+-----------+------------------+----------------------------------+-------------+----------+
Same file but different values and different storage. So I’ve checked the table oc_storage
+--------------------------------------------+------------+-----------+--------------+
| id | numeric_id | available | last_checked |
+--------------------------------------------+------------+-----------+--------------+
| local::/nextcloud_data/ | 25 | 1 | NULL |
| home::TRASH | 88 | 1 | NULL |
| 90 | 91 | 1 | NULL |
| 80 | 92 | 1 | NULL |
| 78 | 93 | 1 | NULL |
| 94 | 95 | 1 | NULL |
| 70 | 96 | 1 | NULL |
| 79 | 97 | 1 | NULL |
| 73 | 98 | 1 | NULL |
...
The file on the filesystem is located at /nextcloud_data/TRASH/files/XYZ/tmp/apache_php_win7/PHP/tmp/PEAR-1.9.0/README
It seems that there are duplicate entries on oc_filecache
? One entry for the root of all files ( = /nextcloud_data/ ) and also for the the user TRASH ?
MariaDB [nextcloud_db]> SELECT COUNT(*) FROM oc_filecache WHERE storage = 25;
+----------+
| COUNT(*) |
+----------+
| 3291644 |
+----------+
MariaDB [nextcloud_db]> SELECT COUNT(*) FROM oc_filecache WHERE storage = 88;
+----------+
| COUNT(*) |
+----------+
| 379704 |
+----------+
Also, what are the other values in oc_storage
? For example id: 90, numeric_id 91 ?
Is this the first time you’ve seen this error? (Y/N): Y