Bug 658305 - Use journal_size_limit on places.sqlite.

r=dietrich
This commit is contained in:
Marco Bonardo 2011-09-01 12:01:59 +02:00
Родитель d2bb67796d
Коммит adaec09bc1
2 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -355,9 +355,10 @@ IsValidGUID(const nsCString& aGUID)
void
ForceWALCheckpoint(mozIStorageConnection* aDBConn)
{
// Use a FULL checkpoint to ensure the operation is not dismissed by writers.
nsCOMPtr<mozIStorageAsyncStatement> stmt;
(void)aDBConn->CreateAsyncStatement(NS_LITERAL_CSTRING(
"pragma wal_checkpoint "
"pragma wal_checkpoint(FULL)"
), getter_AddRefs(stmt));
nsCOMPtr<mozIStoragePendingStatement> handle;
(void)stmt->ExecuteAsync(nsnull, getter_AddRefs(handle));

Просмотреть файл

@ -810,7 +810,17 @@ nsNavHistory::InitDB()
NS_ENSURE_SUCCESS(rv, rv);
}
// Grow places in 10MiB increments
// The journal is usually free to grow for performance reasons, but it never
// shrinks back. Since the space taken may be problematic, especially on
// mobile devices, limit its size.
// Since exceeding the limit will cause a truncate, allow a slightly
// larger limit than DATABASE_MAX_WAL_SIZE_IN_KIBIBYTES to reduce the number
// of times it is needed.
nsCAutoString journalSizePragma("PRAGMA journal_size_limit = ");
journalSizePragma.AppendInt(DATABASE_MAX_WAL_SIZE_IN_KIBIBYTES * 3);
(void)mDBConn->ExecuteSimpleSQL(journalSizePragma);
// Grow places in 10MiB increments to limit fragmentation on disk.
(void)mDBConn->SetGrowthIncrement(10 * BYTES_PER_MEBIBYTE, EmptyCString());
// We use our functions during migration, so initialize them now.