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

Skip to content
Commit 04fd7f0b authored by Lee Shombert's avatar Lee Shombert
Browse files

Report long database transactions

This change updates the database "recent operations" log.  There are
two changes:
 1. Explicit transactions are now included as an operation.  Explicit
    transactions may include many SQL operations.  If there are too
    many nested operations, then the transaction-begin event might
    fall off the ring buffer.  Therefore, there is a special operation
    reserved for explicit transactions.

    When the recent operations are dumped, the currently-open
    transaction, if any, is also dumped.  The open transaction may
    have fallen out of the recent-operations buffer, in which case it
    is dumped from an operation variable dedicated to the current
    transaction.

 2. Operations longer than a compile-time default are saved in a
    separate history buffer and are dumped in dumpsys.  The duration
    is chosen to be close to the SqliteDatabaseLockedException
    timeout.

 3. Operations longer than a compile-time default generate a log
    message. The message only includes the database label (so, no
    PII). Log messages are limited to 10 every 50 minutes.  (In
    steady-state, that is one every 5 minutes).  The logs carry
    limited information; they are present only as a back-up when a
    process is killed (ANR'ed) because of long db transactions, and
    the dumpsys output is unavailable.

Small changes were made to dumpsys dbinfo to make it simpler to parse.
The unit tests now parse that output and perform rudimentary
validation.  SQLiteDatabase.getConcurrentDatabasePaths() has been
removed.  It was test-only, and the unit tests that needed it have
been rewritten to use dumpsys output.

Manually tested by creating lengthy operations and verifying the
dumpsys output.

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

Bug: 309135899
Flag: EXEMPT bugfix
Change-Id: I33b575349568540c638002b388f481501fb86b4f
parent 5a1286dc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment