Closed Bug 1323461 Opened 8 years ago Closed 8 years ago

Foreign key constraint failure during bookmark buffering

Categories

(Firefox for iOS :: Sync, defect)

All
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
fxios 6.0+ ---

People

(Reporter: rnewman, Assigned: rnewman)

Details

(Whiteboard: [MobileCore])

Attachments

(1 file)

Saw this testing my own account on the Simulator. 2016-12-14 08:05:41.169 [Debug] [StorageClient.swift:759] getSince(_:sort:limit:offset:) > Issuing GET with newer = 0, offset = Optional("1477924965200:1"), sort = Optional(Sync.SortOption.OldestFirst). 2016-12-14 08:05:41.266 [Debug] [StorageClient.swift:356] failFromResponse > Status code: 200. 2016-12-14 08:05:41.286 [Debug] [BookmarkPayload.swift:501] isValid() > Accepting root with missing parent name. 2016-12-14 08:05:41.292 [Debug] [Downloader.swift:175] handleSuccess > Handling success. 2016-12-14 08:05:41.292 [Debug] [Downloader.swift:209] handleSuccess > Got success response with 100 records. 2016-12-14 08:05:41.293 [Debug] [BookmarksDownloader.swift:134] go(_:greenLight:) > Running another batch. 2016-12-14 08:05:41.297 [Debug] [BookmarkPayload.swift:501] isValid() > Accepting root with missing parent name. 2016-12-14 08:05:41.309 [Debug] [BookmarkPayload.swift:501] isValid() > Accepting root with missing parent name. 2016-12-14 08:05:41.313 [Debug] [BookmarksDownloader.swift:109] applyRecordsFromBatcher() > Applying 100 downloaded bookmarks. 2016-12-14 08:05:41.326 [Debug] [SQLiteBookmarksSyncing.swift:475] applyRecords(_:withMaxVars:) > 13 folders and 1 deleted maybe-folders to drop from buffer structure table. 2016-12-14 08:05:41.326 [Debug] [SQLiteBookmarksSyncing.swift:346] deleteStructureForGUIDs(_:fromTable:connection:withMaxVars:) > Deleting 14 parents from bookmarksBufferStructure. 2016-12-14 08:05:41.326 [Debug] [SQLiteBookmarksSyncing.swift:483] applyRecords(_:withMaxVars:) > Inserting 409 children. 2016-12-14 08:05:41.328 [Debug] [SQLiteBookmarksSyncing.swift:374] insertStructureIntoTable(_:connection:children:maxVars:) > Inserting 333 records (out of 409). 2016-12-14 08:05:41.332 [Error] [SQLiteBookmarksSyncing.swift:485] applyRecords(_:withMaxVars:) > Updating buffer structure: Error Domain=org.mozilla Code=19 "Abort due to constraint violation FOREIGN KEY constraint failed" UserInfo={NSLocalizedDescription=Abort due to constraint violation FOREIGN KEY constraint failed}. 2016-12-14 08:05:41.333 [Debug] [SwiftData.swift:175] transaction(synchronous:transactionClosure:) > Op in transaction failed. Rolling back.
Might be: 2016-12-14 08:05:40.941 [Warning] [BookmarkPayload.swift:503] isValid() > Not the places root and missing parent name. 2016-12-14 08:05:40.941 [Warning] [Record.swift:59] fromEnvelope(_:payloadFactory:) > Invalid payload { "title" : "A Look At Wheel Locks For Bike Touring | TravellingTwo: Bicycle Touring Around The World", "loadInSidebar" : false, "tags" : [ ], "id" : "e52JXyAOLbYT", "bmkUri" : "http:\/\/travellingtwo.com\/resources\/wheel-locks-for-bike-touring", "parentid" : "LUDt683r4Q0L", "type" : "bookmark" }.
The root cause for the error in Comment 0: Bug 1318414. My menu________ record doesn't include a parent title. We use INSERT OR IGNORE when inserting into the buffer. We fail for this reason: Error: CHECK constraint failed: parentNameOrDeleted but we roll through with IGNORE. That leaves us without the folder in the buffer, so when we go to add its children we get a foreign key constraint violation instead. There are two things to fix here: - Default to an empty string (the workaround for dirty data resulting from Bug 1318414). - Don't use INSERT OR IGNORE: we already tried an update in place, so anything else is a legitimate error!
Assignee: nobody → rnewman
Status: NEW → ASSIGNED
Attached file Pull req. (Stacked)
These two commits unblock my device.
Attachment #8818600 - Flags: review?(sleroux)
Attachment #8818600 - Flags: review?(sleroux) → review+
25c42cd
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Whiteboard: [needsuplift]
Whiteboard: [needsuplift] → [needsuplift][MobileCore]
v6.x 3776c837e510cc78f692be6bfffc93780ffbb417 & 95a42cb97bc01a70ac52b1fdd04a57a66ad095df
Whiteboard: [needsuplift][MobileCore] → [MobileCore]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: