]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: place biginfo on the infos object next to the info and epoch keys
authorSamuel Just <sam.just@inktank.com>
Wed, 13 Feb 2013 21:00:12 +0000 (13:00 -0800)
committerSamuel Just <sam.just@inktank.com>
Wed, 13 Feb 2013 21:32:32 +0000 (13:32 -0800)
This is simpler and possibly more efficient.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/OSD.cc
src/osd/OSD.h
src/osd/PG.cc
src/osd/PG.h
src/tools/ceph-filestore-dump.cc

index 6be6dfc1f24cfdb8c5f6002982cf93736d2ea713..d52fdfac354fa51a78d9df3650f59a8515a48f60 100644 (file)
@@ -149,7 +149,6 @@ OSDService::OSDService(OSD *osd) :
   whoami(osd->whoami), store(osd->store), clog(osd->clog),
   pg_recovery_stats(osd->pg_recovery_stats),
   infos_oid(sobject_t("infos", CEPH_NOSNAP)),
-  biginfos_oid(sobject_t("biginfos", CEPH_NOSNAP)),
   cluster_messenger(osd->cluster_messenger),
   client_messenger(osd->client_messenger),
   logger(osd->logger),
@@ -1623,12 +1622,10 @@ void OSD::load_pgs()
   dout(10) << "load_pgs done" << dendl;
 
   // make sure info objects exist
-  if (!store->exists(coll_t::META_COLL, service.infos_oid) ||
-      !store->exists(coll_t::META_COLL, service.biginfos_oid)) {
-    dout(10) << "load_pgs creating/touching infos, biginfos objects" << dendl;
+  if (!store->exists(coll_t::META_COLL, service.infos_oid)) {
+    dout(10) << "load_pgs creating/touching infos object" << dendl;
     ObjectStore::Transaction t;
     t.touch(coll_t::META_COLL, service.infos_oid);
-    t.touch(coll_t::META_COLL, service.biginfos_oid);
     store->apply_transaction(t);
   }
   
index c116d4b912a741f6053b63ba901d05f2014b2a47..5680acca178731c5c960db14b2690a16ae2f1263 100644 (file)
@@ -169,7 +169,7 @@ public:
   ObjectStore *&store;
   LogClient &clog;
   PGRecoveryStats &pg_recovery_stats;
-  hobject_t infos_oid, biginfos_oid;
+  hobject_t infos_oid;
 private:
   Messenger *&cluster_messenger;
   Messenger *&client_messenger;
index 6bd803282b7080810b6749c3cbe181e0b4e7f0ca..8f2933d40d56a9f0fdf0ddb1e9e528fa39b6b6bd 100644 (file)
@@ -2345,19 +2345,17 @@ void PG::write_info(ObjectStore::Transaction& t)
   ::encode(info, v[get_info_key(info.pgid)]);
   purged_snaps.swap(info.purged_snaps);
 
-  t.omap_setkeys(coll_t::META_COLL, osd->infos_oid, v);
   if (dirty_big_info) {
     // potentially big stuff
-    v.clear();
-    bufferlist& bigbl = v[get_info_key(info.pgid)];
+    bufferlist& bigbl = v[get_biginfo_key(info.pgid)];
     ::encode(past_intervals, bigbl);
     ::encode(snap_collections, bigbl);
     ::encode(info.purged_snaps, bigbl);
     dout(20) << "write_info bigbl " << bigbl.length() << dendl;
-    t.omap_setkeys(coll_t::META_COLL, osd->biginfos_oid, v);
   }
 
+  t.omap_setkeys(coll_t::META_COLL, osd->infos_oid, v);
+
   dirty_info = false;
   dirty_big_info = false;
 }
@@ -2647,7 +2645,7 @@ std::string PG::get_corrupt_pg_log_name() const
 int PG::read_info(
   ObjectStore *store, const coll_t coll, bufferlist &bl,
   pg_info_t &info, map<epoch_t,pg_interval_t> &past_intervals,
-  hobject_t &biginfo_oid, hobject_t &infos_oid, hobject_t &biginfos_oid,
+  hobject_t &biginfo_oid, hobject_t &infos_oid,
   interval_set<snapid_t>  &snap_collections, __u8 &struct_v)
 {
   bufferlist::iterator p = bl.begin();
@@ -2674,20 +2672,18 @@ int PG::read_info(
     } else {
       // get info out of leveldb
       string k = get_info_key(info.pgid);
+      string bk = get_biginfo_key(info.pgid);
       set<string> keys;
       keys.insert(k);
+      keys.insert(bk);
       map<string,bufferlist> values;
       store->omap_get_values(coll_t::META_COLL, infos_oid, keys, &values);
-      assert(values.size() == 1);
+      assert(values.size() == 2);
       lbl = values[k];
       p = lbl.begin();
       ::decode(info, p);
 
-      // biginfo
-      values.clear();
-      store->omap_get_values(coll_t::META_COLL, biginfos_oid, keys, &values);
-      assert(values.size() == 1);
-      lbl = values[k];
+      lbl = values[bk];
       p = lbl.begin();
       ::decode(past_intervals, p);
     }
@@ -2715,7 +2711,7 @@ int PG::read_info(
 void PG::read_state(ObjectStore *store, bufferlist &bl)
 {
   int r = read_info(store, coll, bl, info, past_intervals, biginfo_oid,
-    osd->infos_oid, osd->biginfos_oid, snap_collections, info_struct_v);
+    osd->infos_oid, snap_collections, info_struct_v);
   assert(r >= 0);
 
   try {
index 28bcd282cdf4674b97dda39de7f927f7f87c6e72..379037181d7875036d41cf4bb2dbd791c3ddf786 100644 (file)
@@ -427,6 +427,9 @@ public:
   static string get_info_key(pg_t pgid) {
     return stringify(pgid) + "_info";
   }
+  static string get_biginfo_key(pg_t pgid) {
+    return stringify(pgid) + "_biginfo";
+  }
   static string get_epoch_key(pg_t pgid) {
     return stringify(pgid) + "_epoch";
   }
@@ -1795,7 +1798,7 @@ public:
   static int read_info(
     ObjectStore *store, const coll_t coll,
     bufferlist &bl, pg_info_t &info, map<epoch_t,pg_interval_t> &past_intervals,
-    hobject_t &biginfo_oid, hobject_t &infos_oid, hobject_t &biginfos_oid,
+    hobject_t &biginfo_oid, hobject_t &infos_oid,
     interval_set<snapid_t>  &snap_collections, __u8 &);
   void read_state(ObjectStore *store, bufferlist &bl);
   static epoch_t peek_map_epoch(ObjectStore *store, coll_t coll,
index 612ddee235e6039cb13ca1f2c3138ea23315d879..fbd227dc25fba80ea92996a0ec24f7cfb50118fb 100644 (file)
@@ -205,7 +205,6 @@ int main(int argc, char **argv)
     }
 
     //XXX: This needs OSD function to generate
-    hobject_t biginfos_oid(sobject_t("biginfos", CEPH_NOSNAP));
     hobject_t infos_oid(sobject_t("infos", CEPH_NOSNAP));
     bufferlist bl;
     epoch_t map_epoch = PG::peek_map_epoch(fs, coll, infos_oid, &bl);
@@ -220,7 +219,7 @@ int main(int argc, char **argv)
 
     __u8 struct_v;
     int r = PG::read_info(fs, coll, bl, info, past_intervals, biginfo_oid,
-      infos_oid, biginfos_oid, snap_collections, struct_v);
+      infos_oid, snap_collections, struct_v);
     if (r < 0) {
       cerr << "read_info error " << cpp_strerror(-r) << std::endl;
       ret = 1;