2010-10-19 06:46:49 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-10-19 06:46:49 -07:00
|
|
|
|
2012-12-14 15:58:45 -08:00
|
|
|
#include "mozilla/DebugOnly.h"
|
|
|
|
|
2010-10-19 06:46:49 -07:00
|
|
|
#include "VacuumManager.h"
|
|
|
|
|
|
|
|
#include "mozilla/Services.h"
|
2011-06-01 18:05:12 -07:00
|
|
|
#include "mozilla/Preferences.h"
|
2010-10-19 06:46:49 -07:00
|
|
|
#include "nsIObserverService.h"
|
|
|
|
#include "nsIFile.h"
|
|
|
|
#include "nsThreadUtils.h"
|
|
|
|
#include "prlog.h"
|
2013-09-23 10:29:27 -07:00
|
|
|
#include "prtime.h"
|
2010-10-19 06:46:49 -07:00
|
|
|
|
|
|
|
#include "mozStorageConnection.h"
|
|
|
|
#include "mozIStorageStatement.h"
|
|
|
|
#include "mozIStorageAsyncStatement.h"
|
|
|
|
#include "mozIStoragePendingStatement.h"
|
|
|
|
#include "mozIStorageError.h"
|
2012-01-05 15:46:35 -08:00
|
|
|
#include "mozStorageHelper.h"
|
2013-08-29 09:10:35 -07:00
|
|
|
#include "nsXULAppAPI.h"
|
2010-10-19 06:46:49 -07:00
|
|
|
|
|
|
|
#define OBSERVER_TOPIC_IDLE_DAILY "idle-daily"
|
|
|
|
#define OBSERVER_TOPIC_XPCOM_SHUTDOWN "xpcom-shutdown"
|
|
|
|
|
|
|
|
// Used to notify begin and end of a heavy IO task.
|
|
|
|
#define OBSERVER_TOPIC_HEAVY_IO "heavy-io-task"
|
|
|
|
#define OBSERVER_DATA_VACUUM_BEGIN NS_LITERAL_STRING("vacuum-begin")
|
|
|
|
#define OBSERVER_DATA_VACUUM_END NS_LITERAL_STRING("vacuum-end")
|
|
|
|
|
|
|
|
// This preferences root will contain last vacuum timestamps (in seconds) for
|
|
|
|
// each database. The database filename is used as a key.
|
|
|
|
#define PREF_VACUUM_BRANCH "storage.vacuum.last."
|
|
|
|
|
|
|
|
// Time between subsequent vacuum calls for a certain database.
|
|
|
|
#define VACUUM_INTERVAL_SECONDS 30 * 86400 // 30 days.
|
|
|
|
|
|
|
|
#ifdef PR_LOGGING
|
|
|
|
extern PRLogModuleInfo *gStorageLog;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace storage {
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//// BaseCallback
|
|
|
|
|
|
|
|
class BaseCallback : public mozIStorageStatementCallback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_MOZISTORAGESTATEMENTCALLBACK
|
|
|
|
BaseCallback() {}
|
|
|
|
protected:
|
|
|
|
virtual ~BaseCallback() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
BaseCallback::HandleError(mozIStorageError *aError)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t result;
|
2010-10-19 06:46:49 -07:00
|
|
|
nsresult rv = aError->GetResult(&result);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString message;
|
2010-10-19 06:46:49 -07:00
|
|
|
rv = aError->GetMessage(message);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString warnMsg;
|
2010-10-19 06:46:49 -07:00
|
|
|
warnMsg.AppendLiteral("An error occured during async execution: ");
|
|
|
|
warnMsg.AppendInt(result);
|
|
|
|
warnMsg.AppendLiteral(" ");
|
|
|
|
warnMsg.Append(message);
|
|
|
|
NS_WARNING(warnMsg.get());
|
|
|
|
#endif
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
BaseCallback::HandleResult(mozIStorageResultSet *aResultSet)
|
|
|
|
{
|
|
|
|
// We could get results from PRAGMA statements, but we don't mind them.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
BaseCallback::HandleCompletion(uint16_t aReason)
|
2010-10-19 06:46:49 -07:00
|
|
|
{
|
|
|
|
// By default BaseCallback will just be silent on completion.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS1(
|
|
|
|
BaseCallback
|
|
|
|
, mozIStorageStatementCallback
|
|
|
|
)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//// Vacuumer declaration.
|
|
|
|
|
|
|
|
class Vacuumer : public BaseCallback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_MOZISTORAGESTATEMENTCALLBACK
|
|
|
|
|
2011-06-01 18:05:12 -07:00
|
|
|
Vacuumer(mozIStorageVacuumParticipant *aParticipant);
|
2010-10-19 06:46:49 -07:00
|
|
|
|
|
|
|
bool execute();
|
|
|
|
nsresult notifyCompletion(bool aSucceeded);
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsCOMPtr<mozIStorageVacuumParticipant> mParticipant;
|
|
|
|
nsCString mDBFilename;
|
|
|
|
nsCOMPtr<mozIStorageConnection> mDBConn;
|
|
|
|
};
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//// Vacuumer implementation.
|
|
|
|
|
2011-06-01 18:05:12 -07:00
|
|
|
Vacuumer::Vacuumer(mozIStorageVacuumParticipant *aParticipant)
|
2010-10-19 06:46:49 -07:00
|
|
|
: mParticipant(aParticipant)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Vacuumer::execute()
|
|
|
|
{
|
2012-02-22 03:23:05 -08:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "Must be running on the main thread!");
|
2010-10-19 06:46:49 -07:00
|
|
|
|
|
|
|
// Get the connection and check its validity.
|
|
|
|
nsresult rv = mParticipant->GetDatabaseConnection(getter_AddRefs(mDBConn));
|
|
|
|
NS_ENSURE_SUCCESS(rv, false);
|
2012-02-22 03:23:05 -08:00
|
|
|
bool ready = false;
|
2010-10-19 06:46:49 -07:00
|
|
|
if (!mDBConn || NS_FAILED(mDBConn->GetConnectionReady(&ready)) || !ready) {
|
2012-02-22 03:23:05 -08:00
|
|
|
NS_WARNING("Unable to get a connection to vacuum database");
|
2010-10-19 06:46:49 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-02-22 03:23:05 -08:00
|
|
|
// Ask for the expected page size. Vacuum can change the page size, unless
|
|
|
|
// the database is using WAL journaling.
|
|
|
|
// TODO Bug 634374: figure out a strategy to fix page size with WAL.
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t expectedPageSize = 0;
|
2010-10-19 06:46:49 -07:00
|
|
|
rv = mParticipant->GetExpectedDatabasePageSize(&expectedPageSize);
|
2013-04-04 17:14:46 -07:00
|
|
|
if (NS_FAILED(rv) || !Service::pageSizeIsValid(expectedPageSize)) {
|
2010-10-19 06:46:49 -07:00
|
|
|
NS_WARNING("Invalid page size requested for database, will use default ");
|
|
|
|
NS_WARNING(mDBFilename.get());
|
2013-04-04 17:14:46 -07:00
|
|
|
expectedPageSize = Service::getDefaultPageSize();
|
2010-10-19 06:46:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Get the database filename. Last vacuum time is stored under this name
|
|
|
|
// in PREF_VACUUM_BRANCH.
|
|
|
|
nsCOMPtr<nsIFile> databaseFile;
|
|
|
|
mDBConn->GetDatabaseFile(getter_AddRefs(databaseFile));
|
|
|
|
if (!databaseFile) {
|
|
|
|
NS_WARNING("Trying to vacuum a in-memory database!");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
nsAutoString databaseFilename;
|
|
|
|
rv = databaseFile->GetLeafName(databaseFilename);
|
|
|
|
NS_ENSURE_SUCCESS(rv, false);
|
|
|
|
mDBFilename = NS_ConvertUTF16toUTF8(databaseFilename);
|
2012-02-22 03:23:05 -08:00
|
|
|
MOZ_ASSERT(!mDBFilename.IsEmpty(), "Database filename cannot be empty");
|
2010-10-19 06:46:49 -07:00
|
|
|
|
|
|
|
// Check interval from last vacuum.
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t now = static_cast<int32_t>(PR_Now() / PR_USEC_PER_SEC);
|
|
|
|
int32_t lastVacuum;
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString prefName(PREF_VACUUM_BRANCH);
|
2011-06-01 18:05:12 -07:00
|
|
|
prefName += mDBFilename;
|
|
|
|
rv = Preferences::GetInt(prefName.get(), &lastVacuum);
|
2012-02-22 03:23:05 -08:00
|
|
|
if (NS_SUCCEEDED(rv) && (now - lastVacuum) < VACUUM_INTERVAL_SECONDS) {
|
|
|
|
// This database was vacuumed recently, skip it.
|
2010-10-19 06:46:49 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Notify that we are about to start vacuuming. The participant can opt-out
|
|
|
|
// if it cannot handle a vacuum at this time, and then we'll move to the next
|
|
|
|
// one.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool vacuumGranted = false;
|
2010-10-19 06:46:49 -07:00
|
|
|
rv = mParticipant->OnBeginVacuum(&vacuumGranted);
|
|
|
|
NS_ENSURE_SUCCESS(rv, false);
|
|
|
|
if (!vacuumGranted) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Notify a heavy IO task is about to start.
|
|
|
|
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
|
|
|
if (os) {
|
2012-02-22 03:23:05 -08:00
|
|
|
DebugOnly<nsresult> rv =
|
2012-07-30 07:20:58 -07:00
|
|
|
os->NotifyObservers(nullptr, OBSERVER_TOPIC_HEAVY_IO,
|
2012-02-22 03:23:05 -08:00
|
|
|
OBSERVER_DATA_VACUUM_BEGIN.get());
|
|
|
|
MOZ_ASSERT(NS_SUCCEEDED(rv), "Should be able to notify");
|
2010-10-19 06:46:49 -07:00
|
|
|
}
|
|
|
|
|
2012-02-22 03:23:05 -08:00
|
|
|
// Execute the statements separately, since the pragma may conflict with the
|
|
|
|
// vacuum, if they are executed in the same transaction.
|
|
|
|
nsCOMPtr<mozIStorageAsyncStatement> pageSizeStmt;
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString pageSizeQuery(MOZ_STORAGE_UNIQUIFY_QUERY_STR
|
2012-04-09 06:56:41 -07:00
|
|
|
"PRAGMA page_size = ");
|
|
|
|
pageSizeQuery.AppendInt(expectedPageSize);
|
|
|
|
rv = mDBConn->CreateAsyncStatement(pageSizeQuery,
|
|
|
|
getter_AddRefs(pageSizeStmt));
|
2012-02-22 03:23:05 -08:00
|
|
|
NS_ENSURE_SUCCESS(rv, false);
|
2014-03-17 15:19:53 -07:00
|
|
|
nsCOMPtr<BaseCallback> callback = new BaseCallback();
|
2012-02-22 03:23:05 -08:00
|
|
|
nsCOMPtr<mozIStoragePendingStatement> ps;
|
|
|
|
rv = pageSizeStmt->ExecuteAsync(callback, getter_AddRefs(ps));
|
|
|
|
NS_ENSURE_SUCCESS(rv, false);
|
2010-10-19 06:46:49 -07:00
|
|
|
|
|
|
|
nsCOMPtr<mozIStorageAsyncStatement> stmt;
|
|
|
|
rv = mDBConn->CreateAsyncStatement(NS_LITERAL_CSTRING(
|
|
|
|
"VACUUM"
|
|
|
|
), getter_AddRefs(stmt));
|
|
|
|
NS_ENSURE_SUCCESS(rv, false);
|
|
|
|
rv = stmt->ExecuteAsync(this, getter_AddRefs(ps));
|
|
|
|
NS_ENSURE_SUCCESS(rv, false);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//// mozIStorageStatementCallback
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
Vacuumer::HandleError(mozIStorageError *aError)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t result;
|
2010-10-19 06:46:49 -07:00
|
|
|
nsresult rv = aError->GetResult(&result);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString message;
|
2010-10-19 06:46:49 -07:00
|
|
|
rv = aError->GetMessage(message);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString warnMsg;
|
2010-10-19 06:46:49 -07:00
|
|
|
warnMsg.AppendLiteral("Unable to vacuum database: ");
|
|
|
|
warnMsg.Append(mDBFilename);
|
|
|
|
warnMsg.AppendLiteral(" - ");
|
|
|
|
warnMsg.AppendInt(result);
|
|
|
|
warnMsg.AppendLiteral(" ");
|
|
|
|
warnMsg.Append(message);
|
|
|
|
NS_WARNING(warnMsg.get());
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PR_LOGGING
|
|
|
|
{
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t result;
|
2010-10-19 06:46:49 -07:00
|
|
|
nsresult rv = aError->GetResult(&result);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString message;
|
2010-10-19 06:46:49 -07:00
|
|
|
rv = aError->GetMessage(message);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
PR_LOG(gStorageLog, PR_LOG_ERROR,
|
|
|
|
("Vacuum failed with error: %d '%s'. Database was: '%s'",
|
|
|
|
result, message.get(), mDBFilename.get()));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
Vacuumer::HandleResult(mozIStorageResultSet *aResultSet)
|
|
|
|
{
|
|
|
|
NS_NOTREACHED("Got a resultset from a vacuum?");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
Vacuumer::HandleCompletion(uint16_t aReason)
|
2010-10-19 06:46:49 -07:00
|
|
|
{
|
|
|
|
if (aReason == REASON_FINISHED) {
|
|
|
|
// Update last vacuum time.
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t now = static_cast<int32_t>(PR_Now() / PR_USEC_PER_SEC);
|
2012-02-22 03:23:05 -08:00
|
|
|
MOZ_ASSERT(!mDBFilename.IsEmpty(), "Database filename cannot be empty");
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString prefName(PREF_VACUUM_BRANCH);
|
2011-06-01 18:05:12 -07:00
|
|
|
prefName += mDBFilename;
|
2012-02-22 03:23:05 -08:00
|
|
|
DebugOnly<nsresult> rv = Preferences::SetInt(prefName.get(), now);
|
|
|
|
MOZ_ASSERT(NS_SUCCEEDED(rv), "Should be able to set a preference");
|
2010-10-19 06:46:49 -07:00
|
|
|
}
|
|
|
|
|
2011-02-16 04:51:26 -08:00
|
|
|
notifyCompletion(aReason == REASON_FINISHED);
|
2010-10-19 06:46:49 -07:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
Vacuumer::notifyCompletion(bool aSucceeded)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
|
|
|
if (os) {
|
2012-07-30 07:20:58 -07:00
|
|
|
os->NotifyObservers(nullptr, OBSERVER_TOPIC_HEAVY_IO,
|
2010-10-19 06:46:49 -07:00
|
|
|
OBSERVER_DATA_VACUUM_END.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult rv = mParticipant->OnEndVacuum(aSucceeded);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // Anonymous namespace.
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//// VacuumManager
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS1(
|
|
|
|
VacuumManager
|
|
|
|
, nsIObserver
|
|
|
|
)
|
|
|
|
|
|
|
|
VacuumManager *
|
2012-07-30 07:20:58 -07:00
|
|
|
VacuumManager::gVacuumManager = nullptr;
|
2010-10-19 06:46:49 -07:00
|
|
|
|
|
|
|
VacuumManager *
|
|
|
|
VacuumManager::getSingleton()
|
|
|
|
{
|
2013-08-29 09:10:35 -07:00
|
|
|
//Don't allocate it in the child Process.
|
|
|
|
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2010-10-19 06:46:49 -07:00
|
|
|
if (gVacuumManager) {
|
|
|
|
NS_ADDREF(gVacuumManager);
|
|
|
|
return gVacuumManager;
|
|
|
|
}
|
|
|
|
gVacuumManager = new VacuumManager();
|
|
|
|
if (gVacuumManager) {
|
|
|
|
NS_ADDREF(gVacuumManager);
|
|
|
|
}
|
|
|
|
return gVacuumManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
VacuumManager::VacuumManager()
|
|
|
|
: mParticipants("vacuum-participant")
|
|
|
|
{
|
2012-02-22 03:23:05 -08:00
|
|
|
MOZ_ASSERT(!gVacuumManager,
|
|
|
|
"Attempting to create two instances of the service!");
|
2010-10-19 06:46:49 -07:00
|
|
|
gVacuumManager = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
VacuumManager::~VacuumManager()
|
|
|
|
{
|
|
|
|
// Remove the static reference to the service. Check to make sure its us
|
|
|
|
// in case somebody creates an extra instance of the service.
|
2012-02-22 03:23:05 -08:00
|
|
|
MOZ_ASSERT(gVacuumManager == this,
|
|
|
|
"Deleting a non-singleton instance of the service");
|
2010-10-19 06:46:49 -07:00
|
|
|
if (gVacuumManager == this) {
|
2012-07-30 07:20:58 -07:00
|
|
|
gVacuumManager = nullptr;
|
2010-10-19 06:46:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//// nsIObserver
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
VacuumManager::Observe(nsISupports *aSubject,
|
|
|
|
const char *aTopic,
|
2014-01-04 07:02:17 -08:00
|
|
|
const char16_t *aData)
|
2010-10-19 06:46:49 -07:00
|
|
|
{
|
|
|
|
if (strcmp(aTopic, OBSERVER_TOPIC_IDLE_DAILY) == 0) {
|
|
|
|
// Try to run vacuum on all registered entries. Will stop at the first
|
|
|
|
// successful one.
|
2013-10-10 05:48:03 -07:00
|
|
|
nsCOMArray<mozIStorageVacuumParticipant> entries;
|
|
|
|
mParticipants.GetEntries(entries);
|
2010-10-19 06:46:49 -07:00
|
|
|
// If there are more entries than what a month can contain, we could end up
|
|
|
|
// skipping some, since we run daily. So we use a starting index.
|
2011-06-01 18:05:12 -07:00
|
|
|
static const char* kPrefName = PREF_VACUUM_BRANCH "index";
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t startIndex = Preferences::GetInt(kPrefName, 0);
|
2010-10-19 06:46:49 -07:00
|
|
|
if (startIndex >= entries.Count()) {
|
|
|
|
startIndex = 0;
|
|
|
|
}
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t index;
|
2010-10-19 06:46:49 -07:00
|
|
|
for (index = startIndex; index < entries.Count(); ++index) {
|
2014-03-17 15:19:53 -07:00
|
|
|
nsCOMPtr<Vacuumer> vacuum = new Vacuumer(entries[index]);
|
2010-10-19 06:46:49 -07:00
|
|
|
// Only vacuum one database per day.
|
|
|
|
if (vacuum->execute()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-02-22 03:23:05 -08:00
|
|
|
DebugOnly<nsresult> rv = Preferences::SetInt(kPrefName, index);
|
|
|
|
MOZ_ASSERT(NS_SUCCEEDED(rv), "Should be able to set a preference");
|
2010-10-19 06:46:49 -07:00
|
|
|
}
|
2010-10-19 06:46:51 -07:00
|
|
|
|
2010-10-19 06:46:49 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace storage
|
|
|
|
} // namespace mozilla
|