]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PGLog: explicitly pass log_oid collection
authorSage Weil <sage@redhat.com>
Thu, 20 Nov 2014 22:02:32 +0000 (14:02 -0800)
committerSage Weil <sage@redhat.com>
Wed, 17 Dec 2014 01:07:57 +0000 (17:07 -0800)
Do not assume the log_oid is ine the 'meta' collection.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc
src/osd/PGLog.cc
src/osd/PGLog.h
src/tools/ceph_objectstore_tool.cc

index b3307b5ca533e7591c57fc6fc140b40032cb43a0..134efc71d3dfb190fc829b5c402b02b85490f07e 100644 (file)
@@ -2919,7 +2919,7 @@ void PG::read_state(ObjectStore *store, bufferlist &bl)
 
   ostringstream oss;
   if (pg_log.read_log(
-      store, coll, log_oid, info,
+      store, coll, META_COLL, log_oid, info,
       oss)) {
     /* We don't want to leave the old format around in case the next log
      * write happens to be an append_log()
index 45309ed2eb75ec3b13be924564af065c12236b90..6ea2d7d606a3e148454a8d9d88c1d0a8ea0af743 100644 (file)
@@ -805,7 +805,8 @@ void PGLog::_write_log(
   t.omap_setkeys(META_COLL, log_oid, keys);
 }
 
-bool PGLog::read_log(ObjectStore *store, coll_t coll, ghobject_t log_oid,
+bool PGLog::read_log(ObjectStore *store, coll_t pg_coll,
+  coll_t log_coll, ghobject_t log_oid,
   const pg_info_t &info, map<eversion_t, hobject_t> &divergent_priors,
   IndexedLog &log,
   pg_missing_t &missing,
@@ -817,10 +818,10 @@ bool PGLog::read_log(ObjectStore *store, coll_t coll, ghobject_t log_oid,
 
   // legacy?
   struct stat st;
-  int r = store->stat(META_COLL, log_oid, &st);
+  int r = store->stat(log_coll, log_oid, &st);
   assert(r == 0);
   if (st.st_size > 0) {
-    read_log_old(store, coll, log_oid, info, divergent_priors, log, missing, oss, log_keys_debug);
+    read_log_old(store, pg_coll, log_oid, info, divergent_priors, log, missing, oss, log_keys_debug);
     rewrite_log = true;
   } else {
     log.tail = info.log_tail;
@@ -829,7 +830,7 @@ bool PGLog::read_log(ObjectStore *store, coll_t coll, ghobject_t log_oid,
     log.can_rollback_to = info.last_update;
     log.rollback_info_trimmed_to = eversion_t();
 
-    ObjectMap::ObjectMapIterator p = store->get_omap_iterator(META_COLL, log_oid);
+    ObjectMap::ObjectMapIterator p = store->get_omap_iterator(log_coll, log_oid);
     if (p) for (p->seek_to_first(); p->valid() ; p->next()) {
       bufferlist bl = p->value();//Copy bufferlist before creating iterator
       bufferlist::iterator bp = bl.begin();
@@ -881,7 +882,7 @@ bool PGLog::read_log(ObjectStore *store, coll_t coll, ghobject_t log_oid,
       
       bufferlist bv;
       int r = store->getattr(
-       coll,
+       pg_coll,
        ghobject_t(i->soid, ghobject_t::NO_GEN, info.pgid.shard),
        OI_ATTR,
        bv);
@@ -906,7 +907,7 @@ bool PGLog::read_log(ObjectStore *store, coll_t coll, ghobject_t log_oid,
       did.insert(i->second);
       bufferlist bv;
       int r = store->getattr(
-       coll, 
+       pg_coll,
        ghobject_t(i->second, ghobject_t::NO_GEN, info.pgid.shard),
        OI_ATTR,
        bv);
index 715be64ec42386c97f2d83f5c026be1316f3eafd..407abbc31557ec44abe2abd5b08b765a2edee3ea 100644 (file)
@@ -560,16 +560,18 @@ public:
     set<string> *log_keys_debug
     );
 
-  bool read_log(ObjectStore *store, coll_t coll, ghobject_t log_oid,
+  bool read_log(ObjectStore *store, coll_t pg_coll,
+               coll_t log_coll, ghobject_t log_oid,
                const pg_info_t &info, ostringstream &oss) {
     return read_log(
-      store, coll, log_oid, info, divergent_priors,
+      store, pg_coll, log_coll, log_oid, info, divergent_priors,
       log, missing, oss,
       (pg_log_debug ? &log_keys_debug : 0));
   }
 
   /// return true if the log should be rewritten
-  static bool read_log(ObjectStore *store, coll_t coll, ghobject_t log_oid,
+  static bool read_log(ObjectStore *store, coll_t pg_coll,
+    coll_t log_coll, ghobject_t log_oid,
     const pg_info_t &info, map<eversion_t, hobject_t> &divergent_priors,
     IndexedLog &log,
     pg_missing_t &missing, ostringstream &oss,
index 5f3f274a77e86afc7c36258b6ff80b746f8def24..fb3bb45bbcbd79a47756adaf720b03179638f804 100644 (file)
@@ -603,7 +603,7 @@ int get_log(ObjectStore *fs, coll_t coll, spg_t pgid, const pg_info_t &info,
   map<eversion_t, hobject_t> divergent_priors;
   try {
     ostringstream oss;
-    PGLog::read_log(fs, coll, log_oid, info, divergent_priors, log, missing, oss);
+    PGLog::read_log(fs, coll, META_COLL, log_oid, info, divergent_priors, log, missing, oss);
     if (debug && oss.str().size())
       cerr << oss.str() << std::endl;
   }