Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mds: drop client metrics during recovery #57084

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/mds/MDSRank.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,8 @@ void MDSRank::active_start()
{
dout(1) << "active_start" << dendl;

m_is_active = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where you are resetting it. I'd suggest that you put the code at the end of handle_mds_map:

    m_is_active = is_active();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resetting?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO no need to reset it.

@batrick BTW, why not just check the MDS' state from the mdsmap instead of adding a new m_is_active ? For lockless case ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need the mds_lock to look at the MDSMap. We don't want the metrics aggregator to be acquiring that lock generally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.


if (last_state == MDSMap::STATE_CREATING ||
last_state == MDSMap::STATE_STARTING) {
mdcache->open_root();
Expand Down
5 changes: 5 additions & 0 deletions src/mds/MDSRank.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#ifndef MDS_RANK_H_
#define MDS_RANK_H_

#include <atomic>
#include <string_view>

#include <boost/asio/io_context.hpp>
Expand Down Expand Up @@ -226,6 +227,8 @@ class MDSRank {
bool is_cluster_degraded() const { return cluster_degraded; }
bool allows_multimds_snaps() const { return mdsmap->allows_multimds_snaps(); }

bool is_active_lockless() const { return m_is_active.load(); }

bool is_cache_trimmable() const {
return is_standby_replay() || is_clientreplay() || is_active() || is_stopping();
}
Expand Down Expand Up @@ -672,6 +675,8 @@ class MDSRank {

mono_time starttime = mono_clock::zero();
boost::asio::io_context& ioc;

std::atomic_bool m_is_active = false; /* accessed outside mds_lock */
};

class C_MDS_RetryMessage : public MDSInternalContext {
Expand Down
5 changes: 5 additions & 0 deletions src/mds/MetricsHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ void MetricsHandler::handle_payload(Session *session, const UnknownPayload &payl
}

void MetricsHandler::handle_client_metrics(const cref_t<MClientMetrics> &m) {
if (!mds->is_active_lockless()) {
dout(20) << ": dropping metrics message during recovery" << dendl;
return;
}

std::scoped_lock locker(lock);

Session *session = mds->get_session(m);
Expand Down