From: Sage Weil Date: Wed, 8 Feb 2017 20:10:18 +0000 (-0500) Subject: os: remove nibblewise sort order support X-Git-Tag: v12.0.1~427^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e8c55fe157e6f45836871f6008214fb75a59e94f;p=ceph.git os: remove nibblewise sort order support Signed-off-by: Sage Weil --- diff --git a/src/os/FuseStore.cc b/src/os/FuseStore.cc index 06b869cb1589..fc47eb98a649 100644 --- a/src/os/FuseStore.cc +++ b/src/os/FuseStore.cc @@ -475,7 +475,7 @@ static int os_readdir(const char *path, while (true) { vector ls; int r = fs->store->collection_list( - cid, next, last, true, 1000, &ls, &next); + cid, next, last, 1000, &ls, &next); if (r < 0) return r; for (auto p : ls) { diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 08f6075ebd4e..c1ebc40e7c94 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -1833,7 +1833,6 @@ public: * @param c collection * @param start list object that sort >= this value * @param end list objects that sort < this value - * @param sort_bitwise sort bitwise (instead of legacy nibblewise) * @param max return no more than this many results * @param seq return no objects with snap < seq * @param ls [out] result @@ -1842,13 +1841,13 @@ public: */ virtual int collection_list(const coll_t& c, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + int max, vector *ls, ghobject_t *next) = 0; virtual int collection_list(CollectionHandle &c, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + int max, vector *ls, ghobject_t *next) { - return collection_list(c->get_cid(), start, end, sort_bitwise, max, ls, next); + return collection_list(c->get_cid(), start, end, max, ls, next); } diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ffcddf747c2a..9f3a10a41b93 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6029,7 +6029,7 @@ int BlueStore::collection_empty(const coll_t& cid, bool *empty) dout(15) << __func__ << " " << cid << dendl; vector ls; ghobject_t next; - int r = collection_list(cid, ghobject_t(), ghobject_t::get_max(), true, 1, + int r = collection_list(cid, ghobject_t(), ghobject_t::get_max(), 1, &ls, &next); if (r < 0) { derr << __func__ << " collection_list returned: " << cpp_strerror(r) @@ -6053,19 +6053,17 @@ int BlueStore::collection_bits(const coll_t& cid) } int BlueStore::collection_list( - const coll_t& cid, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + const coll_t& cid, const ghobject_t& start, const ghobject_t& end, int max, vector *ls, ghobject_t *pnext) { CollectionHandle c = _get_collection(cid); if (!c) return -ENOENT; - return collection_list(c, start, end, sort_bitwise, max, ls, pnext); + return collection_list(c, start, end, max, ls, pnext); } int BlueStore::collection_list( - CollectionHandle &c_, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + CollectionHandle &c_, const ghobject_t& start, const ghobject_t& end, int max, vector *ls, ghobject_t *pnext) { Collection *c = static_cast(c_.get()); @@ -6074,7 +6072,7 @@ int BlueStore::collection_list( int r; { RWLock::RLocker l(c->lock); - r = _collection_list(c, start, end, sort_bitwise, max, ls, pnext); + r = _collection_list(c, start, end, max, ls, pnext); } c->trim_cache(); @@ -6086,15 +6084,12 @@ int BlueStore::collection_list( } int BlueStore::_collection_list( - Collection *c, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + Collection *c, const ghobject_t& start, const ghobject_t& end, int max, vector *ls, ghobject_t *pnext) { if (!c->exists) return -ENOENT; - if (!sort_bitwise) - return -EOPNOTSUPP; int r = 0; ghobject_t static_next; @@ -9638,7 +9633,7 @@ int BlueStore::_remove_collection(TransContext *txc, const coll_t &cid, // Enumerate onodes in db, up to nonexistent_count + 1 // then check if all of them are marked as non-existent. // Bypass the check if returned number is greater than nonexistent_count - r = _collection_list(c->get(), ghobject_t(), ghobject_t::get_max(), true, + r = _collection_list(c->get(), ghobject_t(), ghobject_t::get_max(), nonexistent_count + 1, &ls, &next); if (r >= 0) { bool exists = false; //ls.size() > nonexistent_count; diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 9a34583b8eab..2b401ef84fee 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1810,7 +1810,7 @@ private: int _collection_list( Collection *c, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, vector *ls, ghobject_t *next); + int max, vector *ls, ghobject_t *next); template T select_option(const std::string& opt_name, T val1, F f) { @@ -1949,12 +1949,12 @@ public: int collection_list(const coll_t& cid, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + int max, vector *ls, ghobject_t *next) override; int collection_list(CollectionHandle &c, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + int max, vector *ls, ghobject_t *next) override; int omap_get( diff --git a/src/os/filestore/CollectionIndex.h b/src/os/filestore/CollectionIndex.h index 51431ac12efe..7f7d7ffa23a7 100644 --- a/src/os/filestore/CollectionIndex.h +++ b/src/os/filestore/CollectionIndex.h @@ -168,7 +168,6 @@ protected: virtual int collection_list_partial( const ghobject_t &start, ///< [in] object at which to start const ghobject_t &end, ///< [in] list only objects < end - bool sort_bitwise, ///< [in] use bitwise sort int max_count, ///< [in] return at most max_count objects vector *ls, ///< [out] Listed objects ghobject_t *next ///< [out] Next object to list diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 21cc1823d991..6c1c4c67419e 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -4617,7 +4617,7 @@ int FileStore::_collection_remove_recursive(const coll_t &cid, vector objects; ghobject_t max; while (!max.is_max()) { - r = collection_list(cid, max, ghobject_t::get_max(), true, + r = collection_list(cid, max, ghobject_t::get_max(), 300, &objects, &max); if (r < 0) return r; @@ -4748,7 +4748,7 @@ int FileStore::collection_empty(const coll_t& c, bool *empty) RWLock::RLocker l((index.index)->access_lock); vector ls; - r = index->collection_list_partial(ghobject_t(), ghobject_t::get_max(), true, + r = index->collection_list_partial(ghobject_t(), ghobject_t::get_max(), 1, &ls, NULL); if (r < 0) { derr << __func__ << " collection_list_partial returned: " @@ -4763,7 +4763,7 @@ int FileStore::collection_empty(const coll_t& c, bool *empty) int FileStore::collection_list(const coll_t& c, const ghobject_t& orig_start, const ghobject_t& end, - bool sort_bitwise, int max, + int max, vector *ls, ghobject_t *next) { ghobject_t start = orig_start; @@ -4804,7 +4804,7 @@ int FileStore::collection_list(const coll_t& c, if (cmp_bitwise(start, sep) < 0) { // bitwise vs nibble doesn't matter here dout(10) << __func__ << " first checking temp pool" << dendl; coll_t temp = c.get_temp(); - int r = collection_list(temp, start, end, sort_bitwise, max, ls, next); + int r = collection_list(temp, start, end, max, ls, next); if (r < 0) return r; if (*next != ghobject_t::get_max()) @@ -4825,7 +4825,7 @@ int FileStore::collection_list(const coll_t& c, assert(NULL != index.index); RWLock::RLocker l((index.index)->access_lock); - r = index->collection_list_partial(start, end, sort_bitwise, max, ls, next); + r = index->collection_list_partial(start, end, max, ls, next); if (r < 0) { assert(!m_filestore_fail_eio || r != -EIO); @@ -5459,7 +5459,6 @@ int FileStore::_split_collection(const coll_t& cid, collection_list( cid, next, ghobject_t::get_max(), - true, get_ideal_list_max(), &objects, &next); @@ -5479,7 +5478,6 @@ int FileStore::_split_collection(const coll_t& cid, collection_list( dest, next, ghobject_t::get_max(), - true, get_ideal_list_max(), &objects, &next); diff --git a/src/os/filestore/FileStore.h b/src/os/filestore/FileStore.h index ac57de7998a5..4a0656fc1f7d 100644 --- a/src/os/filestore/FileStore.h +++ b/src/os/filestore/FileStore.h @@ -656,8 +656,7 @@ public: // collections using ObjectStore::collection_list; int collection_list(const coll_t& c, - const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + const ghobject_t& start, const ghobject_t& end, int max, vector *ls, ghobject_t *next); int list_collections(vector& ls); int list_collections(vector& ls, bool include_temp); diff --git a/src/os/filestore/HashIndex.cc b/src/os/filestore/HashIndex.cc index 39efacd1d2b7..6bbb6330333e 100644 --- a/src/os/filestore/HashIndex.cc +++ b/src/os/filestore/HashIndex.cc @@ -440,7 +440,6 @@ int HashIndex::_lookup(const ghobject_t &oid, int HashIndex::_collection_list_partial(const ghobject_t &start, const ghobject_t &end, - bool sort_bitwise, int max_count, vector *ls, ghobject_t *next) { @@ -450,7 +449,7 @@ int HashIndex::_collection_list_partial(const ghobject_t &start, next = &_next; *next = start; dout(20) << __func__ << " start:" << start << " end:" << end << "-" << max_count << " ls.size " << ls->size() << dendl; - return list_by_hash(path, end, sort_bitwise, max_count, next, ls); + return list_by_hash(path, end, max_count, next, ls); } int HashIndex::prep_delete() { @@ -947,73 +946,14 @@ int HashIndex::get_path_contents_by_hash_bitwise( return 0; } -int HashIndex::get_path_contents_by_hash_nibblewise( - const vector &path, - const ghobject_t *next_object, - set *hash_prefixes, - set, CmpPairNibblewise > *objects) -{ - map rev_objects; - int r; - r = list_objects(path, 0, 0, &rev_objects); - if (r < 0) - return r; - - for (map::iterator i = rev_objects.begin(); - i != rev_objects.end(); - ++i) { - string hash_prefix = get_path_str(i->second); - if (next_object && cmp_nibblewise(i->second, *next_object) < 0) - continue; - hash_prefixes->insert(hash_prefix); - objects->insert(pair(hash_prefix, i->second)); - } - - vector subdirs; - r = list_subdirs(path, &subdirs); - if (r < 0) - return r; - - // sort nibblewise (string sort of (reversed) hex digits) - std::sort(subdirs.begin(), subdirs.end()); - - string cur_prefix; - for (vector::const_iterator i = path.begin(); - i != path.end(); - ++i) { - cur_prefix.append(*i); - } - string next_object_string; - if (next_object) - next_object_string = get_path_str(*next_object); - - for (vector::iterator i = subdirs.begin(); - i != subdirs.end(); - ++i) { - string candidate = cur_prefix + *i; - if (next_object) { - if (next_object->is_max()) - continue; - if (candidate < next_object_string.substr(0, candidate.size())) - continue; - } - hash_prefixes->insert(cur_prefix + *i); - } - return 0; -} - int HashIndex::list_by_hash(const vector &path, const ghobject_t &end, - bool sort_bitwise, int max_count, ghobject_t *next, vector *out) { assert(out); - if (sort_bitwise) - return list_by_hash_bitwise(path, end, max_count, next, out); - else - return list_by_hash_nibblewise(path, end, max_count, next, out); + return list_by_hash_bitwise(path, end, max_count, next, out); } int HashIndex::list_by_hash_bitwise( @@ -1082,67 +1022,4 @@ int HashIndex::list_by_hash_bitwise( return 0; } -int HashIndex::list_by_hash_nibblewise( - const vector &path, - const ghobject_t& end, - int max_count, - ghobject_t *next, - vector *out) -{ - vector next_path = path; - next_path.push_back(""); - set hash_prefixes; - set, CmpPairNibblewise> objects; - int r = get_path_contents_by_hash_nibblewise(path, - next, - &hash_prefixes, - &objects); - if (r < 0) - return r; - for (set::iterator i = hash_prefixes.begin(); - i != hash_prefixes.end(); - ++i) { - dout(20) << __func__ << " prefix " << *i << dendl; - set, CmpPairNibblewise >::iterator j = - objects.lower_bound(make_pair(*i, ghobject_t())); - if (j == objects.end() || j->first != *i) { - *(next_path.rbegin()) = *(i->rbegin()); - ghobject_t next_recurse; - if (next) - next_recurse = *next; - r = list_by_hash_nibblewise(next_path, - end, - max_count, - &next_recurse, - out); - if (r < 0) - return r; - if (!next_recurse.is_max()) { - if (next) - *next = next_recurse; - return 0; - } - } else { - while (j != objects.end() && j->first == *i) { - if (max_count > 0 && out->size() == (unsigned)max_count) { - if (next) - *next = j->second; - return 0; - } - if (cmp_nibblewise(j->second, end) >= 0) { - if (next) - *next = j->second; - return 0; - } - if (!next || cmp_nibblewise(j->second, *next) >= 0) { - out->push_back(j->second); - } - ++j; - } - } - } - if (next) - *next = ghobject_t::get_max(); - return 0; -} diff --git a/src/os/filestore/HashIndex.h b/src/os/filestore/HashIndex.h index e3fa3d9ab32e..add3c3559fcf 100644 --- a/src/os/filestore/HashIndex.h +++ b/src/os/filestore/HashIndex.h @@ -196,7 +196,6 @@ protected: int _collection_list_partial( const ghobject_t &start, const ghobject_t &end, - bool sort_bitwise, int max_count, vector *ls, ghobject_t *next @@ -401,18 +400,11 @@ private: set *hash_prefixes, /// [out] prefixes in dir set, CmpPairBitwise> *objects /// [out] objects ); - int get_path_contents_by_hash_nibblewise( - const vector &path, /// [in] Path to list - const ghobject_t *next_object, /// [in] list > *next_object - set *hash_prefixes, /// [out] prefixes in dir - set, CmpPairNibblewise> *objects /// [out] objects - ); /// List objects in collection in ghobject_t order int list_by_hash( const vector &path, /// [in] Path to list const ghobject_t &end, /// [in] List only objects < end - bool sort_bitwise, /// [in] sort bitwise int max_count, /// [in] List at most max_count ghobject_t *next, /// [in,out] List objects >= *next vector *out /// [out] Listed objects @@ -425,13 +417,6 @@ private: ghobject_t *next, /// [in,out] List objects >= *next vector *out /// [out] Listed objects ); ///< @return Error Code, 0 on success - int list_by_hash_nibblewise( - const vector &path, /// [in] Path to list - const ghobject_t &end, /// [in] List only objects < end - int max_count, /// [in] List at most max_count - ghobject_t *next, /// [in,out] List objects >= *next - vector *out /// [out] Listed objects - ); ///< @return Error Code, 0 on success /// Create the given levels of sub directories from the given root. /// The contents of *path* is not changed after calling this function. diff --git a/src/os/filestore/LFNIndex.cc b/src/os/filestore/LFNIndex.cc index c498aa2612ad..5ccdad2be8f6 100644 --- a/src/os/filestore/LFNIndex.cc +++ b/src/os/filestore/LFNIndex.cc @@ -157,12 +157,11 @@ int LFNIndex::pre_hash_collection(uint32_t pg_num, uint64_t expected_num_objs) int LFNIndex::collection_list_partial(const ghobject_t &start, const ghobject_t &end, - bool sort_bitwise, int max_count, vector *ls, ghobject_t *next) { - return _collection_list_partial(start, end, sort_bitwise, max_count, ls, next); + return _collection_list_partial(start, end, max_count, ls, next); } /* Derived class utility methods */ diff --git a/src/os/filestore/LFNIndex.h b/src/os/filestore/LFNIndex.h index c23b915206b3..6cb3ed76e218 100644 --- a/src/os/filestore/LFNIndex.h +++ b/src/os/filestore/LFNIndex.h @@ -189,7 +189,6 @@ public: int collection_list_partial( const ghobject_t &start, const ghobject_t &end, - bool sort_bitwise, int max_count, vector *ls, ghobject_t *next @@ -255,7 +254,6 @@ protected: virtual int _collection_list_partial( const ghobject_t &start, const ghobject_t &end, - bool sort_bitwise, int max_count, vector *ls, ghobject_t *next diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index 2319050423e1..faf8ce4a5cc0 100755 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -1388,7 +1388,7 @@ int KStore::collection_empty(const coll_t& cid, bool *empty) dout(15) << __func__ << " " << cid << dendl; vector ls; ghobject_t next; - int r = collection_list(cid, ghobject_t(), ghobject_t::get_max(), true, 1, + int r = collection_list(cid, ghobject_t(), ghobject_t::get_max(), 1, &ls, &next); if (r < 0) { derr << __func__ << " collection_list returned: " << cpp_strerror(r) @@ -1401,19 +1401,17 @@ int KStore::collection_empty(const coll_t& cid, bool *empty) } int KStore::collection_list( - const coll_t& cid, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + const coll_t& cid, const ghobject_t& start, const ghobject_t& end, int max, vector *ls, ghobject_t *pnext) { CollectionHandle c = _get_collection(cid); if (!c) return -ENOENT; - return collection_list(c, start, end, sort_bitwise, max, ls, pnext); + return collection_list(c, start, end, max, ls, pnext); } int KStore::collection_list( - CollectionHandle &c_, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + CollectionHandle &c_, const ghobject_t& start, const ghobject_t& end, int max, vector *ls, ghobject_t *pnext) { @@ -1423,7 +1421,7 @@ int KStore::collection_list( int r; { RWLock::RLocker l(c->lock); - r = _collection_list(c, start, end, sort_bitwise, max, ls, pnext); + r = _collection_list(c, start, end, max, ls, pnext); } dout(10) << __func__ << " " << c->cid @@ -1434,13 +1432,9 @@ int KStore::collection_list( } int KStore::_collection_list( - Collection* c, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + Collection* c, const ghobject_t& start, const ghobject_t& end, int max, vector *ls, ghobject_t *pnext) { - if (!sort_bitwise) - return -EOPNOTSUPP; - int r = 0; KeyValueDB::Iterator it; string temp_start_key, temp_end_key; @@ -3293,7 +3287,7 @@ int KStore::_remove_collection(TransContext *txc, coll_t cid, // Enumerate onodes in db, up to nonexistent_count + 1 // then check if all of them are marked as non-existent. // Bypass the check if returned number is greater than nonexistent_count - r = _collection_list(c->get(), ghobject_t(), ghobject_t::get_max(), true, + r = _collection_list(c->get(), ghobject_t(), ghobject_t::get_max(), nonexistent_count + 1, &ls, &next); if (r >= 0) { bool exists = false; //ls.size() > nonexistent_count; diff --git a/src/os/kstore/KStore.h b/src/os/kstore/KStore.h index c4acd16590bd..520cd8329ccf 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -399,7 +399,7 @@ private: int _collection_list( Collection *c, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, vector *ls, ghobject_t *next); + int max, vector *ls, ghobject_t *next); public: KStore(CephContext *cct, const string& path); @@ -483,11 +483,11 @@ public: int collection_list( const coll_t& cid, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + int max, vector *ls, ghobject_t *next) override; int collection_list( CollectionHandle &c, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + int max, vector *ls, ghobject_t *next) override; using ObjectStore::omap_get; diff --git a/src/os/memstore/MemStore.cc b/src/os/memstore/MemStore.cc index 4ff957527c59..73ed1f720edd 100644 --- a/src/os/memstore/MemStore.cc +++ b/src/os/memstore/MemStore.cc @@ -463,11 +463,9 @@ int MemStore::collection_empty(const coll_t& cid, bool *empty) int MemStore::collection_list(const coll_t& cid, const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + int max, vector *ls, ghobject_t *next) { - if (!sort_bitwise) - return -EOPNOTSUPP; CollectionRef c = get_collection(cid); if (!c) return -ENOENT; diff --git a/src/os/memstore/MemStore.h b/src/os/memstore/MemStore.h index 4d8d4aadf765..b28b3ba78eae 100644 --- a/src/os/memstore/MemStore.h +++ b/src/os/memstore/MemStore.h @@ -327,8 +327,7 @@ public: int collection_empty(const coll_t& c, bool *empty) override; using ObjectStore::collection_list; int collection_list(const coll_t& cid, - const ghobject_t& start, const ghobject_t& end, - bool sort_bitwise, int max, + const ghobject_t& start, const ghobject_t& end, int max, vector *ls, ghobject_t *next) override; using ObjectStore::omap_get; diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 7fb576762756..26df67911b8f 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3039,7 +3039,7 @@ void OSD::clear_temp_objects() ghobject_t next; while (1) { vector objects; - store->collection_list(*p, next, ghobject_t::get_max(), true, + store->collection_list(*p, next, ghobject_t::get_max(), store->get_ideal_list_max(), &objects, &next); if (objects.empty()) @@ -3092,7 +3092,7 @@ void OSD::recursive_remove_collection(CephContext* cct, SnapMapper mapper(cct, &driver, 0, 0, 0, pgid.shard); vector objects; - store->collection_list(tmp, ghobject_t(), ghobject_t::get_max(), true, + store->collection_list(tmp, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0); // delete them. @@ -4763,7 +4763,6 @@ bool remove_dir( coll, next, ghobject_t::get_max(), - true, store->get_ideal_list_max(), &olist, &next); diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 024657d8e436..805fd520ca3b 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -212,7 +212,6 @@ int PGBackend::objects_list_partial( ch, _next, ghobject_t::get_max(), - parent->sort_bitwise(), max - ls->size(), &objects, &_next); @@ -249,7 +248,6 @@ int PGBackend::objects_list_range( ch, ghobject_t(start, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard), ghobject_t(end, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard), - parent->sort_bitwise(), INT_MAX, &objects, NULL); diff --git a/src/test/objectstore/FileStoreDiff.cc b/src/test/objectstore/FileStoreDiff.cc index 2596166546bd..5134522017ab 100644 --- a/src/test/objectstore/FileStoreDiff.cc +++ b/src/test/objectstore/FileStoreDiff.cc @@ -134,14 +134,14 @@ bool FileStoreDiff::diff_objects(FileStore *a_store, FileStore *b_store, coll_t int err; std::vector b_objects, a_objects; err = b_store->collection_list(coll, ghobject_t(), ghobject_t::get_max(), - true, INT_MAX, &b_objects, NULL); + INT_MAX, &b_objects, NULL); if (err < 0) { dout(0) << "diff_objects list on verify coll " << coll.to_str() << " returns " << err << dendl; return true; } err = a_store->collection_list(coll, ghobject_t(), ghobject_t::get_max(), - true, INT_MAX, &a_objects, NULL); + INT_MAX, &a_objects, NULL); if (err < 0) { dout(0) << "diff_objects list on store coll " << coll.to_str() << " returns " << err << dendl; diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index da74c1b701aa..4035b6d411c2 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -86,12 +86,12 @@ int apply_transaction( } -bool sorted(const vector &in, bool bitwise) { +bool sorted(const vector &in) { ghobject_t start; for (vector::const_iterator i = in.begin(); i != in.end(); ++i) { - if (cmp(start, *i, bitwise) > 0) { + if (cmp(start, *i, true) > 0) { cout << start << " should follow " << *i << std::endl; return false; } @@ -2234,20 +2234,16 @@ TEST_P(StoreTest, SimpleListTest) { r = apply_transaction(store, &osr, std::move(t)); ASSERT_EQ(r, 0); } - for (int bitwise=0; bitwise<2; ++bitwise) { + { set saw; vector objects; ghobject_t next, current; while (!next.is_max()) { int r = store->collection_list(cid, current, ghobject_t::get_max(), - (bool)bitwise, 50, + 50, &objects, &next); - if (r == -EOPNOTSUPP) { - ++bitwise; // skip nibblewise test - continue; - } ASSERT_EQ(r, 0); - ASSERT_TRUE(sorted(objects, (bool)bitwise)); + ASSERT_TRUE(sorted(objects)); cout << " got " << objects.size() << " next " << next << std::endl; for (vector::iterator p = objects.begin(); p != objects.end(); ++p) { @@ -2308,8 +2304,7 @@ TEST_P(StoreTest, ListEndTest) { end.hobj.pool = 1; vector objects; ghobject_t next; - int r = store->collection_list(cid, ghobject_t(), end, - true, 500, + int r = store->collection_list(cid, ghobject_t(), end, 500, &objects, &next); ASSERT_EQ(r, 0); for (auto &p : objects) { @@ -2389,8 +2384,7 @@ TEST_P(StoreTest, MultipoolListTest) { vector objects; ghobject_t next, current; while (!next.is_max()) { - int r = store->collection_list(cid, current, ghobject_t::get_max(), - true, 50, + int r = store->collection_list(cid, current, ghobject_t::get_max(), 50, &objects, &next); ASSERT_EQ(r, 0); cout << " got " << objects.size() << " next " << next << std::endl; @@ -3049,7 +3043,7 @@ TEST_P(StoreTest, ManyObjectTest) { set listed, listed2; vector objects; - r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true, INT_MAX, &objects, 0); + r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0); ASSERT_EQ(r, 0); cerr << "objects.size() is " << objects.size() << std::endl; @@ -3067,7 +3061,6 @@ TEST_P(StoreTest, ManyObjectTest) { cid, ghobject_t::get_max(), ghobject_t::get_max(), - true, 50, &objects, &next @@ -3079,28 +3072,11 @@ TEST_P(StoreTest, ManyObjectTest) { listed.clear(); ghobject_t start2, next2; while (1) { - // nibblewise - r = store->collection_list(cid, start2, ghobject_t::get_max(), false, - 50, - &objects, - &next2); - if (r != -EOPNOTSUPP) { - ASSERT_TRUE(sorted(objects, false)); - ASSERT_EQ(r, 0); - listed2.insert(objects.begin(), objects.end()); - if (objects.size() < 50) { - ASSERT_TRUE(next2.is_max()); - } - objects.clear(); - start2 = next2; - } - - // bitwise - r = store->collection_list(cid, start, ghobject_t::get_max(), true, + r = store->collection_list(cid, start, ghobject_t::get_max(), 50, &objects, &next); - ASSERT_TRUE(sorted(objects, true)); + ASSERT_TRUE(sorted(objects)); ASSERT_EQ(r, 0); listed.insert(objects.begin(), objects.end()); if (objects.size() < 50) { @@ -3323,7 +3299,7 @@ public: while (1) { vector objects; int r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), - true, 10, &objects, 0); + 10, &objects, 0); assert(r >= 0); if (objects.empty()) break; @@ -3897,11 +3873,10 @@ public: ghobject_t next, current; while (1) { //cerr << "scanning..." << std::endl; - int r = store->collection_list(cid, current, ghobject_t::get_max(), - true, 100, + int r = store->collection_list(cid, current, ghobject_t::get_max(), 100, &objects, &next); ASSERT_EQ(r, 0); - ASSERT_TRUE(sorted(objects, true)); + ASSERT_TRUE(sorted(objects)); objects_set.insert(objects.begin(), objects.end()); objects.clear(); if (next.is_max()) break; @@ -3932,7 +3907,8 @@ public: ASSERT_GT(available_objects.count(*i), (unsigned)0); } - int r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true, INT_MAX, &objects, 0); + int r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), + INT_MAX, &objects, 0); ASSERT_EQ(r, 0); objects_set2.insert(objects.begin(), objects.end()); ASSERT_EQ(objects_set2.size(), available_objects.size()); @@ -4413,7 +4389,7 @@ TEST_P(StoreTest, HashCollisionTest) { } } vector objects; - r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true, INT_MAX, &objects, 0); + r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0); ASSERT_EQ(r, 0); set listed(objects.begin(), objects.end()); cerr << "listed.size() is " << listed.size() << " and created.size() is " << created.size() << std::endl; @@ -4422,10 +4398,10 @@ TEST_P(StoreTest, HashCollisionTest) { listed.clear(); ghobject_t current, next; while (1) { - r = store->collection_list(cid, current, ghobject_t::get_max(), true, 60, + r = store->collection_list(cid, current, ghobject_t::get_max(), 60, &objects, &next); ASSERT_EQ(r, 0); - ASSERT_TRUE(sorted(objects, true)); + ASSERT_TRUE(sorted(objects)); for (vector::iterator i = objects.begin(); i != objects.end(); ++i) { @@ -4511,7 +4487,7 @@ TEST_P(StoreTest, ScrubTest) { } vector objects; - r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true, + r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0); ASSERT_EQ(r, 0); set listed(objects.begin(), objects.end()); @@ -4521,10 +4497,10 @@ TEST_P(StoreTest, ScrubTest) { listed.clear(); ghobject_t current, next; while (1) { - r = store->collection_list(cid, current, ghobject_t::get_max(), true, 60, + r = store->collection_list(cid, current, ghobject_t::get_max(), 60, &objects, &next); ASSERT_EQ(r, 0); - ASSERT_TRUE(sorted(objects, true)); + ASSERT_TRUE(sorted(objects)); for (vector::iterator i = objects.begin(); i != objects.end(); ++i) { if (listed.count(*i)) @@ -4975,7 +4951,7 @@ void colsplittest( ObjectStore::Transaction t; vector objects; - r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true, + r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0); ASSERT_EQ(r, 0); ASSERT_EQ(objects.size(), num_objects); @@ -4994,7 +4970,7 @@ void colsplittest( } objects.clear(); - r = store->collection_list(tid, ghobject_t(), ghobject_t::get_max(), true, + r = store->collection_list(tid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0); ASSERT_EQ(r, 0); ASSERT_EQ(objects.size(), num_objects); @@ -5272,7 +5248,7 @@ TEST_P(StoreTest, BigRGWObjectName) { { vector objects; - r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true, + r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0); ASSERT_EQ(r, 0); ASSERT_EQ(objects.size(), 1u); diff --git a/src/test/objectstore/workload_generator.cc b/src/test/objectstore/workload_generator.cc index b5e6dde149a0..a529e576b790 100644 --- a/src/test/objectstore/workload_generator.cc +++ b/src/test/objectstore/workload_generator.cc @@ -356,7 +356,7 @@ void WorkloadGenerator::do_destroy_collection(ObjectStore::Transaction *t, entry->m_osr.flush(); vector ls; m_store->collection_list(entry->m_coll, ghobject_t(), ghobject_t::get_max(), - true, INT_MAX, &ls, NULL); + INT_MAX, &ls, NULL); dout(2) << __func__ << " coll " << entry->m_coll << " (" << ls.size() << " objects)" << dendl; diff --git a/src/test/os/TestLFNIndex.cc b/src/test/os/TestLFNIndex.cc index 367bba2dd945..87a5a00e01f2 100644 --- a/src/test/os/TestLFNIndex.cc +++ b/src/test/os/TestLFNIndex.cc @@ -80,7 +80,6 @@ protected: virtual int _collection_list_partial( const ghobject_t &start, const ghobject_t &end, - bool sort_bitwise, int max_count, vector *ls, ghobject_t *next diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index d7d1319f6c35..0e5cbf93efbc 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -90,7 +90,6 @@ int _action_on_all_objects_in_pg(ObjectStore *store, coll_t coll, action_on_obje coll, next, ghobject_t::get_max(), - true, LIST_AT_A_TIME, &list, &next); @@ -621,7 +620,7 @@ int ObjectStoreTool::export_files(ObjectStore *store, coll_t coll) while (!next.is_max()) { vector objects; - int r = store->collection_list(coll, next, ghobject_t::get_max(), true, 300, + int r = store->collection_list(coll, next, ghobject_t::get_max(), 300, &objects, &next); if (r < 0) return r;