diff --git a/src/server/redis_connection.cc b/src/server/redis_connection.cc index 19bcbcebb2d..a470f225996 100644 --- a/src/server/redis_connection.cc +++ b/src/server/redis_connection.cc @@ -409,18 +409,19 @@ Status Connection::ExecuteCommand(const std::string &cmd_name, const std::vector } void Connection::ExecuteCommands(std::deque *to_process_cmds) { - Config *config = srv_->GetConfig(); - std::string reply, password = config->requirepass; + const Config *config = srv_->GetConfig(); + std::string reply; + std::string password = config->requirepass; while (!to_process_cmds->empty()) { - auto cmd_tokens = to_process_cmds->front(); + CommandTokens cmd_tokens = std::move(to_process_cmds->front()); to_process_cmds->pop_front(); if (cmd_tokens.empty()) continue; bool is_multi_exec = IsFlagEnabled(Connection::kMultiExec); if (IsFlagEnabled(redis::Connection::kCloseAfterReply) && !is_multi_exec) break; - auto cmd_s = srv_->LookupAndCreateCommand(cmd_tokens.front()); + auto cmd_s = Server::LookupAndCreateCommand(cmd_tokens.front()); if (!cmd_s.IsOK()) { if (is_multi_exec) multi_error_ = true; Reply(redis::Error("ERR unknown command " + cmd_tokens.front())); @@ -428,7 +429,7 @@ void Connection::ExecuteCommands(std::deque *to_process_cmds) { } auto current_cmd = std::move(*cmd_s); - const auto attributes = current_cmd->GetAttributes(); + const auto &attributes = current_cmd->GetAttributes(); auto cmd_name = attributes->name; auto cmd_flags = attributes->GenerateFlags(cmd_tokens); diff --git a/src/server/server.cc b/src/server/server.cc index f131bccddf4..9408b90c6d9 100644 --- a/src/server/server.cc +++ b/src/server/server.cc @@ -847,22 +847,25 @@ void Server::GetRocksDBInfo(std::string *info) { string_stream << "# RocksDB\r\n"; - uint64_t block_cache_usage = 0; - // All column families share the same block cache, so it's good to count a single one. - auto subkey_cf_handle = storage->GetCFHandle(engine::kSubkeyColumnFamilyName); - db->GetIntProperty(subkey_cf_handle, "rocksdb.block-cache-usage", &block_cache_usage); - string_stream << "block_cache_usage:" << block_cache_usage << "\r\n"; + { + // All column families share the same block cache, so it's good to count a single one. + uint64_t block_cache_usage = 0; + uint64_t block_cache_pinned_usage = 0; + auto subkey_cf_handle = storage->GetCFHandle(engine::kSubkeyColumnFamilyName); + db->GetIntProperty(subkey_cf_handle, rocksdb::DB::Properties::kBlockCacheUsage, &block_cache_usage); + string_stream << "block_cache_usage:" << block_cache_usage << "\r\n"; + db->GetIntProperty(subkey_cf_handle, rocksdb::DB::Properties::kBlockCachePinnedUsage, &block_cache_pinned_usage); + string_stream << "block_cache_pinned_usage[" << subkey_cf_handle->GetName() << "]:" << block_cache_pinned_usage + << "\r\n"; + } for (const auto &cf_handle : *storage->GetCFHandles()) { uint64_t estimate_keys = 0; - uint64_t block_cache_pinned_usage = 0; uint64_t index_and_filter_cache_usage = 0; std::map cf_stats_map; - db->GetIntProperty(cf_handle, "rocksdb.estimate-num-keys", &estimate_keys); + db->GetIntProperty(cf_handle, rocksdb::DB::Properties::kEstimateNumKeys, &estimate_keys); string_stream << "estimate_keys[" << cf_handle->GetName() << "]:" << estimate_keys << "\r\n"; - db->GetIntProperty(cf_handle, "rocksdb.block-cache-pinned-usage", &block_cache_pinned_usage); - string_stream << "block_cache_pinned_usage[" << cf_handle->GetName() << "]:" << block_cache_pinned_usage << "\r\n"; - db->GetIntProperty(cf_handle, "rocksdb.estimate-table-readers-mem", &index_and_filter_cache_usage); + db->GetIntProperty(cf_handle, rocksdb::DB::Properties::kEstimateTableReadersMem, &index_and_filter_cache_usage); string_stream << "index_and_filter_cache_usage[" << cf_handle->GetName() << "]:" << index_and_filter_cache_usage << "\r\n"; db->GetMapProperty(cf_handle, rocksdb::DB::Properties::kCFStats, &cf_stats_map);