Closed Bug 1229214 Opened 9 years ago Closed 6 years ago

Database move-and-recreate is flawed

Categories

(Firefox for iOS :: Data Storage, defect)

All
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: rnewman, Unassigned)

Details

When the database is found to be malformed, we close it, move it, and recreate in place.

(That means we need to do stuff like Bug 1226813, because we lose data.)

But we also lose any tables that were created in the DB, including the schema table itself; we call doCreate with the table that failed, but that's only correct if the first table fails!
This is what it'll look like in the log:

[BrowserDB.swift:192] createOrUpdate > Moving browser.db-shm and browser.db-wal…
[SwiftData.swift:83] getSharedConnection() > >>> Creating shared SQLiteDBConnection for /private/var/mobile/Containers/Shared/AppGroup/6F866643-7E94-4F16-B6BE-83BBF503ADC1/profile.profile/browser.db on thread <NSThread: 0x15c67acb0>{number = 2, name = (null)}.
[SwiftData.swift:397] init(filename:flags:key:prevKey:) > Opening connection to /private/var/mobile/Containers/Shared/AppGroup/6F866643-7E94-4F16-B6BE-83BBF503ADC1/profile.profile/browser.db.
[SwiftData.swift:379] prepareCleartext() > Enabling WAL mode.
[BrowserDB.swift:58] createTable(_:table:) > Try create BROWSER version 11
[BrowserTable.swift:366] create > Creating 16 tables, views, and indices.
[SwiftData.swift:522] executeChange(_:withArgs:) > SQL error: SQL error or missing database no such table: tableList for SQL INSERT INTO tableList (name, version) VALUES (?,?).
I believe this is now fixed.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.