]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/ceph-objectstore-tool: always set first_committed 13999/head
authorKefu Chai <kchai@redhat.com>
Wed, 29 Mar 2017 08:34:26 +0000 (16:34 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 30 Mar 2017 12:21:18 +0000 (20:21 +0800)
otherwise the workaround of 7fb3804fb is triggered. we need to remove
that workaround later on.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/tools/rebuild_mondb.cc

index 3e7b7a8c5adab0ab90f71b6d6cc69e91b8af7d84..a53af400f4760faf3defbf3c5d3d6f66477e72f4 100644 (file)
@@ -223,8 +223,17 @@ int update_osdmap(ObjectStore& fs, OSDSuperblock& sb, MonitorDBStore& ms)
     t->erase(prefix, ms.combine_strings("full", e));
     ntrimmed++;
   }
-  if (!t->empty()) {
-    t->put(prefix, first_committed_name, sb.oldest_map);
+  // make sure we have a non-zero first_committed. OSDMonitor relies on this.
+  // because PaxosService::put_last_committed() set it to last_committed, if it
+  // is zero. which breaks OSDMonitor::update_from_paxos(), in which we believe
+  // that latest_full should always be greater than last_committed.
+  if (first_committed == 0 && sb.oldest_map < sb.newest_map) {
+    first_committed = 1;
+  } else if (ntrimmed) {
+    first_committed += ntrimmed;
+  }
+  if (first_committed) {
+    t->put(prefix, first_committed_name, first_committed);
     ms.apply_transaction(t);
     t = make_shared<MonitorDBStore::Transaction>();
   }