Changeset 48894 in webkit


Ignore:
Timestamp:
Sep 29, 2009 1:05:11 PM (15 years ago)
Author:
eric@webkit.org
Message:

2009-09-29 Dumitru Daniliuc <dumi@chromium.org>

Reviewed by Dimitri Glazkov.

Starting all read-only transactions with an explicit BEGIN
DEFERRED command instead of BEGIN, since some ports (chromium)
might compile their own SQLite library and set BEGIN to BEGIN
IMMEDIATE by default; which would result in a deadlock in case of
two concurrent read-only transactions on the same DB, and would
unnecessarily delay other potential transactions to the same DB.

https://bugs.webkit.org/show_bug.cgi?id=29729

  • platform/sql/SQLiteTransaction.cpp: (WebCore::SQLiteTransaction::begin):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r48893 r48894  
     12009-09-29  Dumitru Daniliuc  <dumi@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Starting all read-only transactions with an explicit BEGIN
     6        DEFERRED command instead of BEGIN, since some ports (chromium)
     7        might compile their own SQLite library and set BEGIN to BEGIN
     8        IMMEDIATE by default; which would result in a deadlock in case of
     9        two concurrent read-only transactions on the same DB, and would
     10        unnecessarily delay other potential transactions to the same DB.
     11
     12        https://bugs.webkit.org/show_bug.cgi?id=29729
     13
     14        * platform/sql/SQLiteTransaction.cpp:
     15        (WebCore::SQLiteTransaction::begin):
     16
    1172009-09-29  Kenneth Russell  <kbr@google.com>
    218
  • trunk/WebCore/platform/sql/SQLiteTransaction.cpp

    r48617 r48894  
    4848    if (!m_inProgress) {
    4949        ASSERT(!m_db.m_transactionInProgress);
    50         // Call BEGIN IMMEDIATE for a write transaction to acquire
    51         // a RESERVED lock on the DB file. Otherwise, another write
    52         // transaction (on another connection) could make changes
    53         // to the same DB file before this transaction gets to execute
    54         // any statements. If that happens, this transaction will fail.
     50        // For read-only transactions, call BEGIN DEFERRED explicitly.
     51        // Otherwise, a port might use a SQLite library that was build
     52        // to interpret BEGIN as BEGIN IMMEDIATE, which would lead to
     53        // a deadlock whenever two read transactions on the same DB
     54        // are scheduled concurrently.
     55        // For write transactions, call BEGIN IMMEDIATE to acquire
     56        // a RESERVED lock on the DB file before the transaction
     57        // callback is executed. Otherwise, another write transaction
     58        // (on another connection) could make changes to the same DB file
     59        // before this transaction gets to execute any statements.
     60        // If that happens, this transaction will fail.
    5561        // http://www.sqlite.org/lang_transaction.html
    5662        // http://www.sqlite.org/lockingv3.html#locking
    5763        if (m_readOnly)
    58             m_inProgress = m_db.executeCommand("BEGIN;");
     64            m_inProgress = m_db.executeCommand("BEGIN DEFERRED;");
    5965        else
    6066            m_inProgress = m_db.executeCommand("BEGIN IMMEDIATE;");
Note: See TracChangeset for help on using the changeset viewer.