Title: [158865] trunk/Source/WebCore
Revision
158865
Author
beid...@apple.com
Date
2013-11-07 12:49:56 -0800 (Thu, 07 Nov 2013)

Log Message

Use SQLite journal mode WAL (WriteAheadLogging)
https://bugs.webkit.org/show_bug.cgi?id=124009

Reviewed by Anders Carlsson.

WriteAheadLogging journalling is better than the traditional rollback model.

* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open): Use a PRAGMA to set journal_mode to WAL.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158864 => 158865)


--- trunk/Source/WebCore/ChangeLog	2013-11-07 20:26:16 UTC (rev 158864)
+++ trunk/Source/WebCore/ChangeLog	2013-11-07 20:49:56 UTC (rev 158865)
@@ -1,3 +1,15 @@
+2013-11-07  Brady Eidson  <beid...@apple.com>
+
+        Use SQLite journal mode WAL (WriteAheadLogging)
+        https://bugs.webkit.org/show_bug.cgi?id=124009
+
+        Reviewed by Anders Carlsson.
+
+        WriteAheadLogging journalling is better than the traditional rollback model.
+
+        * platform/sql/SQLiteDatabase.cpp:
+        (WebCore::SQLiteDatabase::open): Use a PRAGMA to set journal_mode to WAL.
+
 2013-11-07  Mark Lam  <mark....@apple.com>
 
         Cosmetic: rename xxxId to xxxID for ScriptId, SourceId, and BreakpointId.

Modified: trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp (158864 => 158865)


--- trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp	2013-11-07 20:26:16 UTC (rev 158864)
+++ trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp	2013-11-07 20:49:56 UTC (rev 158865)
@@ -98,6 +98,16 @@
     if (!SQLiteStatement(*this, ASCIILiteral("PRAGMA temp_store = MEMORY;")).executeCommand())
         LOG_ERROR("SQLite database could not set temp_store to memory");
 
+    SQLiteStatement walStatement(*this, ASCIILiteral("PRAGMA journal_mode=WAL;"));
+    if (walStatement.step() != SQLITE_ROW)
+        LOG_ERROR("SQLite database failed to set journal_mode to WAL, error: %s",  lastErrorMsg());
+
+#ifndef NDEBUG
+    String mode = walStatement.getColumnText(0);
+    if (!equalIgnoringCase(mode, "wal"))
+        LOG_ERROR("journal_mode of database should be 'wal', but is '%s'", mode.utf8().data());
+#endif
+
     return isOpen();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to