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

Commit c5947e57 authored by Daniel Santiago Rivera's avatar Daniel Santiago Rivera Committed by Android (Google) Code Review
Browse files

Revert "Clear statement cache if schema changes."

Revert submission 21849810-cherrypick-sql-cache-issue-elg7faliq8

Reason for revert: b/272303109

Reverted changes: /q/submissionid:21849810-cherrypick-sql-cache-issue-elg7faliq8

Change-Id: Ibda8e55d21308061ea3d13c918ec471a34e4e427
parent 48b72ed6
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1392,10 +1392,6 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen
        return sql.replaceAll("[\\s]*\\n+[\\s]*", " ");
    }

    void clearPreparedStatementCache() {
        mPreparedStatementCache.evictAll();
    }

    /**
     * Holder type for a prepared statement.
     *
+0 −10
Original line number Diff line number Diff line
@@ -1126,16 +1126,6 @@ public final class SQLiteConnectionPool implements Closeable {
        mConnectionWaiterPool = waiter;
    }

    void clearAcquiredConnectionsPreparedStatementCache() {
        synchronized (mLock) {
            if (!mAcquiredConnections.isEmpty()) {
                for (SQLiteConnection connection : mAcquiredConnections.keySet()) {
                    connection.clearPreparedStatementCache();
                }
            }
        }
    }

    /**
     * Dumps debugging information about this connection pool.
     *
+2 −4
Original line number Diff line number Diff line
@@ -2088,12 +2088,10 @@ public final class SQLiteDatabase extends SQLiteClosable {
            try (SQLiteStatement statement = new SQLiteStatement(this, sql, bindArgs)) {
                return statement.executeUpdateDelete();
            } finally {
                // If schema was updated, close non-primary connections and clear prepared
                // statement caches of active connections, otherwise they might have outdated
                // schema information.
                // If schema was updated, close non-primary connections, otherwise they might
                // have outdated schema information
                if (statementType == DatabaseUtils.STATEMENT_DDL) {
                    mConnectionPoolLocked.closeAvailableNonPrimaryConnectionsAndLogExceptions();
                    mConnectionPoolLocked.clearAcquiredConnectionsPreparedStatementCache();
                }
            }
        } finally {