From: Xiaoxi Chen Date: Wed, 26 Apr 2017 08:12:04 +0000 (-0700) Subject: osd/PG.cc: Optimistic estimation on PG.last_active X-Git-Tag: v12.0.3~141^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a58b7b697f32b6da3d9414617a34bd9db349b24b;p=ceph.git osd/PG.cc: Optimistic estimation on PG.last_active PG may go through inactive state(such like peering) shortly during state transition, user usually want to only get alter just when PG is stucking in inactive for long enough time. Such monitoring depends on PG.last_active > cutoff, but we will not update PG.last_active if there is neither state change nor IO happened on this PG. As a result, PG.last_active may lag behind a long time, in idle cluster/pool. This patch update the last_active filed to now(), when we first find it as inactiv, as kind of optimistic estimation to solve the problem. Signed-off-by: Xiaoxi Chen --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index f8c14131f6d..607fcd7883b 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2701,6 +2701,12 @@ void PG::publish_stats_to_osd() utime_t now = ceph_clock_now(); if (info.stats.state != state) { info.stats.last_change = now; + // Optimistic estimation, if we just find out an inactive PG, + // assumt it is active till now. + if (!(state & PG_STATE_ACTIVE) && + (info.stats.state & PG_STATE_ACTIVE)) + info.stats.last_active = now; + if ((state & PG_STATE_ACTIVE) && !(info.stats.state & PG_STATE_ACTIVE)) info.stats.last_became_active = now;