[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
eric at webkit.org
eric at webkit.org
Thu Oct 29 20:31:41 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 8575b02415852fdcd51f04073b6e9f026b8abc90
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Sep 22 02:34:15 2009 +0000
2009-09-21 Dumitru Daniliuc <dumi at chromium.org>
Reviewed by Eric Seidel.
Make all write transaction start with a BEGIN IMMEDIATE command
instead of BEGIN.
We cannot test this change in a layout test, because in order to
test it we need to spawn two database threads and execute
transaction steps on these two threads in a very specific order,
which seems impossible to do when they share the same main thread
(as they would in a layout test). The SQLite docs and the case
described in the bug though should be enough proof that we do have
a problem here and that this patch will fix it.
Relevant SQLite documentation:
http://www.sqlite.org/lang_transaction.html
http://www.sqlite.org/lockingv3.html#locking
https://bugs.webkit.org/show_bug.cgi?id=29218
* platform/sql/SQLiteTransaction.cpp:
(WebCore::SQLiteTransaction::SQLiteTransaction): Added a readOnly
parameter.
(WebCore::SQLiteTransaction::begin): Changed to BEGIN IMMEDIATE
for write transactions.
* platform/sql/SQLiteTransaction.h:
* storage/SQLTransaction.cpp:
(WebCore::SQLTransaction::openTransactionAndPreflight): Passing
the read-only flag to the SQLiteTransaction instance.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 81e1a38..457fb4a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2009-09-21 Dumitru Daniliuc <dumi at chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Make all write transaction start with a BEGIN IMMEDIATE command
+ instead of BEGIN.
+
+ We cannot test this change in a layout test, because in order to
+ test it we need to spawn two database threads and execute
+ transaction steps on these two threads in a very specific order,
+ which seems impossible to do when they share the same main thread
+ (as they would in a layout test). The SQLite docs and the case
+ described in the bug though should be enough proof that we do have
+ a problem here and that this patch will fix it.
+
+ Relevant SQLite documentation:
+ http://www.sqlite.org/lang_transaction.html
+ http://www.sqlite.org/lockingv3.html#locking
+
+ https://bugs.webkit.org/show_bug.cgi?id=29218
+
+ * platform/sql/SQLiteTransaction.cpp:
+ (WebCore::SQLiteTransaction::SQLiteTransaction): Added a readOnly
+ parameter.
+ (WebCore::SQLiteTransaction::begin): Changed to BEGIN IMMEDIATE
+ for write transactions.
+ * platform/sql/SQLiteTransaction.h:
+ * storage/SQLTransaction.cpp:
+ (WebCore::SQLTransaction::openTransactionAndPreflight): Passing
+ the read-only flag to the SQLiteTransaction instance.
+
2009-09-21 Brady Eidson <beidson at apple.com>
Rubberstamped by Mark Rowe.
diff --git a/WebCore/platform/sql/SQLiteTransaction.cpp b/WebCore/platform/sql/SQLiteTransaction.cpp
index 0a236be..a4b2ac8 100644
--- a/WebCore/platform/sql/SQLiteTransaction.cpp
+++ b/WebCore/platform/sql/SQLiteTransaction.cpp
@@ -30,9 +30,10 @@
namespace WebCore {
-SQLiteTransaction::SQLiteTransaction(SQLiteDatabase& db)
+SQLiteTransaction::SQLiteTransaction(SQLiteDatabase& db, bool readOnly)
: m_db(db)
, m_inProgress(false)
+ , m_readOnly(readOnly)
{
}
@@ -46,7 +47,17 @@ void SQLiteTransaction::begin()
{
if (!m_inProgress) {
ASSERT(!m_db.m_transactionInProgress);
- m_inProgress = m_db.executeCommand("BEGIN;");
+ // Call BEGIN IMMEDIATE for a write transaction to acquire
+ // a RESERVED lock on the DB file. Otherwise, another write
+ // transaction (on another connection) could make changes
+ // to the same DB file before this transaction gets to execute
+ // any statements. If that happens, this transaction will fail.
+ // http://www.sqlite.org/lang_transaction.html
+ // http://www.sqlite.org/lockingv3.html#locking
+ if (m_readOnly)
+ m_inProgress = m_db.executeCommand("BEGIN;");
+ else
+ m_inProgress = m_db.executeCommand("BEGIN IMMEDIATE;");
m_db.m_transactionInProgress = m_inProgress;
}
}
diff --git a/WebCore/platform/sql/SQLiteTransaction.h b/WebCore/platform/sql/SQLiteTransaction.h
index cf5a180..557d81c 100644
--- a/WebCore/platform/sql/SQLiteTransaction.h
+++ b/WebCore/platform/sql/SQLiteTransaction.h
@@ -35,7 +35,7 @@ class SQLiteDatabase;
class SQLiteTransaction : public Noncopyable
{
public:
- SQLiteTransaction(SQLiteDatabase& db);
+ SQLiteTransaction(SQLiteDatabase& db, bool readOnly = false);
~SQLiteTransaction();
void begin();
@@ -47,10 +47,9 @@ public:
private:
SQLiteDatabase& m_db;
bool m_inProgress;
-
+ bool m_readOnly;
};
} // namespace WebCore
#endif // SQLiteTransation_H
-
diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp
index 28940a7..4ce65f6 100644
--- a/WebCore/storage/SQLTransaction.cpp
+++ b/WebCore/storage/SQLTransaction.cpp
@@ -236,7 +236,7 @@ void SQLTransaction::openTransactionAndPreflight()
m_database->m_sqliteDatabase.setMaximumSize(m_database->maximumSize());
ASSERT(!m_sqliteTransaction);
- m_sqliteTransaction.set(new SQLiteTransaction(m_database->m_sqliteDatabase));
+ m_sqliteTransaction.set(new SQLiteTransaction(m_database->m_sqliteDatabase, m_readOnly));
m_database->m_databaseAuthorizer->disable();
m_sqliteTransaction->begin();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list