From 17d6a993fc17d533460c5f40f3908c708e057c18 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 23 May 2024 18:45:17 +0200 Subject: Merging upstream version 18.2.3. Signed-off-by: Daniel Baumann --- src/mds/MDSRank.cc | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) (limited to 'src/mds/MDSRank.cc') diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 9a80534a4..aa6a8c162 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -551,6 +551,8 @@ MDSRank::MDSRank( cct->_conf->mds_op_log_threshold); op_tracker.set_history_size_and_duration(cct->_conf->mds_op_history_size, cct->_conf->mds_op_history_duration); + op_tracker.set_history_slow_op_size_and_threshold(cct->_conf->mds_op_history_slow_op_size, + cct->_conf->mds_op_history_slow_op_threshold); schedule_update_timer_task(); } @@ -744,6 +746,7 @@ void MDSRankDispatcher::tick() // ... if (is_clientreplay() || is_active() || is_stopping()) { + server->clear_laggy_clients(); server->find_idle_sessions(); server->evict_cap_revoke_non_responders(); locker->tick(); @@ -1185,6 +1188,7 @@ bool MDSRank::is_valid_message(const cref_t &m) { type == CEPH_MSG_CLIENT_RECONNECT || type == CEPH_MSG_CLIENT_RECLAIM || type == CEPH_MSG_CLIENT_REQUEST || + type == CEPH_MSG_CLIENT_REPLY || type == MSG_MDS_PEER_REQUEST || type == MSG_MDS_HEARTBEAT || type == MSG_MDS_TABLE_REQUEST || @@ -1238,6 +1242,7 @@ void MDSRank::handle_message(const cref_t &m) ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_CLIENT); // fall-thru case CEPH_MSG_CLIENT_REQUEST: + case CEPH_MSG_CLIENT_REPLY: server->dispatch(m); break; case MSG_MDS_PEER_REQUEST: @@ -2060,6 +2065,7 @@ bool MDSRank::queue_one_replay() if (!replay_queue.empty()) { queue_waiter(replay_queue.front()); replay_queue.pop_front(); + dout(10) << " queued next replay op" << dendl; return true; } if (!replaying_requests_done) { @@ -2067,6 +2073,7 @@ bool MDSRank::queue_one_replay() mdlog->flush(); } maybe_clientreplay_done(); + dout(10) << " journaled last replay op" << dendl; return false; } @@ -2909,6 +2916,8 @@ void MDSRankDispatcher::handle_asok_command( command_openfiles_ls(f); } else if (command == "dump inode") { command_dump_inode(f, cmdmap, *css); + } else if (command == "dump dir") { + command_dump_dir(f, cmdmap, *css); } else if (command == "damage ls") { std::lock_guard l(mds_lock); damage_table.dump(f); @@ -3349,6 +3358,42 @@ void MDSRank::command_dump_inode(Formatter *f, const cmdmap_t &cmdmap, std::ostr } } +void MDSRank::command_dump_dir(Formatter *f, const cmdmap_t &cmdmap, std::ostream &ss) +{ + std::lock_guard l(mds_lock); + std::string path; + bool got = cmd_getval(cmdmap, "path", path); + if (!got) { + ss << "missing path argument"; + return; + } + + bool dentry_dump = false; + cmd_getval(cmdmap, "dentry_dump", dentry_dump); + + CInode *in = mdcache->cache_traverse(filepath(path.c_str())); + if (!in) { + ss << "directory inode not in cache"; + return; + } + + f->open_array_section("dirs"); + frag_vec_t leaves; + in->dirfragtree.get_leaves_under(frag_t(), leaves); + for (const auto& leaf : leaves) { + CDir *dir = in->get_dirfrag(leaf); + if (dir) { + mdcache->dump_dir(f, dir, dentry_dump); + } else { + f->open_object_section("frag"); + f->dump_stream("frag") << leaf; + f->dump_string("status", "dirfrag not in cache"); + f->close_section(); + } + } + f->close_section(); +} + void MDSRank::dump_status(Formatter *f) const { f->dump_string("fs_name", std::string(mdsmap->get_fs_name())); @@ -3503,6 +3548,9 @@ void MDSRank::create_logger() PerfCountersBuilder::PRIO_INTERESTING); mdm_plb.add_u64(l_mdm_dn, "dn", "Dentries", "dn", PerfCountersBuilder::PRIO_INTERESTING); + // mds rss metric is set to PRIO_USEFUL as it can be useful to detect mds cache oversizing + mdm_plb.add_u64(l_mdm_rss, "rss", "RSS", "rss", + PerfCountersBuilder::PRIO_USEFUL); mdm_plb.set_prio_default(PerfCountersBuilder::PRIO_USEFUL); mdm_plb.add_u64_counter(l_mdm_inoa, "ino+", "Inodes opened"); @@ -3517,9 +3565,6 @@ void MDSRank::create_logger() mdm_plb.add_u64_counter(l_mdm_caps, "cap-", "Capabilities removed"); mdm_plb.add_u64(l_mdm_heap, "heap", "Heap size"); - mdm_plb.set_prio_default(PerfCountersBuilder::PRIO_DEBUGONLY); - mdm_plb.add_u64(l_mdm_rss, "rss", "RSS"); - mlogger = mdm_plb.create_perf_counters(); g_ceph_context->get_perfcounters_collection()->add(mlogger); } @@ -3842,6 +3887,9 @@ void MDSRankDispatcher::handle_conf_change(const ConfigProxy& conf, const std::s if (changed.count("mds_op_history_size") || changed.count("mds_op_history_duration")) { op_tracker.set_history_size_and_duration(conf->mds_op_history_size, conf->mds_op_history_duration); } + if (changed.count("mds_op_history_slow_op_size") || changed.count("mds_op_history_slow_op_threshold")) { + op_tracker.set_history_slow_op_size_and_threshold(conf->mds_op_history_slow_op_size, conf->mds_op_history_slow_op_threshold); + } if (changed.count("mds_enable_op_tracker")) { op_tracker.set_tracking(conf->mds_enable_op_tracker); } -- cgit v1.2.3