summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Fyodor Kupolov <fkupolov@google.com> 2017-07-27 23:20:34 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-07-27 23:20:34 +0000
commit0ee7495b5445d45a66db1e320cd7878156f1756e (patch)
treee7faba3119ec1ff37c22a262f1fd7c3ce5cb47ad
parent276e2fac5f4a6b5a968b7fffdd178cad3a652a09 (diff)
parent3a6cded002e986b4261b54bfc289720086d18a11 (diff)
Merge "Limit number of in-memory db connections to 1 per pool" into oc-mr1-dev
-rw-r--r--core/java/android/database/sqlite/SQLiteConnectionPool.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/java/android/database/sqlite/SQLiteConnectionPool.java b/core/java/android/database/sqlite/SQLiteConnectionPool.java
index 765f27ec7cf8..6ce8787e6c38 100644
--- a/core/java/android/database/sqlite/SQLiteConnectionPool.java
+++ b/core/java/android/database/sqlite/SQLiteConnectionPool.java
@@ -1009,13 +1009,15 @@ public final class SQLiteConnectionPool implements Closeable {
}
private void setMaxConnectionPoolSizeLocked() {
- if ((mConfiguration.openFlags & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0) {
+ if (!mConfiguration.isInMemoryDb()
+ && (mConfiguration.openFlags & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0) {
mMaxConnectionPoolSize = SQLiteGlobal.getWALConnectionPoolSize();
} else {
- // TODO: We don't actually need to restrict the connection pool size to 1
+ // We don't actually need to always restrict the connection pool size to 1
// for non-WAL databases. There might be reasons to use connection pooling
- // with other journal modes. For now, enabling connection pooling and
- // using WAL are the same thing in the API.
+ // with other journal modes. However, we should always keep pool size of 1 for in-memory
+ // databases since every :memory: db is separate from another.
+ // For now, enabling connection pooling and using WAL are the same thing in the API.
mMaxConnectionPoolSize = 1;
}
}