NSMigrationManager wipes NSSQLitePragmasOption into NSNull

Originator:jerrykrinock
Number:rdar://16038419 Date Originated:2014 Feb 11
Status:Open Resolved:
Product:OS X SDK Product Version:10.9.1
Classification:Unhelpful Reproducible:Always
 
Summary:
According to "What's New in Core Data in iOS 7", https://developer.apple.com/library/ios/releasenotes/DataManagement/WhatsNew_CoreData_iOS/, some developers need to use the legacy delete/rollback journaling in SQLite Stores, and that document explains how to do it.  But it does not work when NSMigrationManager gets involved to do a migration, which can result in data loss since users expect the document file to be self-contained any may move it without moving the associated -shm and -wal files.

The cause of the bug is that one of Apple's NSMigrationManager methods replaces an inner value in the NSSQLitePragmasOption dictionary with an NSNull.  See  "Additional Notes" for link to YouTube video and test code.

Steps to Reproduce:
1.  Get your favorite Core Data SQLite document-based OS X app project which has more than one data model version, for example, version 1 and version 2, and performs a non-lightweight migration between the two, using a subclass of NSMigrationManager.

2.  Add the code to use legacy delete/rollback journaling in SQLite Stores.

3.  Build and run, with data model version 2 as the current version.

4.  Open an old document that was created with data model version 1.

5.  Perform a ⌘-click on the document's title, and click on the parent folder.  A Finder window will open.



Expected Results:
The Finder window should show a .bkmslf document file, with no -shm or -wal files.

Actual Results:
The Finder window shows -shm and -wal files associated with the migrated document file.

Version:
OS X 10.9.1

Notes:
YouTube video that shows how the NSNull appears:
http://www.youtube.com/watch?v=daSf7n78NPM

Updated version of code used in the demo:
https://github.com/jerrykrinock/CategoriesObjC/blob/master/NSPersistentStoreCoordinator%2BPatchRollback.h

Configuration:
OS X 10.9.1

Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!