Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3dcc4cc authored by Vasu Nori's avatar Vasu Nori Committed by Android (Google) Code Review
Browse files

Merge "STOPSHIP CL in master - make sqlite WAL default for all apps"

parents 661c908e 57feb5d9
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -613,7 +613,10 @@ public class SQLiteDatabase extends SQLiteClosable {


            // This thread didn't already have the lock, so begin a database
            // This thread didn't already have the lock, so begin a database
            // transaction now.
            // transaction now.
            if (exclusive) {
            // STOPSHIP - uncomment the following 1 line
            // if (exclusive) {
            // STOPSHIP - remove the following 1 line
            if (exclusive && mConnectionPool == null) {
                execSQL("BEGIN EXCLUSIVE;");
                execSQL("BEGIN EXCLUSIVE;");
            } else {
            } else {
                execSQL("BEGIN IMMEDIATE;");
                execSQL("BEGIN IMMEDIATE;");
@@ -946,7 +949,10 @@ public class SQLiteDatabase extends SQLiteClosable {
            sBlockSize = new StatFs("/data").getBlockSize();
            sBlockSize = new StatFs("/data").getBlockSize();
        }
        }
        sqliteDatabase.setPageSize(sBlockSize);
        sqliteDatabase.setPageSize(sBlockSize);
        sqliteDatabase.setJournalMode(path, "TRUNCATE");
        //STOPSHIP - uncomment the following line
        //sqliteDatabase.setJournalMode(path, "TRUNCATE");
        // STOPSHIP remove the following lines
        sqliteDatabase.enableWriteAheadLogging();


        // add this database to the list of databases opened in this process
        // add this database to the list of databases opened in this process
        ActiveDatabases.addActiveDatabase(sqliteDatabase);
        ActiveDatabases.addActiveDatabase(sqliteDatabase);
+6 −6
Original line number Original line Diff line number Diff line
@@ -199,7 +199,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase {


    private boolean inXact = false;
    private boolean inXact = false;
    private int numXacts;
    private int numXacts;
    private static final int TIME_TO_RUN_WAL_TEST_FOR = 15; // num sec this test shoudl run
    private static final int TIME_TO_RUN_WAL_TEST_FOR = 15; // num sec this test should run
    private int[][] counts = new int[2][2];
    private int[][] counts = new int[2][2];


    private synchronized boolean inXact() {
    private synchronized boolean inXact() {
@@ -334,7 +334,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase {


    /**
    /**
     * test to make sure the statement finalizations are not done right away but
     * test to make sure the statement finalizations are not done right away but
     * piggybacked onto the next sql statement execution on the same database.
     * piggy-backed onto the next sql statement execution on the same database.
     */
     */
    @SmallTest
    @SmallTest
    public void testStatementClose() {
    public void testStatementClose() {
@@ -356,7 +356,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase {
        }
        }


        // add one more to the cache - and the above 'stmt0Id' should fall out of cache
        // add one more to the cache - and the above 'stmt0Id' should fall out of cache
        SQLiteStatement stmt1 = mDatabase.compileStatement("select * from test where i = ?;");
        SQLiteStatement stmt1 = mDatabase.compileStatement("insert into test values(100, ?);");
        stmt1.bindLong(1, 1);
        stmt1.bindLong(1, 1);
        stmt1.close();
        stmt1.close();


@@ -372,7 +372,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase {


    /**
    /**
     * same as above - except that the statement to be finalized is from Thread # 1.
     * same as above - except that the statement to be finalized is from Thread # 1.
     * and it is eventually finalized in Thread # 2 when it executes a sql statement.
     * and it is eventually finalized in Thread # 2 when it executes a SQL statement.
     * @throws InterruptedException
     * @throws InterruptedException
     */
     */
    @LargeTest
    @LargeTest
@@ -405,7 +405,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase {
        Thread t2 = new Thread() {
        Thread t2 = new Thread() {
            @Override public void run() {
            @Override public void run() {
                SQLiteStatement stmt1 = mDatabase.compileStatement(
                SQLiteStatement stmt1 = mDatabase.compileStatement(
                        "select * from test where i = ?;");
                        "insert into test values(100, ?);");
                stmt1.bindLong(1, 1);
                stmt1.bindLong(1, 1);
                stmt1.close();
                stmt1.close();
            }
            }
@@ -476,7 +476,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase {
        Thread t2 = new Thread() {
        Thread t2 = new Thread() {
            @Override public void run() {
            @Override public void run() {
                SQLiteStatement stmt1 = mDatabase.compileStatement(
                SQLiteStatement stmt1 = mDatabase.compileStatement(
                        "select * from test where i = ?;");
                        "insert into test values(100, ?);");
                stmt1.bindLong(1, 1);
                stmt1.bindLong(1, 1);
                stmt1.close();
                stmt1.close();
            }
            }