]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: post-clean pg_temp during priming if possible
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 24 Jul 2017 05:55:10 +0000 (13:55 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 25 Jul 2017 02:24:43 +0000 (10:24 +0800)
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>
src/mon/OSDMonitor.cc

index 82fd1cfae43821482eb561911a97642d61fe92fb..3315e366eec0e945fba8b3d0a4b6823c299f9018 100644 (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