Commit b7c1cc05 authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Remove switches for ModelTypeStoreBackend performance tweaks

These features are enabled by default with M71 and seem effective
according to experiments on canary&dev, so there's no need to keep these
feature toggles around.

These features may also be the cause for certain unrelated test
flakiness on TSAN, presumably because test-only feature overrides are
not thread safe.

Bug: 887068,892550
Change-Id: Ia57e1f161f726db05e2322568da51d3681df8751
Reviewed-on: https://chromium-review.googlesource.com/c/1296504Reviewed-by: default avatarJan Krcal <jkrcal@chromium.org>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602265}
parent 83dbce6b
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <utility> #include <utility>
#include "base/feature_list.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "components/sync/protocol/model_type_store_schema_descriptor.pb.h" #include "components/sync/protocol/model_type_store_schema_descriptor.pb.h"
...@@ -30,11 +29,6 @@ const char ModelTypeStoreBackend::kDBSchemaDescriptorRecordId[] = ...@@ -30,11 +29,6 @@ const char ModelTypeStoreBackend::kDBSchemaDescriptorRecordId[] =
const char ModelTypeStoreBackend::kStoreInitResultHistogramName[] = const char ModelTypeStoreBackend::kStoreInitResultHistogramName[] =
"Sync.ModelTypeStoreInitResult"; "Sync.ModelTypeStoreInitResult";
const base::Feature kModelTypeStoreAvoidReadCache{
"kModelTypeStoreAvoidReadCache", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kModelTypeStoreSmallWriteBufferSize{
"kModelTypeStoreSmallWriteBufferSize", base::FEATURE_ENABLED_BY_DEFAULT};
namespace { namespace {
StoreInitResultForHistogram LevelDbStatusToStoreInitResult( StoreInitResultForHistogram LevelDbStatusToStoreInitResult(
...@@ -138,9 +132,7 @@ leveldb::Status ModelTypeStoreBackend::OpenDatabase(const std::string& path, ...@@ -138,9 +132,7 @@ leveldb::Status ModelTypeStoreBackend::OpenDatabase(const std::string& path,
leveldb_env::Options options; leveldb_env::Options options;
options.create_if_missing = true; options.create_if_missing = true;
options.paranoid_checks = true; options.paranoid_checks = true;
options.write_buffer_size = 512 * 1024;
if (base::FeatureList::IsEnabled(kModelTypeStoreSmallWriteBufferSize))
options.write_buffer_size = 512 * 1024;
if (env) if (env)
options.env = env; options.env = env;
...@@ -166,8 +158,7 @@ base::Optional<ModelError> ModelTypeStoreBackend::ReadRecordsWithPrefix( ...@@ -166,8 +158,7 @@ base::Optional<ModelError> ModelTypeStoreBackend::ReadRecordsWithPrefix(
record_list->reserve(id_list.size()); record_list->reserve(id_list.size());
leveldb::ReadOptions read_options; leveldb::ReadOptions read_options;
read_options.verify_checksums = true; read_options.verify_checksums = true;
if (base::FeatureList::IsEnabled(kModelTypeStoreAvoidReadCache)) read_options.fill_cache = false;
read_options.fill_cache = false;
std::string key; std::string key;
std::string value; std::string value;
for (const std::string& id : id_list) { for (const std::string& id : id_list) {
...@@ -191,8 +182,7 @@ base::Optional<ModelError> ModelTypeStoreBackend::ReadAllRecordsWithPrefix( ...@@ -191,8 +182,7 @@ base::Optional<ModelError> ModelTypeStoreBackend::ReadAllRecordsWithPrefix(
DCHECK(db_); DCHECK(db_);
leveldb::ReadOptions read_options; leveldb::ReadOptions read_options;
read_options.verify_checksums = true; read_options.verify_checksums = true;
if (base::FeatureList::IsEnabled(kModelTypeStoreAvoidReadCache)) read_options.fill_cache = false;
read_options.fill_cache = false;
std::unique_ptr<leveldb::Iterator> iter(db_->NewIterator(read_options)); std::unique_ptr<leveldb::Iterator> iter(db_->NewIterator(read_options));
const leveldb::Slice prefix_slice(prefix); const leveldb::Slice prefix_slice(prefix);
for (iter->Seek(prefix_slice); iter->Valid(); iter->Next()) { for (iter->Seek(prefix_slice); iter->Valid(); iter->Next()) {
...@@ -225,8 +215,7 @@ ModelTypeStoreBackend::DeleteDataAndMetadataForPrefix( ...@@ -225,8 +215,7 @@ ModelTypeStoreBackend::DeleteDataAndMetadataForPrefix(
DCHECK(db_); DCHECK(db_);
leveldb::WriteBatch write_batch; leveldb::WriteBatch write_batch;
leveldb::ReadOptions read_options; leveldb::ReadOptions read_options;
if (base::FeatureList::IsEnabled(kModelTypeStoreAvoidReadCache)) read_options.fill_cache = false;
read_options.fill_cache = false;
std::unique_ptr<leveldb::Iterator> iter(db_->NewIterator(read_options)); std::unique_ptr<leveldb::Iterator> iter(db_->NewIterator(read_options));
const leveldb::Slice prefix_slice(prefix); const leveldb::Slice prefix_slice(prefix);
for (iter->Seek(prefix_slice); iter->Valid(); iter->Next()) { for (iter->Seek(prefix_slice); iter->Valid(); iter->Next()) {
...@@ -255,8 +244,7 @@ int64_t ModelTypeStoreBackend::GetStoreVersion() { ...@@ -255,8 +244,7 @@ int64_t ModelTypeStoreBackend::GetStoreVersion() {
DCHECK(db_); DCHECK(db_);
leveldb::ReadOptions read_options; leveldb::ReadOptions read_options;
read_options.verify_checksums = true; read_options.verify_checksums = true;
if (base::FeatureList::IsEnabled(kModelTypeStoreAvoidReadCache)) read_options.fill_cache = false;
read_options.fill_cache = false;
std::string value; std::string value;
ModelTypeStoreSchemaDescriptor schema_descriptor; ModelTypeStoreSchemaDescriptor schema_descriptor;
leveldb::Status status = leveldb::Status status =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment