0

Quota: add flag to disable media flushing of quota db

This will allow us to experiment with disabling this flag via finch to
observe the effect on error rates.

Bug: 1453648
Change-Id: I0989a7e56abeb8d90810845ec9fd6c8fcbae32e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4629865
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1160818}
This commit is contained in:
Evan Stade
2023-06-21 20:14:13 +00:00
committed by Chromium LUCI CQ
parent 4c4d8875fa
commit 6315d87ce5
3 changed files with 19 additions and 2 deletions

@ -27,6 +27,7 @@
#include "sql/statement.h"
#include "sql/transaction.h"
#include "storage/browser/quota/quota_database_migrations.h"
#include "storage/browser/quota/quota_features.h"
#include "storage/browser/quota/quota_internals.mojom.h"
#include "storage/browser/quota/special_storage_policy.h"
#include "url/gurl.h"
@ -932,7 +933,7 @@ QuotaError QuotaDatabase::EnsureOpened() {
return QuotaError::kDatabaseError;
}
db_ = std::make_unique<sql::Database>(sql::DatabaseOptions{
sql::DatabaseOptions options{
.exclusive_locking = true,
// The quota database is a critical storage component. If it's corrupted,
// all client-side storage APIs fail, because they don't know where their
@ -940,7 +941,12 @@ QuotaError QuotaDatabase::EnsureOpened() {
.flush_to_media = true,
.page_size = 4096,
.cache_size = 500,
});
};
if (base::FeatureList::IsEnabled(features::kDisableQuotaDbFullFSync)) {
options.flush_to_media = false;
}
db_ = std::make_unique<sql::Database>(std::move(options));
meta_table_ = std::make_unique<sql::MetaTable>();
db_->set_histogram_tag("Quota");

@ -13,6 +13,14 @@ namespace {
constexpr int64_t kMBytes = 1024 * 1024;
} // namespace
// Disables the `flush_to_media` setting for the quota SQLite db, which maps to
// F_FULLFSYNC on mac, which is known to have performance issues. Specifically,
// this is suspected of causing a high number of SQLite IO errors as encountered
// by CDM storage code.
BASE_FEATURE(kDisableQuotaDbFullFSync,
"DisableQuotaDbFullFSync",
base::FEATURE_DISABLED_BY_DEFAULT);
// A kill switch for the new approach to storage eviction on low disk space. See
// crbug.com/1382847
BASE_FEATURE(kNewQuotaEvictionRoutine,

@ -13,6 +13,9 @@ namespace storage {
namespace features {
COMPONENT_EXPORT(STORAGE_BROWSER)
BASE_DECLARE_FEATURE(kDisableQuotaDbFullFSync);
COMPONENT_EXPORT(STORAGE_BROWSER)
BASE_DECLARE_FEATURE(kNewQuotaEvictionRoutine);