Bug 415201 ? Firefox shutdowns very slow and with 100% CPU (r=marco, r=mano)

git-svn-id: svn://10.0.0.236/trunk@245717 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dietrich%mozilla.com 2008-02-14 17:33:30 +00:00
parent 3c3753ad37
commit 773b83f0e5
2 changed files with 34 additions and 2 deletions

View File

@ -259,8 +259,9 @@ nsAnnotationService::InitTables(mozIStorageConnection* aDBConn)
"dateAdded INTEGER DEFAULT 0,"
"lastModified INTEGER DEFAULT 0)"));
NS_ENSURE_SUCCESS(rv, rv);
rv = aDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"CREATE INDEX moz_annos_attributesindex ON moz_annos (anno_attribute_id)"));
"CREATE UNIQUE INDEX moz_annos_placeattributeindex ON moz_annos (place_id, anno_attribute_id)"));
NS_ENSURE_SUCCESS(rv, rv);
}
@ -289,7 +290,7 @@ nsAnnotationService::InitTables(mozIStorageConnection* aDBConn)
"lastModified INTEGER DEFAULT 0)"));
NS_ENSURE_SUCCESS(rv, rv);
rv = aDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"CREATE INDEX moz_items_annos_attributesindex ON moz_items_annos (item_id, anno_attribute_id)"));
"CREATE UNIQUE INDEX moz_items_annos_itemattributeindex ON moz_items_annos (item_id, anno_attribute_id)"));
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -1349,6 +1349,37 @@ nsNavHistory::CleanUpOnQuit()
NS_LITERAL_CSTRING("DROP INDEX IF EXISTS moz_annos_item_idindex"));
idxTransaction.Commit();
// Do a one-time re-creation of the moz_annos indexes (bug 415201)
PRBool oldIndexExists = PR_FALSE;
rv = mDBConn->IndexExists(NS_LITERAL_CSTRING("moz_annos_attributesindex"), &oldIndexExists);
NS_ENSURE_SUCCESS(rv, rv);
if (oldIndexExists) {
// wrap in a transaction for safety and performance
mozStorageTransaction annoIndexTransaction(mDBConn, PR_FALSE);
// drop old uri annos index
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("DROP INDEX moz_annos_attributesindex"));
NS_ENSURE_SUCCESS(rv, rv);
// create new uri annos index
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("CREATE UNIQUE INDEX moz_annos_placeattributeindex ON moz_annos (place_id, anno_attribute_id)"));
NS_ENSURE_SUCCESS(rv, rv);
// drop old item annos index
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("DROP INDEX IF EXISTS moz_items_annos_attributesindex"));
NS_ENSURE_SUCCESS(rv, rv);
// create new item annos index
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("CREATE UNIQUE INDEX moz_items_annos_itemattributeindex ON moz_items_annos (item_id, anno_attribute_id)"));
NS_ENSURE_SUCCESS(rv, rv);
rv = annoIndexTransaction.Commit();
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}