]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os: remove {get,set}_allow_sharded_objects from interface
authorSage Weil <sage@redhat.com>
Tue, 22 Dec 2015 22:13:15 +0000 (17:13 -0500)
committerSage Weil <sage@redhat.com>
Fri, 1 Jan 2016 18:07:27 +0000 (13:07 -0500)
We've already forced everyone to upgrade through hammer, so everyone
supports this.  Just unconditionally set the feature if it is not set
(for consistency's sake).

Signed-off-by: Sage Weil <sage@redhat.com>
12 files changed:
src/os/FileStore.cc
src/os/FileStore.h
src/os/KeyValueStore.h
src/os/MemStore.cc
src/os/MemStore.h
src/os/ObjectStore.h
src/os/bluestore/BlueStore.h
src/os/kstore/KStore.h
src/osd/OSD.cc
src/test/ceph_objectstore_tool.py
src/test/objectstore/store_test.cc
src/tools/ceph_objectstore_tool.cc

index 00b7d544e2b73a8e30afff707919db7ecc60f1ab..0eca9d90eac1339ff7b4b9d4114e6eae69a9ead8 100644 (file)
@@ -232,9 +232,6 @@ int FileStore::lfn_open(coll_t cid,
                        FDRef *outfd,
                         Index *index)
 {
-  assert(get_allow_sharded_objects() ||
-        ( oid.shard_id == shard_id_t::NO_SHARD &&
-          oid.generation == ghobject_t::NO_GEN ));
   assert(outfd);
   int r = 0;
   bool need_lock = true;
@@ -1169,22 +1166,6 @@ int FileStore::read_superblock()
   return 0;
 }
 
-void FileStore::set_allow_sharded_objects()
-{
-  if (!get_allow_sharded_objects()) {
-    superblock.compat_features.incompat.insert(CEPH_FS_FEATURE_INCOMPAT_SHARDS);
-    int ret = write_superblock();
-    assert(ret == 0);  //Should we return error and make caller handle it?
-  }
-  return;
-}
-
-bool FileStore::get_allow_sharded_objects()
-{
-  return g_conf->filestore_debug_disable_sharded_check ||
-    superblock.compat_features.incompat.contains(CEPH_FS_FEATURE_INCOMPAT_SHARDS);
-}
-
 int FileStore::update_version_stamp()
 {
   return write_version_stamp();
index be5e668b8ebf3be5e3f97c1d95d914ded119fcb8..ac7490b5ee4894ae3541a7b96b3e260772962301 100644 (file)
@@ -448,22 +448,6 @@ public:
   int update_version_stamp();
   int upgrade();
 
-  /**
-   * set_allow_sharded_objects()
-   *
-   * Before sharded ghobject_t can be specified this function must be called
-   *
-   * Once this function is called the FileStore is not mountable by prior releases
-   */
-  void set_allow_sharded_objects();
-
-  /**
-   * get_allow_sharded_objects()
-   *
-   * return value: true if set_allow_sharded_objects() called, otherwise false
-   */
-  bool get_allow_sharded_objects();
-
   bool can_sort_nibblewise() {
     return true;    // i support legacy sort order
   }
index 914ce1dff3e4cbc70bf19f3b79e57c8fba307c9d..28e086ae818d973913a9b56b74f551c67e105c01 100644 (file)
@@ -516,20 +516,6 @@ class KeyValueStore : public ObjectStore,
     return false;
   }
 
-  /**
-   ** set_allow_sharded_objects()
-   **
-   ** Before sharded ghobject_t can be specified this function must be called
-   **/
-  void set_allow_sharded_objects() {}
-
-  /**
-   ** get_allow_sharded_objects()
-   **
-   ** return value: true if set_allow_sharded_objects() called, otherwise false
-   **/
-  bool get_allow_sharded_objects() {return false;}
-
   void collect_metadata(map<string,string> *pm);
 
   int statfs(struct statfs *buf);
index fd791703997da399781cebdd1e4cead0766bdde5..509250f9ccc0581e143d6cbfbb0e07e2fb2b23e5 100644 (file)
@@ -83,14 +83,6 @@ int MemStore::_save()
   if (r < 0)
     return r;
 
-  if (sharded) {
-   string fn = path + "/sharded";
-    bufferlist bl;
-    int r = bl.write_file(fn.c_str());
-    if (r < 0)
-      return r;
-  }
-
   return 0;
 }
 
@@ -172,11 +164,6 @@ int MemStore::_load()
     used_bytes += c->used_bytes();
   }
 
-  fn = path + "/sharded";
-  struct stat st;
-  if (::stat(fn.c_str(), &st) == 0)
-    set_allow_sharded_objects();
-
   dump_all();
 
   return 0;  
index fc047c09ad9d6c310439646a180bc86ce8647078..b061c75f954885a159b6d6e8bd467dec8f3c4df6 100644 (file)
@@ -344,8 +344,7 @@ public:
       coll_lock("MemStore::coll_lock"),
       apply_lock("MemStore::apply_lock"),
       finisher(cct),
-      used_bytes(0),
-      sharded(false) {}
+      used_bytes(0) {}
   ~MemStore() { }
 
   bool test_mount_in_use() {
@@ -376,14 +375,6 @@ public:
     return false;
   }
 
-  bool sharded;
-  void set_allow_sharded_objects() {
-    sharded = true;
-  }
-  bool get_allow_sharded_objects() {
-    return sharded;
-  }
-
   int statfs(struct statfs *buf);
 
   bool exists(coll_t cid, const ghobject_t& oid);
index 8f2b749ae677a9e7fcbbfd0150c753d381101cc6..8af918de1bb9f788956ab157a6c30ced497c891a 100644 (file)
@@ -1825,8 +1825,6 @@ public:
   virtual bool needs_journal() = 0;  //< requires a journal
   virtual bool wants_journal() = 0;  //< prefers a journal
   virtual bool allows_journal() = 0; //< allows a journal
-  virtual void set_allow_sharded_objects() = 0;
-  virtual bool get_allow_sharded_objects() = 0;
 
   virtual bool can_sort_nibblewise() {
     return false;   // assume a backend cannot, unless it says otherwise
index b26959bf576955f6f08ca097cf37651fdeb5af51..e5c60afa74f39787f629f5a42f0ec5ee020daacb 100644 (file)
@@ -615,16 +615,7 @@ public:
     return 0;
   }
 
-private:
-  bool sharded;
 public:
-  void set_allow_sharded_objects() {
-    sharded = true;
-  }
-  bool get_allow_sharded_objects() {
-    return sharded;
-  }
-
   int statfs(struct statfs *buf);
 
   bool exists(coll_t cid, const ghobject_t& oid);
index 6d9bf609aea23baa77cb0c32467ab2d2bfa9f611..5be447331683f238ae7ec4800bc36c4cd8b39484 100644 (file)
@@ -387,16 +387,6 @@ public:
     return 0;
   }
 
-private:
-  bool sharded;
-public:
-  void set_allow_sharded_objects() {
-    sharded = true;
-  }
-  bool get_allow_sharded_objects() {
-    return sharded;
-  }
-
   int statfs(struct statfs *buf);
 
   bool exists(coll_t cid, const ghobject_t& oid);
index 8423df81a9a8719fca1e77a49adde97453815895..f5d4a3fcd500b5158e6407062d7a8b99815e21b0 100644 (file)
@@ -6714,14 +6714,13 @@ void OSD::check_osdmap_features(ObjectStore *fs)
     }
 
     if ((features & CEPH_FEATURE_OSD_ERASURE_CODES) &&
-       !fs->get_allow_sharded_objects()) {
+       !superblock.compat_features.incompat.contains(CEPH_OSD_FEATURE_INCOMPAT_SHARDS)) {
       dout(0) << __func__ << " enabling on-disk ERASURE CODES compat feature" << dendl;
       superblock.compat_features.incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_SHARDS);
       ObjectStore::Transaction *t = new ObjectStore::Transaction;
       write_superblock(*t);
       int err = store->queue_transaction_and_cleanup(service.meta_osr.get(), t);
       assert(err == 0);
-      fs->set_allow_sharded_objects();
     }
   }
 }
index 186b0b68f9c1d8a076e5a34af0ee170fee762b90..5547bd6d3a15f9427a02c6693d844895b2d75131 100755 (executable)
@@ -907,7 +907,7 @@ def main(argv):
 
     # Specify a bad --op command
     cmd = (CFSD_PREFIX + "--op oops").format(osd=ONEOSD)
-    ERRORS += test_failure(cmd, "Must provide --op (info, log, remove, export, import, list, fix-lost, list-pgs, rm-past-intervals, set-allow-sharded-objects, dump-journal, dump-super, meta-list, get-osdmap, set-osdmap, get-inc-osdmap, set-inc-osdmap, mark-complete)")
+    ERRORS += test_failure(cmd, "Must provide --op (info, log, remove, export, import, list, fix-lost, list-pgs, rm-past-intervals, dump-journal, dump-super, meta-list, get-osdmap, set-osdmap, get-inc-osdmap, set-inc-osdmap, mark-complete)")
 
     # Provide just the object param not a command
     cmd = (CFSD_PREFIX + "object").format(osd=ONEOSD)
index b67000e4f5508a7d636c71f20ac3f4628ce68932..0608978fb5124d8f1749c012f8a13d97c8777dd1 100644 (file)
@@ -3002,7 +3002,6 @@ TEST_P(StoreTest, MoveRename) {
 
 TEST_P(StoreTest, BigRGWObjectName) {
   ObjectStore::Sequencer osr("test");
-  store->set_allow_sharded_objects();
   coll_t cid(spg_t(pg_t(0,12),shard_id_t::NO_SHARD));
   ghobject_t oid(
     hobject_t(
index a7126c9bcf322f411ed0a8030589599057bf0dd9..4b81f2ad1c7a5f1e4b8a95938f9dad83e113b77f 100644 (file)
@@ -1268,14 +1268,6 @@ int ObjectStoreTool::do_import(ObjectStore *store, OSDSuperblock& sb,
 
     cerr << "Export has incompatible features set " << unsupported << std::endl;
 
-    // If shards setting the issue, then inform user what they can do about it.
-    if (unsupported.incompat.contains(CEPH_OSD_FEATURE_INCOMPAT_SHARDS)) {
-      cerr << std::endl;
-      cerr << "OSD requires sharding to be enabled" << std::endl;
-      cerr << std::endl;
-      cerr << "If you wish to import, first do 'ceph-objectstore-tool...--op set-allow-sharded-objects'" << std::endl;
-      return -EINVAL;
-    }
     // Let them import if they specify the --force option
     if (!force)
         return 11;  // Positive return means exit status
@@ -2237,7 +2229,7 @@ int main(int argc, char **argv)
     ("pgid", po::value<string>(&pgidstr),
      "PG id, mandatory for info, log, remove, export, rm-past-intervals, mark-complete")
     ("op", po::value<string>(&op),
-     "Arg is one of [info, log, remove, export, import, list, fix-lost, list-pgs, rm-past-intervals, set-allow-sharded-objects, dump-journal, dump-super, meta-list, "
+     "Arg is one of [info, log, remove, export, import, list, fix-lost, list-pgs, rm-past-intervals, dump-journal, dump-super, meta-list, "
         "get-osdmap, set-osdmap, get-inc-osdmap, set-inc-osdmap, mark-complete]")
     ("epoch", po::value<unsigned>(&epoch),
      "epoch# for get-osdmap and get-inc-osdmap, the current epoch in use if not specified")
@@ -2481,8 +2473,6 @@ int main(int argc, char **argv)
     myexit(1);
   }
 
-  bool fs_sharded_objects = fs->get_allow_sharded_objects();
-
   vector<coll_t> ls;
   vector<coll_t>::iterator it;
   CompatSet supported;
@@ -2509,13 +2499,6 @@ int main(int argc, char **argv)
     cerr << "Cluster fsid=" << superblock.cluster_fsid << std::endl;
   }
 
-#ifdef INTERNAL_TEST2
-  fs->set_allow_sharded_objects();
-  assert(fs->get_allow_sharded_objects());
-  fs_sharded_objects = true;
-  superblock.compat_features.incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_SHARDS);
-#endif
-
   if (debug) {
     cerr << "Supported features: " << supported << std::endl;
     cerr << "On-disk features: " << superblock.compat_features << std::endl;
@@ -2631,96 +2614,6 @@ int main(int argc, char **argv)
     goto out;
   }
 
-  if (op == "set-allow-sharded-objects") {
-    // This could only happen if we backport changes to an older release
-    if (!supported.incompat.contains(CEPH_OSD_FEATURE_INCOMPAT_SHARDS)) {
-      cerr << "Can't enable sharded objects in this release" << std::endl;
-      ret = 1;
-      goto out;
-    }
-    if (superblock.compat_features.incompat.contains(CEPH_OSD_FEATURE_INCOMPAT_SHARDS) &&
-        fs_sharded_objects) {
-      cerr << "Sharded objects already fully enabled" << std::endl;
-      ret = 0;
-      goto out;
-    }
-    OSDMap curmap;
-    bufferlist bl;
-    ret = get_osdmap(fs, superblock.current_epoch, curmap, bl);
-    if (ret) {
-        cerr << "Can't find local OSDMap" << std::endl;
-        goto out;
-    }
-
-    // Based on OSDMonitor::check_cluster_features()
-    // XXX: The up state of osds in the last map isn't
-    // as important from a non-running osd.  I'm using
-    // get_all_osds() instead.  An osd which was never
-    // upgraded and never removed would be flagged here.
-    stringstream unsupported_ss;
-    int unsupported_count = 0;
-    uint64_t features = CEPH_FEATURE_OSD_ERASURE_CODES;
-    set<int32_t> all_osds;
-    curmap.get_all_osds(all_osds);
-    for (set<int32_t>::iterator it = all_osds.begin();
-         it != all_osds.end(); ++it) {
-        const osd_xinfo_t &xi = curmap.get_xinfo(*it);
-#ifdef INTERNAL_TEST3
-        // Force one of the OSDs to not have support for erasure codes
-        if (unsupported_count == 0)
-            ((osd_xinfo_t &)xi).features &= ~features;
-#endif
-        if ((xi.features & features) != features) {
-            if (unsupported_count > 0)
-                unsupported_ss << ", ";
-            unsupported_ss << "osd." << *it;
-            unsupported_count ++;
-        }
-    }
-
-    if (unsupported_count > 0) {
-        cerr << "ERASURE_CODES feature unsupported by: "
-           << unsupported_ss.str() << std::endl;
-        ret = 1;
-        goto out;
-    }
-
-    if (!dry_run) {
-      superblock.compat_features.incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_SHARDS);
-      ObjectStore::Transaction t;
-      bl.clear();
-      ::encode(superblock, bl);
-      t.write(coll_t::meta(), OSD_SUPERBLOCK_POBJECT, 0, bl.length(), bl);
-      ret = fs->apply_transaction(osr, t);
-      if (ret < 0) {
-        cerr << "Error writing OSD superblock: " << cpp_strerror(ret) << std::endl;
-        goto out;
-      }
-
-      fs->set_allow_sharded_objects();
-    }
-    cout << "Enabled on-disk sharded objects" << std::endl;
-
-    ret = 0;
-    goto out;
-  }
-
-  // If there was a crash as an OSD was transitioning to sharded objects
-  // and hadn't completed a set_allow_sharded_objects().
-  // This utility does not want to attempt to finish that transition.
-  if (superblock.compat_features.incompat.contains(CEPH_OSD_FEATURE_INCOMPAT_SHARDS) != fs_sharded_objects) {
-    // An OSD should never have call set_allow_sharded_objects() before
-    // updating its own OSD features.
-    if (fs_sharded_objects)
-      cerr << "FileStore sharded but OSD not set, Corruption?" << std::endl;
-    else
-      cerr << "Found incomplete transition to sharded objects" << std::endl;
-    cerr << std::endl;
-    cerr << "Use --op set-allow-sharded-objects to repair" << std::endl;
-    ret = -EINVAL;
-    goto out;
-  }
-
   if (op == "import") {
 
     try {
@@ -2903,7 +2796,7 @@ int main(int argc, char **argv)
   // If not an object command nor any of the ops handled below, then output this usage
   // before complaining about a bad pgid
   if (!vm.count("objcmd") && op != "export" && op != "info" && op != "log" && op != "rm-past-intervals" && op != "mark-complete") {
-    cerr << "Must provide --op (info, log, remove, export, import, list, fix-lost, list-pgs, rm-past-intervals, set-allow-sharded-objects, dump-journal, dump-super, meta-list, "
+    cerr << "Must provide --op (info, log, remove, export, import, list, fix-lost, list-pgs, rm-past-intervals, dump-journal, dump-super, meta-list, "
       "get-osdmap, set-osdmap, get-inc-osdmap, set-inc-osdmap, mark-complete)"
         << std::endl;
     usage(desc);