• Victor Costan's avatar
    sql: Switch SQLite to default to exclusive locking mode. · b223079c
    Victor Costan authored
    Chrome used the default SQLite configuration where databases were first
    opened in the NORMAL (not exclusive) locking mode, and then databases
    that opt in were switched to the EXCLUSIVE locking mode via a "PRAGMA
    locking_mode" statement.
    
    This CL switches the default. Databases are first opened in EXCLUSIVE
    mode by changing the SQLITE_DEFAULT_LOCKING_MODE build configuration
    macro. Databases that don't opt into exclusive mode are switched to the
    NORMAL locking mode via a "PRAGMA locking_mode" statement.
    
    This CL should not introduce any behavior changes in most cases. The
    result of the "PRAGMA locking_mode" statement was previously ignored,
    and is now checked. So, if the desired locking mode cannot be set,
    sql::Database::Open() will now fail.
    
    In the long run, Chrome's SQLite usage should be migrated to use the
    exclusive locking mode, for the benefits outlined in
    https://crbug.com/1120969. When that happens, the "PRAGMA locking_mode"
    can go away.
    
    Bug: 56559, 1120969
    Change-Id: Ia9ac996fae45890bb5ca11168422e15e594087ac
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2460982
    Commit-Queue: Victor Costan <pwnall@chromium.org>
    Reviewed-by: default avatarDarwin Huang <huangdarwin@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#815540}
    b223079c
database.cc 62.6 KB