]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-objectstore-tool: update-mon-db: remove pgmap references
authorSage Weil <sage@redhat.com>
Wed, 10 Oct 2018 13:38:27 +0000 (08:38 -0500)
committerSage Weil <sage@redhat.com>
Wed, 10 Oct 2018 13:47:22 +0000 (08:47 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/tools/rebuild_mondb.cc

index 9d8cb4c5dd24f9dd38a10edd918e1948e6b693b9..7704bd2507b0391e8ae60a4f02d78a776dbc62d7 100644 (file)
@@ -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<coll_t> 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<MonitorDBStore::Transaction>();
-  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;
-}