summaryrefslogtreecommitdiffstats
path: root/src/osd/PG.cc
diff options
context:
space:
mode:
authorSamuel Just <sjust@redhat.com>2015-03-18 20:11:07 +0100
committerSamuel Just <sjust@redhat.com>2015-03-19 16:41:40 +0100
commit0712d8d90b4eb455ae56cce5eafdce3e50de39e0 (patch)
tree35fed3e0f8b2452505f48ed1011c365d9668d0b0 /src/osd/PG.cc
parentdoc: add last_epoch_started.rst (diff)
downloadceph-0712d8d90b4eb455ae56cce5eafdce3e50de39e0.tar.xz
ceph-0712d8d90b4eb455ae56cce5eafdce3e50de39e0.zip
PG: ensure that info.last_epoch_started only increases
See doc/dev/osd_internals/last_epoch_started.rst Fixes: #11110 Signed-off-by: Samuel Just <sjust@redhat.com>
Diffstat (limited to '')
-rw-r--r--src/osd/PG.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/osd/PG.cc b/src/osd/PG.cc
index cf72a86c41c..e99fb790af8 100644
--- a/src/osd/PG.cc
+++ b/src/osd/PG.cc
@@ -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();