This is an automated email from the ASF dual-hosted git repository.
laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new c71cc47 feat: add an env to enable or disable block cache of an app
(#792)
c71cc47 is described below
commit c71cc47664a24f7d2294cb431b1f2a6bb44981ea
Author: Zhong Chaoqiang <[email protected]>
AuthorDate: Sat Jul 31 10:19:13 2021 +0800
feat: add an env to enable or disable block cache of an app (#792)
---
rdsn | 2 +-
src/base/pegasus_const.cpp | 3 +++
src/base/pegasus_const.h | 2 ++
src/server/pegasus_server_impl.cpp | 22 ++++++++++++++++++++++
src/server/pegasus_server_impl.h | 2 ++
5 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/rdsn b/rdsn
index 7e3eab7..e3e24f7 160000
--- a/rdsn
+++ b/rdsn
@@ -1 +1 @@
-Subproject commit 7e3eab786fb5e0675d84eac22d5508b03538d5f4
+Subproject commit e3e24f7fd4d05ba8241beb8dab42ca072dbc3d11
diff --git a/src/base/pegasus_const.cpp b/src/base/pegasus_const.cpp
index d78e7b7..1a72bc6 100644
--- a/src/base/pegasus_const.cpp
+++ b/src/base/pegasus_const.cpp
@@ -85,6 +85,9 @@ const std::string
PEGASUS_CLUSTER_SECTION_NAME("pegasus.clusters");
/// table level slow query
const std::string
ROCKSDB_ENV_SLOW_QUERY_THRESHOLD("replica.slow_query_threshold");
+/// enable or disable block cache of app
+const std::string
ROCKSDB_BLOCK_CACHE_ENABLED("replica.rocksdb_block_cache_enabled");
+
/// time threshold of each rocksdb iteration
const std::string
ROCKSDB_ITERATION_THRESHOLD_TIME_MS("replica.rocksdb_iteration_threshold_time_ms");
diff --git a/src/base/pegasus_const.h b/src/base/pegasus_const.h
index 217171a..c0eb973 100644
--- a/src/base/pegasus_const.h
+++ b/src/base/pegasus_const.h
@@ -63,6 +63,8 @@ extern const std::string ROCKSDB_ENV_SLOW_QUERY_THRESHOLD;
extern const std::string ROCKSDB_ITERATION_THRESHOLD_TIME_MS;
+extern const std::string ROCKSDB_BLOCK_CACHE_ENABLED;
+
extern const std::string SPLIT_VALIDATE_PARTITION_HASH;
extern const std::string USER_SPECIFIED_COMPACTION;
diff --git a/src/server/pegasus_server_impl.cpp
b/src/server/pegasus_server_impl.cpp
index 637a6dc..0779b6c 100644
--- a/src/server/pegasus_server_impl.cpp
+++ b/src/server/pegasus_server_impl.cpp
@@ -2558,6 +2558,28 @@ void
pegasus_server_impl::update_rocksdb_iteration_threshold(
}
}
+void pegasus_server_impl::update_rocksdb_block_cache_enabled(
+ const std::map<std::string, std::string> &envs)
+{
+ // default of ReadOptions:fill_cache is true
+ bool cache_enabled = true;
+ auto find = envs.find(ROCKSDB_BLOCK_CACHE_ENABLED);
+ if (find != envs.end()) {
+ if (!dsn::buf2bool(find->second, cache_enabled)) {
+ derror_replica("{}={} is invalid.", find->first, find->second);
+ return;
+ }
+ }
+
+ if (_data_cf_rd_opts.fill_cache != cache_enabled) {
+ ddebug_replica("update app env[{}] from \"{}\" to \"{}\" succeed",
+ ROCKSDB_BLOCK_CACHE_ENABLED,
+ _data_cf_rd_opts.fill_cache,
+ cache_enabled);
+ _data_cf_rd_opts.fill_cache = cache_enabled;
+ }
+}
+
void pegasus_server_impl::update_validate_partition_hash(
const std::map<std::string, std::string> &envs)
{
diff --git a/src/server/pegasus_server_impl.h b/src/server/pegasus_server_impl.h
index 48613f3..f7a68cf 100644
--- a/src/server/pegasus_server_impl.h
+++ b/src/server/pegasus_server_impl.h
@@ -269,6 +269,8 @@ private:
void update_rocksdb_iteration_threshold(const std::map<std::string,
std::string> &envs);
+ void update_rocksdb_block_cache_enabled(const std::map<std::string,
std::string> &envs);
+
void update_validate_partition_hash(const std::map<std::string,
std::string> &envs);
void update_user_specified_compaction(const std::map<std::string,
std::string> &envs);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]