From 411b325dfeeb3559c9372a5607e376a3f4556f13 Mon Sep 17 00:00:00 2001 From: "dietrich%mozilla.com" Date: Tue, 20 Nov 2007 23:27:41 +0000 Subject: [PATCH] Bug 381795 places indexes need review (followup, r=sspitzer) git-svn-id: svn://10.0.0.236/trunk@239756 18797224-902f-48f8-a5cc-f745e15eee43 --- .../places/src/nsMorkHistoryImporter.cpp | 2 ++ .../components/places/src/nsNavHistory.cpp | 15 ++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/mozilla/toolkit/components/places/src/nsMorkHistoryImporter.cpp b/mozilla/toolkit/components/places/src/nsMorkHistoryImporter.cpp index c7f2190c0f5..7049742880f 100644 --- a/mozilla/toolkit/components/places/src/nsMorkHistoryImporter.cpp +++ b/mozilla/toolkit/components/places/src/nsMorkHistoryImporter.cpp @@ -227,6 +227,8 @@ nsNavHistory::ImportHistory(nsIFile* aFile) } // Now add the results to history + // Note: Duplicates are handled by Places internally, no need to filter them + // out before importing. mozIStorageConnection *conn = GetStorageConnection(); NS_ENSURE_TRUE(conn, NS_ERROR_NOT_INITIALIZED); mozStorageTransaction transaction(conn, PR_FALSE); diff --git a/mozilla/toolkit/components/places/src/nsNavHistory.cpp b/mozilla/toolkit/components/places/src/nsNavHistory.cpp index 87be9487630..d176c0bba7a 100644 --- a/mozilla/toolkit/components/places/src/nsNavHistory.cpp +++ b/mozilla/toolkit/components/places/src/nsNavHistory.cpp @@ -158,7 +158,7 @@ // *** CURRENTLY DISABLED *** // Perform vacuum after 15 minutes of idle time, repeating. // 15 minutes = 900 seconds = 900000 milliseconds -#define VACUUM_IDLE_TIME_IN_MSECS (900000) +#define LONG_IDLE_TIME_IN_MSECS (900000) // Perform expiration after 5 minutes of idle time, repeating. // 5 minutes = 300 seconds = 300000 milliseconds @@ -1888,8 +1888,7 @@ nsNavHistory::AddVisit(nsIURI* aURI, PRTime aTime, PRInt64 aReferringVisit, // This will prevent corruption since we have to do a two-phase add. // Generally this won't do anything because AddURI has its own transaction. - mozStorageTransaction transaction(mDBConn, PR_FALSE, - mozIStorageConnection::TRANSACTION_EXCLUSIVE); + mozStorageTransaction transaction(mDBConn, PR_FALSE); // see if this is an update (revisit) or a new page mozStorageStatementScoper scoper(mDBGetPageVisitStats); @@ -3401,19 +3400,17 @@ nsNavHistory::OnIdle() (void)mExpire.ExpireItems(MAX_EXPIRE_RECORDS_ON_IDLE, &dummy); } - // If we've been idle for more than VACUUM_IDLE_TIME_IN_MSECS + // If we've been idle for more than LONG_IDLE_TIME_IN_MSECS // perform long-idle tasks. - if (idleTime > VACUUM_IDLE_TIME_IN_MSECS) { + if (idleTime > LONG_IDLE_TIME_IN_MSECS) { // Do a one-time re-creation of the moz_places.url index (bug 381795) // XXX REMOVE ME AFTER BETA2. PRBool oldIndexExists = PR_FALSE; rv = mDBConn->IndexExists(NS_LITERAL_CSTRING("moz_places_urlindex"), &oldIndexExists); if (oldIndexExists) { - // wrap in an exclusive transaction for safety and performance - mozStorageTransaction urlindexTransaction( - mDBConn, PR_FALSE, mozIStorageConnection::TRANSACTION_EXCLUSIVE); + // wrap in a transaction for safety and performance + mozStorageTransaction urlindexTransaction(mDBConn, PR_FALSE); // drop old index - PRTime start = PR_Now(); rv = mDBConn->ExecuteSimpleSQL( NS_LITERAL_CSTRING("DROP INDEX IF EXISTS moz_places_urlindex")); NS_ENSURE_SUCCESS(rv, rv);