turn off sqlite WAL until bugs bug:3024421 and bug:3353077 are fixed
they are becoming pretty disruptive bugs.
many more instances of gmail crashing with locking protocol error.
and a positive identification of WAL as the problem in Music app
AND one instance of gmail crash that I know of.
who knows how many folks are NOT reporting the gmail crash.
too bad we relied on pre-released version sqlite feature
without seeing it complettly tested in the field.
not a safe feature to turn on at this point in time.
maybe more testing and debugging in Ice timeframe.
Change-Id: I283ad26ba7e1793772a372aa8e24df0cb96ce2ef
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 965f7dc..390e542 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -2386,37 +2386,39 @@
* @return true if write-ahead-logging is set. false otherwise
*/
public boolean enableWriteAheadLogging() {
- // make sure the database is not READONLY. WAL doesn't make sense for readonly-databases.
- if (isReadOnly()) {
- return false;
- }
- // acquire lock - no that no other thread is enabling WAL at the same time
- lock();
- try {
- if (mConnectionPool != null) {
- // already enabled
- return true;
- }
- if (mPath.equalsIgnoreCase(MEMORY_DB_PATH)) {
- Log.i(TAG, "can't enable WAL for memory databases.");
- return false;
- }
-
- // make sure this database has NO attached databases because sqlite's write-ahead-logging
- // doesn't work for databases with attached databases
- if (mHasAttachedDbs) {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG,
- "this database: " + mPath + " has attached databases. can't enable WAL.");
- }
- return false;
- }
- mConnectionPool = new DatabaseConnectionPool(this);
- setJournalMode(mPath, "WAL");
- return true;
- } finally {
- unlock();
- }
+ // turn off WAL until lockingprotocolerror bug and diskIO bug are fixed
+ return false;
+// // make sure the database is not READONLY. WAL doesn't make sense for readonly-databases.
+// if (isReadOnly()) {
+// return false;
+// }
+// // acquire lock - no that no other thread is enabling WAL at the same time
+// lock();
+// try {
+// if (mConnectionPool != null) {
+// // already enabled
+// return true;
+// }
+// if (mPath.equalsIgnoreCase(MEMORY_DB_PATH)) {
+// Log.i(TAG, "can't enable WAL for memory databases.");
+// return false;
+// }
+//
+// // make sure this database has NO attached databases because sqlite's write-ahead-logging
+// // doesn't work for databases with attached databases
+// if (mHasAttachedDbs) {
+// if (Log.isLoggable(TAG, Log.DEBUG)) {
+// Log.d(TAG,
+// "this database: " + mPath + " has attached databases. can't enable WAL.");
+// }
+// return false;
+// }
+// mConnectionPool = new DatabaseConnectionPool(this);
+// setJournalMode(mPath, "WAL");
+// return true;
+// } finally {
+// unlock();
+// }
}
/**
@@ -2424,19 +2426,20 @@
* @hide
*/
public void disableWriteAheadLogging() {
- // grab database lock so that writeAheadLogging is not disabled from 2 different threads
- // at the same time
- lock();
- try {
- if (mConnectionPool == null) {
- return; // already disabled
- }
- mConnectionPool.close();
- setJournalMode(mPath, "TRUNCATE");
- mConnectionPool = null;
- } finally {
- unlock();
- }
+ return;
+// // grab database lock so that writeAheadLogging is not disabled from 2 different threads
+// // at the same time
+// lock();
+// try {
+// if (mConnectionPool == null) {
+// return; // already disabled
+// }
+// mConnectionPool.close();
+// setJournalMode(mPath, "TRUNCATE");
+// mConnectionPool = null;
+// } finally {
+// unlock();
+// }
}
/* package */ SQLiteDatabase getDatabaseHandle(String sql) {