1
0
mirror of https://github.com/ceph/ceph synced 2025-03-25 11:48:05 +00:00

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 <xie.xingguo@zte.com.cn>
This commit is contained in:
xie xingguo 2017-07-24 13:55:10 +08:00
parent 27c1d62ae9
commit ea723fbb88

View File

@ -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