From d3e6a2869b4ded8d3f8ac61d0f7b675973708946 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 29 Mar 2017 16:34:26 +0800 Subject: [PATCH] tools/ceph-objectstore-tool: always set first_committed otherwise the workaround of 7fb3804fb is triggered. we need to remove that workaround later on. Signed-off-by: Kefu Chai --- src/tools/rebuild_mondb.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/tools/rebuild_mondb.cc b/src/tools/rebuild_mondb.cc index 3e7b7a8c5adab..a53af400f4760 100644 --- a/src/tools/rebuild_mondb.cc +++ b/src/tools/rebuild_mondb.cc @@ -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(); } -- 2.39.5