context save: fails after deleting orphans, leaving CoreData in inconsistent state

Bug #1164073 reported by Mike McCracken
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu One Files App for iOS
Fix Committed
High
Mike McCracken

Bug Description

in U1FilesClient fetchFolderWithResourcePath:... the last context save: can fail if an orphan to be deleted had an associated u1asset.

This is not handled, and so leaves the object graph in a bad state.

The problem is in the data model:

Asset and FileNode are related. A FileNode can have an optional Asset, but an Asset must have a related FileNode.
However, the FileNode->Asset relationship delete rule is just 'Nullify', meaning that when we delete a fileNode we do not delete its related asset, we just leave it sitting around with a nil fileNode relationship, making it invalid, and causing errors when we save.

The solution is to make the delete rule "Cascade".

Tags: u1-notrack

Related branches

Mike McCracken (mikemc)
Changed in ubuntuone-ios-files:
importance: Undecided → High
Changed in ubuntuone-ios-files:
status: In Progress → Fix Committed
Julien Funk (jaboing)
tags: added: u1-notrack
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.