Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
baixin01 committed Jul 19, 2024
1 parent 7260661 commit b9fc80a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/pika_repl_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "include/pika_repl_client_thread.h"

#include "net/include/thread_pool.h"
#include "pika_inner_message.pb. h"
#include "pika_inner_message.pb.h"


struct ReplClientTaskArg {
Expand Down
2 changes: 1 addition & 1 deletion src/pika_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ int PikaConf::Load() {

// rocksdb_statistics_tickers
std::string open_tickers;
GetConfStr("open-rocksdb-statistics-tickers", &open_tickers);
GetConfStr("enable-db-statistics", &open_tickers);
enable_db_statistics_ = open_tickers == "yes";

db_statistics_level_ = 0;
Expand Down
3 changes: 3 additions & 0 deletions src/pika_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,9 @@ void PikaServer::InitStorageOptions() {
storage_options_.table_options.pin_top_level_index_and_filter = true;
storage_options_.table_options.optimize_filters_for_memory = true;
}
// For statistics
storage_options_.enable_db_statistics = g_pika_conf->enable_db_statistics();
storage_options_.db_statistics_level = g_pika_conf->db_statistics_level();
}

storage::Status PikaServer::RewriteStorageOptions(const storage::OptionType& option_type,
Expand Down
2 changes: 2 additions & 0 deletions src/storage/include/storage/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ struct StorageOptions {
size_t block_cache_size = 0;
bool share_block_cache = false;
size_t statistics_max_size = 0;
int db_statistics_level = 0;
bool enable_db_statistics = false;
size_t small_compaction_threshold = 5000;
size_t small_compaction_duration_threshold = 10000;
Status ResetOptions(const OptionType& option_type, const std::unordered_map<std::string, std::string>& options_map);
Expand Down
10 changes: 5 additions & 5 deletions src/storage/src/redis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@

#include "rocksdb/env.h"

#include "include/pika_server.h"
#include "src/base_filter.h"
#include "src/lists_filter.h"
#include "src/redis.h"
#include "src/lists_filter.h"
#include "src/base_filter.h"
#include "src/zsets_filter.h"

namespace storage {
Expand Down Expand Up @@ -67,9 +66,9 @@ Status Redis::Open(const StorageOptions& storage_options, const std::string& db_

rocksdb::DBOptions db_ops(storage_options.options);
db_ops.create_missing_column_families = true;
if (g_pika_conf->enable_db_statistics()) {
if (storage_options.enable_db_statistics) {
db_statistics_ = rocksdb::CreateDBStatistics();
db_statistics_->set_stats_level(static_cast<rocksdb::StatsLevel>(g_pika_conf->db_statistics_level()));
db_statistics_->set_stats_level(static_cast<rocksdb::StatsLevel>(storage_options.db_statistics_level));
db_ops.statistics = db_statistics_;
}

Expand Down Expand Up @@ -381,6 +380,7 @@ void Redis::GetRocksDBInfo(std::string& info, const char* prefix) {
write_aggregated_int_property(rocksdb::DB::Properties::kBlobCacheUsage, "blob_cache_usage");
write_aggregated_int_property(rocksdb::DB::Properties::kBlobCachePinnedUsage, "blob_cache_pinned_usage");

//rocksdb ticker
{
// memtables num
write_ticker_count(rocksdb::Tickers::MEMTABLE_HIT, "memtable_hit");
Expand Down

0 comments on commit b9fc80a

Please sign in to comment.