]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: ensure that info.last_epoch_started only increases 4105/head
authorSamuel Just <sjust@redhat.com>
Wed, 18 Mar 2015 19:11:07 +0000 (12:11 -0700)
committerSamuel Just <sjust@redhat.com>
Thu, 19 Mar 2015 15:41:40 +0000 (08:41 -0700)
See doc/dev/osd_internals/last_epoch_started.rst

Fixes: #11110
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PG.cc

index cf72a86c41ce4b6e1f74b743b243454c19310ba7..e99fb790af8240d5447339e4f4f6bfb9557599a1 100644 (file)
@@ -280,8 +280,12 @@ void PG::proc_master_log(
   peer_info[from] = oinfo;
   dout(10) << " peer osd." << from << " now " << oinfo << " " << omissing << dendl;
   might_have_unfound.insert(from);
-  info.last_epoch_started = oinfo.last_epoch_started;
+
+  // See doc/dev/osd_internals/last_epoch_started
+  if (oinfo.last_epoch_started > info.last_epoch_started)
+    info.last_epoch_started = oinfo.last_epoch_started;
   info.history.merge(oinfo.history);
+  assert(info.last_epoch_started >= info.history.last_epoch_started);
 
   peer_missing[from].swap(omissing);
 }
@@ -1480,11 +1484,17 @@ void PG::activate(ObjectStore::Transaction& t,
 
   if (is_primary()) {
     // only update primary last_epoch_started if we will go active
-    if (acting.size() >= pool.info.min_size)
+    if (acting.size() >= pool.info.min_size) {
+      assert(cct->_conf->osd_find_best_info_ignore_history_les ||
+            info.last_epoch_started <= activation_epoch);
       info.last_epoch_started = activation_epoch;
+    }
   } else if (is_acting(pg_whoami)) {
-    // update last_epoch_started on acting replica to whatever the primary sent
-    info.last_epoch_started = activation_epoch;
+    /* update last_epoch_started on acting replica to whatever the primary sent
+     * unless it's smaller (could happen if we are going peered rather than
+     * active, see doc/dev/osd_internals/last_epoch_started.rst) */
+    if (info.last_epoch_started < activation_epoch)
+      info.last_epoch_started = activation_epoch;
   }
 
   const pg_missing_t &missing = pg_log.get_missing();