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

Commit 999b4b19 authored by Lee Shombert's avatar Lee Shombert
Browse files

Clear statement cache if schema changes

Bug: 183028015

If DDL statement is executed then the prepared statement cache must be
cleaned up on active connections, otherwise their column result
information can be outdated.

This is the same a previous commit for the bug with two additions:
 1. acquirePreparedStatement() marks statements taken from the cache
    as in-use.  This ensures the statements will not be finalized until
    they are released.

2. The prepared statement cache is protected by a lock.  This is
   required because the code that that detects a schema change may run
   on a different thread than the one that owns the connection.  Both
   threads will attempt to manage the cache at the same time.
   Note that under normal flow, there will never be contention on the
   new lock, because SQLiteConnection management ensures almost all
   operations are single-threaded.

Test: atest
 * CtsDatabaseTestCases
 * FrameworksCoreTests:android.database.sqlite

Change-Id: Ic29fe26e15d1218ede8f05a0c255b9115364df30
parent 6ccd23c3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment