From: Sage Weil Date: Tue, 22 Dec 2015 22:13:15 +0000 (-0500) Subject: os: remove {get,set}_allow_sharded_objects from interface X-Git-Tag: v10.0.3~154^2~57 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=56375c596b097eeb6880b32ee98af6c85fea82ab;p=ceph.git os: remove {get,set}_allow_sharded_objects from interface 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 --- diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 00b7d544e2b..0eca9d90eac 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -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(); diff --git a/src/os/FileStore.h b/src/os/FileStore.h index be5e668b8eb..ac7490b5ee4 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -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 } diff --git a/src/os/KeyValueStore.h b/src/os/KeyValueStore.h index 914ce1dff3e..28e086ae818 100644 --- a/src/os/KeyValueStore.h +++ b/src/os/KeyValueStore.h @@ -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 *pm); int statfs(struct statfs *buf); diff --git a/src/os/MemStore.cc b/src/os/MemStore.cc index fd791703997..509250f9ccc 100644 --- a/src/os/MemStore.cc +++ b/src/os/MemStore.cc @@ -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; diff --git a/src/os/MemStore.h b/src/os/MemStore.h index fc047c09ad9..b061c75f954 100644 --- a/src/os/MemStore.h +++ b/src/os/MemStore.h @@ -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); diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 8f2b749ae67..8af918de1bb 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -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 diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index b26959bf576..e5c60afa74f 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -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); diff --git a/src/os/kstore/KStore.h b/src/os/kstore/KStore.h index 6d9bf609aea..5be44733168 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -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); diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 8423df81a9a..f5d4a3fcd50 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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(); } } } diff --git a/src/test/ceph_objectstore_tool.py b/src/test/ceph_objectstore_tool.py index 186b0b68f9c..5547bd6d3a1 100755 --- a/src/test/ceph_objectstore_tool.py +++ b/src/test/ceph_objectstore_tool.py @@ -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) diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index b67000e4f55..0608978fb51 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -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( diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index a7126c9bcf3..4b81f2ad1c7 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -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(&pgidstr), "PG id, mandatory for info, log, remove, export, rm-past-intervals, mark-complete") ("op", po::value(&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(&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 ls; vector::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 all_osds; - curmap.get_all_osds(all_osds); - for (set::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);