Merge "Revert "Clear statement cache if schema changes."" into udc-dev

This commit is contained in:
Daniel Santiago Rivera
2023-03-09 22:19:45 +00:00
committed by Android (Google) Code Review
3 changed files with 2 additions and 18 deletions

View File

@@ -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.
*

View File

@@ -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.
*

View File

@@ -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 {