]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-objectstore-tool: drop pre-snapset support for setting up snapmapper
authorSage Weil <sage@redhat.com>
Thu, 7 Sep 2017 19:11:21 +0000 (15:11 -0400)
committerSage Weil <sage@redhat.com>
Thu, 21 Sep 2017 18:29:35 +0000 (14:29 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/tools/ceph_objectstore_tool.cc

index df01a592fce66b368bad63fee7a6448a65be8c96..b39b3257084de775df8bc7e7dd31b466796ac6f0 100644 (file)
@@ -835,60 +835,38 @@ int get_attrs(
 
   // This could have been handled in the caller if we didn't need to
   // support exports that didn't include object_info_t in object_begin.
-  if (hoid.generation == ghobject_t::NO_GEN) {
-    if (hoid.hobj.snap < CEPH_MAXSNAP) {
-      map<string,bufferlist>::iterator mi = as.data.find(OI_ATTR);
-      if (mi != as.data.end()) {
-       object_info_t oi(mi->second);
-
-       if (debug)
-         cerr << "object_info " << oi << std::endl;
-
-       OSDriver::OSTransaction _t(driver.get_transaction(t));
-       set<snapid_t> oi_snaps(oi.legacy_snaps.begin(), oi.legacy_snaps.end());
-       if (!oi_snaps.empty()) {
+  if (hoid.generation == ghobject_t::NO_GEN &&
+      hoid.hobj.is_head()) {
+    map<string,bufferlist>::iterator mi = as.data.find(SS_ATTR);
+    if (mi != as.data.end()) {
+      SnapSet snapset;
+      auto p = mi->second.begin();
+      snapset.decode(p);
+      cout << "snapset " << snapset << std::endl;
+      for (auto& p : snapset.clone_snaps) {
+       ghobject_t clone = hoid;
+       clone.hobj.snap = p.first;
+       set<snapid_t> snaps(p.second.begin(), p.second.end());
+       if (!store->exists(coll, clone)) {
+         // no clone, skip.  this is probably a cache pool.  this works
+         // because we use a separate transaction per object and clones
+         // come before head in the archive.
          if (debug)
-           cerr << "\tsetting legacy snaps " << oi_snaps << std::endl;
-         snap_mapper.add_oid(hoid.hobj, oi_snaps, &_t);
+           cerr << "\tskipping missing " << clone << " (snaps "
+                << snaps << ")" << std::endl;
+         continue;
        }
+       if (debug)
+         cerr << "\tsetting " << clone.hobj << " snaps " << snaps
+              << std::endl;
+       OSDriver::OSTransaction _t(driver.get_transaction(t));
+       assert(!snaps.empty());
+       snap_mapper.add_oid(clone.hobj, snaps, &_t);
       }
     } else {
-      if (hoid.hobj.is_head()) {
-       map<string,bufferlist>::iterator mi = as.data.find(SS_ATTR);
-       if (mi != as.data.end()) {
-         SnapSet snapset;
-         auto p = mi->second.begin();
-         snapset.decode(p);
-         cout << "snapset " << snapset << std::endl;
-         if (!snapset.is_legacy()) {
-           for (auto& p : snapset.clone_snaps) {
-             ghobject_t clone = hoid;
-             clone.hobj.snap = p.first;
-             set<snapid_t> snaps(p.second.begin(), p.second.end());
-             if (!store->exists(coll, clone)) {
-               // no clone, skip.  this is probably a cache pool.  this works
-               // because we use a separate transaction per object and clones
-               // come before head in the archive.
-               if (debug)
-                 cerr << "\tskipping missing " << clone << " (snaps "
-                      << snaps << ")" << std::endl;
-               continue;
-             }
-             if (debug)
-               cerr << "\tsetting " << clone.hobj << " snaps " << snaps
-                    << std::endl;
-             OSDriver::OSTransaction _t(driver.get_transaction(t));
-             assert(!snaps.empty());
-             snap_mapper.add_oid(clone.hobj, snaps, &_t);
-           }
-         }
-       } else {
-         cerr << "missing SS_ATTR on " << hoid << std::endl;
-       }
-      }
+      cerr << "missing SS_ATTR on " << hoid << std::endl;
     }
   }
-
   return 0;
 }