From a9369750d704b2cc7a64330c68b6f0902966b5ea Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 10 Oct 2018 08:38:27 -0500 Subject: [PATCH] ceph-objectstore-tool: update-mon-db: remove pgmap references Signed-off-by: Sage Weil --- src/tools/rebuild_mondb.cc | 59 -------------------------------------- 1 file changed, 59 deletions(-) diff --git a/src/tools/rebuild_mondb.cc b/src/tools/rebuild_mondb.cc index 9d8cb4c5dd2..7704bd2507b 100644 --- a/src/tools/rebuild_mondb.cc +++ b/src/tools/rebuild_mondb.cc @@ -12,7 +12,6 @@ static int update_monitor(const OSDSuperblock& sb, MonitorDBStore& ms); static int update_osdmap(ObjectStore& fs, OSDSuperblock& sb, MonitorDBStore& ms); -static int update_pgmap_pg(ObjectStore& fs, MonitorDBStore& ms); int update_mon_db(ObjectStore& fs, OSDSuperblock& sb, const string& keyring, @@ -30,9 +29,6 @@ int update_mon_db(ObjectStore& fs, OSDSuperblock& sb, if ((r = update_osdmap(fs, sb, ms)) < 0) { goto out; } - if ((r = update_pgmap_pg(fs, ms)) < 0) { - goto out; - } if ((r = update_monitor(sb, ms)) < 0) { goto out; } @@ -341,58 +337,3 @@ int update_osdmap(ObjectStore& fs, OSDSuperblock& sb, MonitorDBStore& ms) return 0; } -// rebuild -// - pgmap_pg/${pgid} -int update_pgmap_pg(ObjectStore& fs, MonitorDBStore& ms) -{ - // pgmap/${epoch} is the incremental of: stamp, pgmap_pg, pgmap_osd - // if PGMonitor fails to read it, it will fall back to the pgmap_pg, i.e. - // the fullmap. - vector collections; - int r = fs.list_collections(collections); - if (r < 0) { - cerr << "failed to list pgs: " << cpp_strerror(r) << std::endl; - return r; - } - const string prefix("pgmap_pg"); - // in general, there are less than 100 PGs per OSD, so no need to apply - // transaction in batch. - auto t = make_shared(); - unsigned npg = 0; - for (const auto& coll : collections) { - spg_t pgid; - if (!coll.is_pg(&pgid)) - continue; - pg_info_t info(pgid); - PastIntervals past_intervals; - __u8 struct_v; - r = PG::read_info(&fs, pgid, coll, info, past_intervals, struct_v); - if (r < 0) { - cerr << "failed to read_info: " << cpp_strerror(r) << std::endl; - return r; - } - if (struct_v < PG::get_latest_struct_v()) { - cerr << "incompatible pg_info: v" << struct_v << std::endl; - return -EINVAL; - } - version_t latest_epoch = 0; - bufferlist bl; - r = ms.get(prefix, stringify(pgid.pgid), bl); - if (r >= 0) { - pg_stat_t pg_stat; - auto bp = bl.cbegin(); - decode(pg_stat, bp); - latest_epoch = pg_stat.reported_epoch; - } - if (info.stats.reported_epoch > latest_epoch) { - bufferlist bl; - encode(info.stats, bl); - t->put(prefix, stringify(pgid.pgid), bl); - npg++; - } - } - ms.apply_transaction(t); - cout << std::left << setw(10) - << " " << npg << " pgs added." << std::endl; - return 0; -} -- 2.39.5