Closed Bug 970524 Opened 12 years ago Closed 5 years ago

Investigate use of APIv11 check before starting transactions

Categories

(Firefox for Android Graveyard :: Data Providers, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: oogunsakin, Unassigned)

Details

We currently check to see if the API level is over 11 before starting an exclusive mode transaction but according to the docs exclusive transactions work on API level 1. (http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#beginTransaction%28%29) Also I noticed we are using exclusive mode transactions after enable write-ahead logging. According to the docs beginTransaction() causes the thread to acquire an EXCLUSIVE lock on the entire db which prevents concurrent reads while we're writing. I believe we should be using beginTransactionNonExclusive() which acquires an IMMEDIATE lock and allows concurrent processes to read previously committed writes. This should help increase concurrency. -http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#beginTransactionNonExclusive%28%29 -http://sqlite.org/lang_transaction.html beginTransactionNonExclusive() requires API level 11 and would validate us checking for API level 11.
Summary: Investigate use of APIv11 check before starting a transactions → Investigate use of APIv11 check before starting transactions
Historical context: See Bug 744959, and Bug 947939 Comment 3 onwards. We include the API 11 check here because that was, IIRC, the API level that introduced actual DB concurrency. Until then all DB writes were serialized, so explicit transactional semantics were less meaningful. That changed again around API 16, I think, probably because so many developers were screwing up. This is a very thorny issue that requires reading historical versions of the Android source, and having a good understanding of both sqlite's locking primitives and the Android SQLite classes, so tread carefully.
Hardware: x86 → All
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.