]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG::recover_backfill: do not update last_backfill prematurely 1826/head
authorSamuel Just <sam.just@inktank.com>
Thu, 8 May 2014 20:25:32 +0000 (13:25 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 8 May 2014 20:35:24 +0000 (13:35 -0700)
Previously, we would update last_backfill on the backfill peer to

backfills_in_flight.empty() ? backfill_pos :
  backfills_in_flight.begin()->first

which is actually the next backfill to complete.  We want to update
last_backfill to the largest completed backfill instead.

We use the pending_backfill_updates mapping to identify the most
recently completed backfill.  Due to the previous patch, deletes
will also be included in that mapping.

Related sha1s from master:
4139e75d63b0503dbb7fea8036044eda5e8b7cf1
7a06a71e0f2023f66d003dfb0168f4fe51eaa058

We don't really want to backport those due to the changes in:
9ec35d5ccf6a86c380865c7fc96017a1f502560a

This patch does essentially the same thing, but using backfill_pos.

Fixse: #8162
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/ReplicatedPG.cc

index c1af03de4c8510cb86ac5dd42a2b3c5a6479b7ac..47b28a412a183aa2222be6a13505fd3b2df10eb1 100644 (file)
@@ -7474,18 +7474,23 @@ int ReplicatedPG::recover_backfill(
     dout(20) << *i << " is still in flight" << dendl;
   }
 
-  hobject_t bound = backfills_in_flight.size() ?
+  hobject_t next_to_complete = backfills_in_flight.size() ?
     *(backfills_in_flight.begin()) : backfill_pos;
-  if (bound > pinfo.last_backfill) {
-    pinfo.last_backfill = bound;
-    for (map<hobject_t, pg_stat_t>::iterator i = pending_backfill_updates.begin();
-        i != pending_backfill_updates.end() && i->first < bound;
-        pending_backfill_updates.erase(i++)) {
-      pinfo.stats.add(i->second);
-    }
+  hobject_t pending_last_backfill = pinfo.last_backfill;
+  for (map<hobject_t, pg_stat_t>::iterator i = pending_backfill_updates.begin();
+       i != pending_backfill_updates.end() && i->first < next_to_complete;
+       pending_backfill_updates.erase(i++)) {
+    pinfo.stats.add(i->second);
+    pending_last_backfill = i->first;
+  }
+  if (backfills_in_flight.empty() && backfill_pos.is_max())
+    pending_last_backfill = hobject_t::get_max();
+
+  if (pending_last_backfill > pinfo.last_backfill) {
+    pinfo.last_backfill = pending_last_backfill;
     epoch_t e = get_osdmap()->get_epoch();
     MOSDPGBackfill *m = NULL;
-    if (bound.is_max()) {
+    if (pinfo.last_backfill.is_max()) {
       m = new MOSDPGBackfill(MOSDPGBackfill::OP_BACKFILL_FINISH, e, e, info.pgid);
       // Use default priority here, must match sub_op priority
       /* pinfo.stats might be wrong if we did log-based recovery on the
@@ -7497,7 +7502,7 @@ int ReplicatedPG::recover_backfill(
       m = new MOSDPGBackfill(MOSDPGBackfill::OP_BACKFILL_PROGRESS, e, e, info.pgid);
       // Use default priority here, must match sub_op priority
     }
-    m->last_backfill = bound;
+    m->last_backfill = pinfo.last_backfill;
     m->stats = pinfo.stats;
     osd->send_message_osd_cluster(backfill_target, m, get_osdmap()->get_epoch());
   }