]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: caluculate acting by comparing with oldest log entry of auth
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 19 Oct 2017 08:25:01 +0000 (16:25 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 21 Oct 2017 06:20:52 +0000 (14:20 +0800)
In GetLog, we will request logs back to the min last_update over our
acting_backfill set, which will result in our log being extended
as far backwards as necessary to pick up any peers which can
be log recovered by auth_log_shard's log.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/PG.cc

index f5f0187b95f6c80a37e233ca2f435ad85eb07440..2d04f760d521db233547b67be0ecd9c0e085e7bc 100644 (file)
@@ -1236,7 +1236,9 @@ void PG::calc_replicated_acting(
   unsigned usable = 1;
 
   // select replicas that have log contiguity with primary.
-  // prefer up, then acting, then any peer_info osds 
+  // prefer up, then acting, then any peer_info osds
+  eversion_t oldest_auth_log_entry =
+    std::min(primary->second.log_tail, auth_log_shard->second.log_tail);
   for (vector<int>::const_iterator i = up.begin();
        i != up.end();
        ++i) {
@@ -1245,9 +1247,7 @@ void PG::calc_replicated_acting(
       continue;
     const pg_info_t &cur_info = all_info.find(up_cand)->second;
     if (cur_info.is_incomplete() ||
-      cur_info.last_update < MIN(
-       primary->second.log_tail,
-       auth_log_shard->second.log_tail)) {
+        cur_info.last_update < oldest_auth_log_entry) {
       /* We include auth_log_shard->second.log_tail because in GetLog,
        * we will request logs back to the min last_update over our
        * acting_backfill set, which will result in our log being extended
@@ -1275,13 +1275,13 @@ void PG::calc_replicated_acting(
     // skip up osds we already considered above
     if (acting_cand == primary->first)
       continue;
-    vector<int>::const_iterator up_it = find(up.begin(), up.end(), acting_cand.osd);
+    vector<int>::const_iterator up_it = find(up.begin(), up.end(), *i);
     if (up_it != up.end())
       continue;
 
     const pg_info_t &cur_info = all_info.find(acting_cand)->second;
     if (cur_info.is_incomplete() ||
-       cur_info.last_update < primary->second.log_tail) {
+       cur_info.last_update < oldest_auth_log_entry) {
       ss << " shard " << acting_cand << " (acting) REJECTED "
               << cur_info << std::endl;
     } else {
@@ -1314,7 +1314,7 @@ void PG::calc_replicated_acting(
       continue;
 
     if (i->second.is_incomplete() ||
-       i->second.last_update < primary->second.log_tail) {
+       i->second.last_update < oldest_auth_log_entry) {
       ss << " shard " << i->first << " (stray) REJECTED "
         << i->second << std::endl;
     } else {