From: xie xingguo Date: Mon, 24 Jul 2017 05:55:10 +0000 (+0800) Subject: mon/OSDMonitor: post-clean pg_temp during priming if possible X-Git-Tag: v12.1.2~86^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ea723fbb88c69bd00fefd32a3ee94bf5ce53569c;p=ceph.git mon/OSDMonitor: post-clean pg_temp during priming if possible By vstarting a 3-osds cluster and 'ceph osd purge osd.0', then 'ceph -s': services: mon: 3 daemons, quorum a,b,c mgr: x(active) mds: 1/1/1 up {0=a=up:active}, 2 up:standby osd: 2 osds: 2 up, 2 in; 14 remapped pgs And "ceph osd dump": max_osd 3 osd.1 up in weight 1 up_from 9 up_thru 17 down_at 0 last_clean_interval [0,0) 127.0.0.1:6804/269058 127.0.0.1:6805/269058 127.0.0.1:6806/269058 127.0.0.1:6807/269058 exists,up 04336407-097f-4d72-89db-15b6e317370c osd.2 up in weight 1 up_from 12 up_thru 18 down_at 0 last_clean_interval [0,0) 127.0.0.1:6808/269590 127.0.0.1:6809/269590 127.0.0.1:6810/269590 127.0.0.1:6811/269590 exists,up c8d334e4-aa40-4032-84e6-297d9f7a6fdb pg_temp 1.0 [1,0,2] pg_temp 1.1 [2,0,1] pg_temp 1.3 [1,2,0] pg_temp 1.4 [1,0,2] pg_temp 1.5 [2,0,1] pg_temp 1.6 [1,0,2] pg_temp 1.7 [1,2,0] pg_temp 2.0 [2,1,0] pg_temp 2.1 [2,1,0] pg_temp 2.3 [1,2,0] pg_temp 2.4 [1,0,2] pg_temp 2.5 [1,0,2] pg_temp 2.6 [1,0,2] pg_temp 2.7 [1,0,2] Signed-off-by: xie xingguo --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 82fd1cfae438..3315e366eec0 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -884,7 +884,7 @@ void OSDMonitor::prime_pg_temp( int next_up_primary, next_acting_primary; next.pg_to_up_acting_osds(pgid, &next_up, &next_up_primary, &next_acting, &next_acting_primary); - if (acting == next_acting) + if (acting == next_acting && next_up != next_acting) return; // no change since last epoch if (acting.empty()) @@ -893,6 +893,12 @@ void OSDMonitor::prime_pg_temp( if (pool && acting.size() < pool->min_size) return; // can be no worse off than before + if (next_up == next_acting) { + acting.clear(); + dout(20) << __func__ << "next_up === next_acting now, clear pg_temp" + << dendl; + } + dout(20) << __func__ << " " << pgid << " " << up << "/" << acting << " -> " << next_up << "/" << next_acting << ", priming " << acting