oc_filecache table with inconsistent entries (size = -1)
From https://github.com/nextcloud/server/issues/31283 I executed the query
`SELECT DISTINCT f.path, f.size, f.parent FROM oc_filecache AS f INNER JOIN oc_mounts AS m ON m.storage_id = f.storage WHERE size < 0 AND parent > 1 LIMIT 20;
+--------------------------------------------+------+---------+ | path | size | parent | +--------------------------------------------+------+---------+ | appdata_ocx89t9we96j/preview/0 | -1 | 1057528 | | appdata_ocx89t9we96j/preview/0/0 | -1 | 1057632 | | appdata_ocx89t9we96j/preview/0/0/1 | -1 | 1059331 | | appdata_ocx89t9we96j/preview/0/0/1/6 | -1 | 1065977 | | appdata_ocx89t9we96j/preview/0/0/1/6/d | -1 | 1065978 | | appdata_ocx89t9we96j/preview/0/0/1/6/d/1 | -1 | 1065979 | | appdata_ocx89t9we96j/preview/0/0/1/6/d/1/5 | -1 | 1065980 | | appdata_ocx89t9we96j/preview/0/0/4 | -1 | 1059331 | | appdata_ocx89t9we96j/preview/0/0/4/b | -1 | 1080928 | | appdata_ocx89t9we96j/preview/0/0/4/b/2 | -1 | 1080929 | | appdata_ocx89t9we96j/preview/0/0/4/b/9 | -1 | 1080929 | | appdata_ocx89t9we96j/preview/0/0/5 | -1 | 1059331 | | appdata_ocx89t9we96j/preview/0/0/7 | -1 | 1059331 | | appdata_ocx89t9we96j/preview/0/0/7/d | -1 | 1063945 | | appdata_ocx89t9we96j/preview/0/0/7/d/c | -1 | 1063946 | | appdata_ocx89t9we96j/preview/0/0/7/d/c/c | -1 | 1063947 | | appdata_ocx89t9we96j/preview/0/0/7/d/c/c/8 | -1 | 1063948 | | appdata_ocx89t9we96j/preview/0/0/8 | -1 | 1059331 | | appdata_ocx89t9we96j/preview/0/0/8/1 | -1 | 1074694 | | appdata_ocx89t9we96j/preview/0/0/8/1/2 | -1 | 1079351 | +--------------------------------------------+------+---------+ `
Is it true, that all entries with path appdata_/preview/ and size -1 is an inconsistent entry and should be deleted?
If it is true, can you create a function in the previewgenerator which cleans it up automatically or manual with an occ command?
No, those are folders and should be kept in the database.
@st3iny I removed the preview directory in appdata_*, as described in https://github.com/nextcloud/previewgenerator?tab=readme-ov-file#i-want-to-resetregenerate-all-previews
I expected, that occ files:scan-app-data will remove all the database entries.
But they still exists.
I do no think occ files:scan/scan-app-data removes entries from the database when the corresponding file is missing. It means that the Nextcloud db will grow perpetually since there is no official way to prune stale records.
@canchanchara There is another open issue about unscanned (files/dirs with -1 size). It seems rather difficult to find the root cause. Perhaps you are having the same issue? https://github.com/nextcloud/server/issues/43557#issuecomment-2265692850