Skip to content

Commit

Permalink
mds: consider max age of dispatch queue when finding stale client
Browse files Browse the repository at this point in the history
session renew messages from clients can be in the dispatch queue,
waiting for getting dispatched.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 2ca5708)

 Conflicts:
	src/mds/Server.cc
  • Loading branch information
ukernel committed Aug 9, 2018
1 parent 98cce9d commit 5bf6312
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/mds/MDSRank.cc
Expand Up @@ -1020,6 +1020,11 @@ utime_t MDSRank::get_laggy_until() const
return beacon.get_laggy_until();
}

double MDSRank::get_dispatch_queue_max_age(utime_t now) const
{
return messenger->get_dispatch_queue_max_age(now);
}

bool MDSRank::is_daemon_stopping() const
{
return stopping;
Expand Down
1 change: 1 addition & 0 deletions src/mds/MDSRank.h
Expand Up @@ -359,6 +359,7 @@ class MDSRank {
void damaged_unlocked();

utime_t get_laggy_until() const;
double get_dispatch_queue_max_age(utime_t now) const;

void send_message_mds(Message *m, mds_rank_t mds);
void forward_message_mds(Message *req, mds_rank_t mds);
Expand Down
4 changes: 4 additions & 0 deletions src/mds/Server.cc
Expand Up @@ -707,7 +707,10 @@ void Server::find_idle_sessions()
// timeout/stale
// (caps go stale, lease die)
utime_t now = ceph_clock_now();
double queue_max_age = mds->get_dispatch_queue_max_age(now);

utime_t cutoff = now;
cutoff -= queue_max_age;
cutoff -= g_conf->mds_session_timeout;
while (1) {
Session *session = mds->sessionmap.get_oldest_session(Session::STATE_OPEN);
Expand All @@ -729,6 +732,7 @@ void Server::find_idle_sessions()

// autoclose
cutoff = now;
cutoff -= queue_max_age;
cutoff -= g_conf->mds_session_autoclose;

// don't kick clients if we've been laggy
Expand Down

0 comments on commit 5bf6312

Please sign in to comment.