Conversation
|
I have quite a bunch of questions:
I can understand there could be entries with a fileid pointing to a missing file due to the lack of referencial integrity, but I don't see any use for the case where the fileid is null. |
I am quite not sure if the null values have any purpose. While working on the CleanProperties, the insight I had is the fileid was pointing towards the fileid in the filecache. The whole purpose of this background job was to cleanup the traces present in the properties table which were refering to the fileid in filecache, and the filecache id was missing or say not there.
Looking at the code flow, this is what I have deduced:
|
Again the code flow while tracing the
So as per the codeflow, the chance to get the NULL, is if the data is |
|
In the #36062 (comment) I have used the command below to create properties: I have done an expirement by deleting the file before it reaches https://github.com/owncloud/core/blob/master/lib/private/Files/Cache/Cache.php#L129 and delete the file, which would make Now say even if I delete the file from oC after the SQL is executed https://github.com/owncloud/core/blob/master/lib/private/Files/Cache/Cache.php#L129, then the Humm, its little hard to pin point from where the data is not set and the code is getting propagated. Because to reach https://github.com/owncloud/core/blob/master/lib/private/Files/Cache/CacheEntry.php#L52-L56 and have the data not set for the file, then I am not sure how the exception is getting escaped. |
|
Check with .part files. The other option is that the target node is the root node, but it should have the fileid. If the cause is around https://github.com/owncloud/core/blob/master/apps/dav/lib/DAV/AbstractCustomPropertiesBackend.php#L207 , I think, the same way we're returning if the node is null, we could do the same if path refers to a .part file. We might need to investigate how those properties end up there (while curl helps to investigate and reproduce the problem, no user is using curl). The other thing to investigate is that, accordingly to the original ticket, the property set is |
I am currently looking into the calendar app. I will post the updates once I get some clue. |
|
Looking at the code flow, if I provide url: |
Remove null fileid from the properties. Signed-off-by: Sujith H <sharidasan@owncloud.com>
d35114e to
05e0f25
Compare
Codecov Report
@@ Coverage Diff @@
## master #36062 +/- ##
=======================================
Coverage 53.85% 53.85%
=======================================
Files 63 63
Lines 7377 7377
Branches 1301 1301
=======================================
Hits 3973 3973
Misses 3019 3019
Partials 385 385
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #36062 +/- ##
=======================================
Coverage 53.85% 53.85%
=======================================
Files 63 63
Lines 7377 7377
Branches 1301 1301
=======================================
Hits 3973 3973
Misses 3019 3019
Partials 385 385
Continue to review full report at Codecov.
|
|
The code looks fine, but I'm still reluctant to approve without knowing the cause of those null values reaching the DB. If they're aren't allowed, the DB should forbid those values, and any code trying to set null values should be fixed (the code should remove the DB entry instead). |
|
Are you suggesting using a DB "NOT NULL" constraint instead of a background job ? |
|
Yes. If null values aren't allowed, the DB is the best place to enforce this constraint. |
|
@VicDeo I see a comment at https://github.com/owncloud/core/blob/master/apps/dav/appinfo/Migrations/Version20170116170538.php#L73-L74. Let me know if this is still applicable. A small context would be: there caused an issue with fileid accepting null values for oc_properties table, for a background job ( CleanProperties ). If you read the comments above, it would be ideal to fix it in the db. While I was looking through the migrations, I saw this comment. Let me know if its ok to change |
|
@sharidas over two years passed, I barely can remember the context. Most likely adding a new column to the existing table produced null values in this column. IIRC the migration process had 4 steps split over 3 migration files:
Which means that I made a mistake in the step 4. See the comment and the actual constraint https://github.com/owncloud/core/blob/master/apps/dav/appinfo/Migrations/Version20170202220512.php#L53 |
|
Closing this PR in favour of #36084 |
Remove null fileid from the properties.
Signed-off-by: Sujith H sharidasan@owncloud.com
Description
Delete null fileid from the properties table. The fileid points to the ids in the filecache. If the fileid points to
NULL, then something has gone wrong. This PR removes the row(s) which have fileid withNULLvalue.Related Issue
Motivation and Context
Remove entries with fileid as
NULLin the properties table.How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Open tasks: