Bug 460315 - set journal_mode to TRUNCATE
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Thu, 16 Oct 2008 15:59:33 -0400
changeset 20546 9753ccf7281956df1ff72ace1363137dfe7ba013
parent 20545 ad619c7d7f2e3f065d64b768baa7a74707adb44a
child 20547 b75910d0ea045e7b73e2a6504132777950169c4e
push id2953
push usersdwilsh@shawnwilsher.com
push dateThu, 16 Oct 2008 20:00:28 +0000
treeherdermozilla-central@9753ccf72819 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs460315
milestone1.9.1b2pre
Bug 460315 - set journal_mode to TRUNCATE Sets the journal_mode to the places database to TRUNCATE r=dietrich
toolkit/components/places/src/nsNavHistory.cpp
--- a/toolkit/components/places/src/nsNavHistory.cpp
+++ b/toolkit/components/places/src/nsNavHistory.cpp
@@ -795,16 +795,21 @@ nsNavHistory::InitDB(PRInt16 *aMadeChang
   NS_ENSURE_SUCCESS(rv, rv);
 
   // lock the db file
   // http://www.sqlite.org/pragma.html#pragma_locking_mode
   rv = mDBConn->ExecuteSimpleSQL(
     NS_LITERAL_CSTRING("PRAGMA locking_mode = EXCLUSIVE"));
   NS_ENSURE_SUCCESS(rv, rv);
 
+  // We use the TRUNCATE journal mode to reduce the number of fsyncs
+  rv = mDBConn->ExecuteSimpleSQL(
+    NS_LITERAL_CSTRING("PRAGMA journal_mode = TRUNCATE"));
+  NS_ENSURE_SUCCESS(rv, rv);
+
   // moz_places
   if (!tableExists) {
     *aMadeChanges = DB_MIGRATION_CREATED;
     rv = mDBConn->ExecuteSimpleSQL(CREATE_MOZ_PLACES);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
         "CREATE UNIQUE INDEX moz_places_url_uniqueindex ON moz_places (url)"));