diff --git a/src/common/hobject.cc b/src/common/hobject.cc index 14acd4ba24f55..a965c87d62241 100644 --- a/src/common/hobject.cc +++ b/src/common/hobject.cc @@ -319,40 +319,7 @@ bool hobject_t::parse(const string &s) return true; } -int cmp_nibblewise(const hobject_t& l, const hobject_t& r) -{ - if (l.max < r.max) - return -1; - if (l.max > r.max) - return 1; - if (l.pool < r.pool) - return -1; - if (l.pool > r.pool) - return 1; - if (l.get_nibblewise_key() < r.get_nibblewise_key()) - return -1; - if (l.get_nibblewise_key() > r.get_nibblewise_key()) - return 1; - if (l.nspace < r.nspace) - return -1; - if (l.nspace > r.nspace) - return 1; - if (l.get_effective_key() < r.get_effective_key()) - return -1; - if (l.get_effective_key() > r.get_effective_key()) - return 1; - if (l.oid < r.oid) - return -1; - if (l.oid > r.oid) - return 1; - if (l.snap < r.snap) - return -1; - if (l.snap > r.snap) - return 1; - return 0; -} - -int cmp_bitwise(const hobject_t& l, const hobject_t& r) +int cmp(const hobject_t& l, const hobject_t& r) { if (l.max < r.max) return -1; @@ -606,27 +573,7 @@ bool ghobject_t::parse(const string& s) return true; } -int cmp_nibblewise(const ghobject_t& l, const ghobject_t& r) -{ - if (l.max < r.max) - return -1; - if (l.max > r.max) - return 1; - if (l.shard_id < r.shard_id) - return -1; - if (l.shard_id > r.shard_id) - return 1; - int ret = cmp_nibblewise(l.hobj, r.hobj); - if (ret != 0) - return ret; - if (l.generation < r.generation) - return -1; - if (l.generation > r.generation) - return 1; - return 0; -} - -int cmp_bitwise(const ghobject_t& l, const ghobject_t& r) +int cmp(const ghobject_t& l, const ghobject_t& r) { if (l.max < r.max) return -1; @@ -636,7 +583,7 @@ int cmp_bitwise(const ghobject_t& l, const ghobject_t& r) return -1; if (l.shard_id > r.shard_id) return 1; - int ret = cmp_bitwise(l.hobj, r.hobj); + int ret = cmp(l.hobj, r.hobj); if (ret != 0) return ret; if (l.generation < r.generation) diff --git a/src/common/hobject.h b/src/common/hobject.h index 14a9ffc7c95d8..1ec236bbd23e1 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -289,48 +289,22 @@ struct hobject_t { void decode(json_spirit::Value& v); void dump(Formatter *f) const; static void generate_test_instances(list& o); - friend int cmp_nibblewise(const hobject_t& l, const hobject_t& r); - friend int cmp_bitwise(const hobject_t& l, const hobject_t& r); + friend int cmp(const hobject_t& l, const hobject_t& r); + friend bool operator>(const hobject_t& l, const hobject_t& r) { + return cmp(l, r) > 0; + } + friend bool operator>=(const hobject_t& l, const hobject_t& r) { + return cmp(l, r) >= 0; + } + friend bool operator<(const hobject_t& l, const hobject_t& r) { + return cmp(l, r) < 0; + } + friend bool operator<=(const hobject_t& l, const hobject_t& r) { + return cmp(l, r) <= 0; + } friend bool operator==(const hobject_t&, const hobject_t&); friend bool operator!=(const hobject_t&, const hobject_t&); friend struct ghobject_t; - - struct NibblewiseComparator { - bool operator()(const hobject_t& l, const hobject_t& r) const { - return cmp_nibblewise(l, r) < 0; - } - }; - - struct BitwiseComparator { - bool operator()(const hobject_t& l, const hobject_t& r) const { - return cmp_bitwise(l, r) < 0; - } - }; - - struct Comparator { - bool bitwise; - explicit Comparator(bool b) : bitwise(b) {} - bool operator()(const hobject_t& l, const hobject_t& r) const { - if (bitwise) - return cmp_bitwise(l, r) < 0; - else - return cmp_nibblewise(l, r) < 0; - } - }; - struct ComparatorWithDefault { - bool bitwise; - explicit ComparatorWithDefault(bool b=true) : bitwise(b) {} - bool operator()(const hobject_t& l, const hobject_t& r) const { - if (bitwise) - return cmp_bitwise(l, r) < 0; - else - return cmp_nibblewise(l, r) < 0; - } - }; - template - using bitwisemap = std::map; - - using bitwiseset = std::set; }; WRITE_CLASS_ENCODER(hobject_t) @@ -373,62 +347,20 @@ inline bool operator!=(const T&, const hobject_t &rhs) { return !rhs.is_max(); } -extern int cmp_nibblewise(const hobject_t& l, const hobject_t& r); -extern int cmp_bitwise(const hobject_t& l, const hobject_t& r); -static inline int cmp(const hobject_t& l, const hobject_t& r, bool sort_bitwise) { - if (sort_bitwise) - return cmp_bitwise(l, r); - else - return cmp_nibblewise(l, r); -} +extern int cmp(const hobject_t& l, const hobject_t& r); template -static inline int cmp(const hobject_t &l, const T&, bool sort_bitwise) { +static inline int cmp(const hobject_t &l, const T&) { static_assert(always_false::value::value, "Do not compare to get_max()"); return l.is_max() ? 0 : -1; } template -static inline int cmp(const T&, const hobject_t&r, bool sort_bitwise) { - static_assert(always_false::value::value, "Do not compare to get_max()"); - return r.is_max() ? 0 : 1; -} -template -static inline int cmp_nibblewise(const hobject_t &l, const T&, bool sort_bitwise) { - static_assert(always_false::value::value, "Do not compare to get_max()"); - return l.is_max() ? 0 : -1; -} -template -static inline int cmp_nibblewise(const T&, const hobject_t&r, bool sort_bitwise) { - static_assert(always_false::value::value, "Do not compare to get_max()"); - return r.is_max() ? 0 : 1; -} -template -static inline int cmp_bitwise(const hobject_t &l, const T&, bool sort_bitwise) { - static_assert(always_false::value::value, "Do not compare to get_max()"); - return l.is_max() ? 0 : -1; -} -template -static inline int cmp_bitwise(const T&, const hobject_t&r, bool sort_bitwise) { +static inline int cmp(const T&, const hobject_t&r) { static_assert(always_false::value::value, "Do not compare to get_max()"); return r.is_max() ? 0 : 1; } -// these are convenient -static inline hobject_t MAX_HOBJ(const hobject_t& l, const hobject_t& r, bool bitwise) { - if (cmp(l, r, bitwise) >= 0) - return l; - else - return r; -} - -static inline hobject_t MIN_HOBJ(const hobject_t& l, const hobject_t& r, bool bitwise) { - if (cmp(l, r, bitwise) <= 0) - return l; - else - return r; -} - typedef version_t gen_t; struct ghobject_t { @@ -530,33 +462,22 @@ struct ghobject_t { size_t encoded_size() const; void dump(Formatter *f) const; static void generate_test_instances(list& o); - friend int cmp_nibblewise(const ghobject_t& l, const ghobject_t& r); - friend int cmp_bitwise(const ghobject_t& l, const ghobject_t& r); + friend int cmp(const ghobject_t& l, const ghobject_t& r); + friend bool operator>(const ghobject_t& l, const ghobject_t& r) { + return cmp(l, r) > 0; + } + friend bool operator>=(const ghobject_t& l, const ghobject_t& r) { + return cmp(l, r) >= 0; + } + friend bool operator<(const ghobject_t& l, const ghobject_t& r) { + return cmp(l, r) < 0; + } + friend bool operator<=(const ghobject_t& l, const ghobject_t& r) { + return cmp(l, r) <= 0; + } friend bool operator==(const ghobject_t&, const ghobject_t&); friend bool operator!=(const ghobject_t&, const ghobject_t&); - struct NibblewiseComparator { - bool operator()(const ghobject_t& l, const ghobject_t& r) const { - return cmp_nibblewise(l, r) < 0; - } - }; - - struct BitwiseComparator { - bool operator()(const ghobject_t& l, const ghobject_t& r) const { - return cmp_bitwise(l, r) < 0; - } - }; - - struct Comparator { - bool bitwise; - explicit Comparator(bool b) : bitwise(b) {} - bool operator()(const ghobject_t& l, const ghobject_t& r) const { - if (bitwise) - return cmp_bitwise(l, r) < 0; - else - return cmp_nibblewise(l, r) < 0; - } - }; }; WRITE_CLASS_ENCODER(ghobject_t) @@ -573,31 +494,7 @@ ostream& operator<<(ostream& out, const ghobject_t& o); WRITE_EQ_OPERATORS_4(ghobject_t, max, shard_id, hobj, generation) -extern int cmp_nibblewise(const ghobject_t& l, const ghobject_t& r); -extern int cmp_bitwise(const ghobject_t& l, const ghobject_t& r); -static inline int cmp(const ghobject_t& l, const ghobject_t& r, - bool sort_bitwise) { - if (sort_bitwise) - return cmp_bitwise(l, r); - else - return cmp_nibblewise(l, r); -} - -// these are convenient -static inline ghobject_t MAX_GHOBJ(const ghobject_t& l, const ghobject_t& r, - bool bitwise) { - if (cmp(l, r, bitwise) >= 0) - return l; - else - return r; -} +extern int cmp(const ghobject_t& l, const ghobject_t& r); -static inline ghobject_t MIN_GHOBJ(const ghobject_t& l, const ghobject_t& r, - bool bitwise) { - if (cmp(l, r, bitwise) <= 0) - return l; - else - return r; -} #endif diff --git a/src/librados/librados.cc b/src/librados/librados.cc index 7b9816b4efa49..335fa4cd1b4ad 100644 --- a/src/librados/librados.cc +++ b/src/librados/librados.cc @@ -4205,7 +4205,7 @@ extern "C" int rados_object_list_cursor_cmp( { hobject_t *lhs = (hobject_t*)lhs_cur; hobject_t *rhs = (hobject_t*)rhs_cur; - return cmp_bitwise(*lhs, *rhs); + return cmp(*lhs, *rhs); } extern "C" int rados_object_list(rados_ioctx_t io, @@ -6073,7 +6073,7 @@ bool librados::ObjectCursor::operator<(const librados::ObjectCursor &rhs) { const hobject_t lhs_hobj = (c_cursor == nullptr) ? hobject_t() : *((hobject_t*)c_cursor); const hobject_t rhs_hobj = (rhs.c_cursor == nullptr) ? hobject_t() : *((hobject_t*)(rhs.c_cursor)); - return cmp_bitwise(lhs_hobj, rhs_hobj) == -1; + return lhs_hobj < rhs_hobj; } librados::ObjectCursor::ObjectCursor(const librados::ObjectCursor &rhs) diff --git a/src/messages/MOSDSubOp.h b/src/messages/MOSDSubOp.h index 615e8a5c8b899..cfc3afc4af410 100644 --- a/src/messages/MOSDSubOp.h +++ b/src/messages/MOSDSubOp.h @@ -70,7 +70,7 @@ class MOSDSubOp : public Message { map attrset; interval_set data_subset; - map, hobject_t::BitwiseComparator> clone_subsets; + map> clone_subsets; bool first, complete; diff --git a/src/os/FuseStore.cc b/src/os/FuseStore.cc index 06b869cb15899..fc47eb98a6494 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 08f6075ebd4ee..03b153372c0aa 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -475,7 +475,7 @@ class ObjectStore { void *osr {nullptr}; // NULL on replay map coll_index; - map object_index; + map object_index; __le32 coll_id {0}; __le32 object_id {0}; @@ -748,7 +748,7 @@ class ObjectStore { } vector<__le32> om(other.object_index.size()); - map::iterator object_index_p; + map::iterator object_index_p; for (object_index_p = other.object_index.begin(); object_index_p != other.object_index.end(); ++object_index_p) { @@ -894,7 +894,7 @@ class ObjectStore { colls[coll_index_p->second] = coll_index_p->first; } - map::iterator object_index_p; + map::iterator object_index_p; for (object_index_p = t->object_index.begin(); object_index_p != t->object_index.end(); ++object_index_p) { @@ -996,7 +996,7 @@ class ObjectStore { return index_id; } __le32 _get_object_id(const ghobject_t& oid) { - map::iterator o = object_index.find(oid); + map::iterator o = object_index.find(oid); if (o != object_index.end()) return o->second; @@ -1833,7 +1833,6 @@ class ObjectStore { * @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 @@ class ObjectStore { */ 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 acc4882e8d229..95432fd18adfa 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 9a34583b8eabf..92fef811aae99 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1640,8 +1640,8 @@ class BlueStore : public ObjectStore, list removed_collections; RWLock debug_read_error_lock; - set debug_data_error_objects; - set debug_mdata_error_objects; + set debug_data_error_objects; + set debug_mdata_error_objects; std::atomic csum_type; @@ -1810,7 +1810,7 @@ class BlueStore : public ObjectStore, 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 @@ class BlueStore : public ObjectStore, 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 51431ac12efe7..7f7d7ffa23a7b 100644 --- a/src/os/filestore/CollectionIndex.h +++ b/src/os/filestore/CollectionIndex.h @@ -168,7 +168,6 @@ class CollectionIndex { 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/DBObjectMap.cc b/src/os/filestore/DBObjectMap.cc index c17395c5a25ac..73c113dc5de63 100644 --- a/src/os/filestore/DBObjectMap.cc +++ b/src/os/filestore/DBObjectMap.cc @@ -889,10 +889,10 @@ int DBObjectMap::clone(const ghobject_t &oid, if (oid == target) return 0; - MapHeaderLock _l1(this, MIN_GHOBJ(oid, target, true)); - MapHeaderLock _l2(this, MAX_GHOBJ(oid, target, true)); + MapHeaderLock _l1(this, std::min(oid, target)); + MapHeaderLock _l2(this, std::max(oid, target)); MapHeaderLock *lsource, *ltarget; - if (cmp_bitwise(oid, target) > 0) { + if (oid > target) { lsource = &_l2; ltarget= &_l1; } else { diff --git a/src/os/filestore/DBObjectMap.h b/src/os/filestore/DBObjectMap.h index 8be514377c442..2fb411d753cfe 100644 --- a/src/os/filestore/DBObjectMap.h +++ b/src/os/filestore/DBObjectMap.h @@ -70,7 +70,7 @@ class DBObjectMap : public ObjectMap { * Set of headers currently in use */ set in_use; - set map_header_in_use; + set map_header_in_use; /** * Takes the map_header_in_use entry in constructor, releases in @@ -331,7 +331,7 @@ class DBObjectMap : public ObjectMap { /// Implicit lock on Header->seq typedef ceph::shared_ptr<_Header> Header; Mutex cache_lock; - SimpleLRU caches; + SimpleLRU caches; string map_header_key(const ghobject_t &oid); string header_key(uint64_t seq); diff --git a/src/os/filestore/FDCache.h b/src/os/filestore/FDCache.h index 0677afa1ba45f..4fdb8409db21a 100644 --- a/src/os/filestore/FDCache.h +++ b/src/os/filestore/FDCache.h @@ -52,14 +52,14 @@ class FDCache : public md_config_obs_t { private: CephContext *cct; const int registry_shards; - SharedLRU *registry; + SharedLRU *registry; public: explicit FDCache(CephContext *cct) : cct(cct), registry_shards(MAX(cct->_conf->filestore_fd_cache_shards, 1)) { assert(cct); cct->_conf->add_observer(this); - registry = new SharedLRU[registry_shards]; + registry = new SharedLRU[registry_shards]; for (int i = 0; i < registry_shards; ++i) { registry[i].set_cct(cct); registry[i].set_size( diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 21cc1823d9910..5e079f502debe 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; @@ -4801,10 +4801,10 @@ int FileStore::collection_list(const coll_t& c, sep.hobj.pool = -1; sep.set_shard(shard); if (!c.is_temp() && !c.is_meta()) { - if (cmp_bitwise(start, sep) < 0) { // bitwise vs nibble doesn't matter here + if (start < sep) { 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 ac57de7998a51..d7e66c10c3994 100644 --- a/src/os/filestore/FileStore.h +++ b/src/os/filestore/FileStore.h @@ -627,8 +627,8 @@ class FileStore : public JournalingObjectStore, // DEBUG read error injection, an object is removed from both on delete() Mutex read_error_lock; - set data_error_set; // read() will return -EIO - set mdata_error_set; // getattr(),stat() will return -EIO + set data_error_set; // read() will return -EIO + set mdata_error_set; // getattr(),stat() will return -EIO void inject_data_error(const ghobject_t &oid); void inject_mdata_error(const ghobject_t &oid); void debug_obj_on_delete(const ghobject_t &oid); @@ -656,8 +656,7 @@ class FileStore : public JournalingObjectStore, // 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 39efacd1d2b79..5026ed3934447 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() { @@ -904,7 +903,7 @@ int HashIndex::get_path_contents_by_hash_bitwise( for (map::iterator i = rev_objects.begin(); i != rev_objects.end(); ++i) { - if (next_object && cmp_bitwise(i->second, *next_object) < 0) + if (next_object && i->second < *next_object) continue; string hash_prefix = get_path_str(i->second); hash_prefixes->insert(hash_prefix); @@ -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( @@ -1064,12 +1004,12 @@ int HashIndex::list_by_hash_bitwise( *next = j->second; return 0; } - if (cmp_bitwise(j->second, end) >= 0) { + if (j->second >= end) { if (next) *next = j->second; return 0; } - if (!next || cmp_bitwise(j->second, *next) >= 0) { + if (!next || j->second >= *next) { dout(20) << __func__ << " prefix " << *i << " ob " << j->second << dendl; out->push_back(j->second); } @@ -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 e3fa3d9ab32e0..4ffde1d34ae97 100644 --- a/src/os/filestore/HashIndex.h +++ b/src/os/filestore/HashIndex.h @@ -196,7 +196,6 @@ class HashIndex : public LFNIndex { int _collection_list_partial( const ghobject_t &start, const ghobject_t &end, - bool sort_bitwise, int max_count, vector *ls, ghobject_t *next @@ -360,20 +359,6 @@ class HashIndex : public LFNIndex { return str; } - struct CmpPairNibblewise { - bool operator()(const pair& l, - const pair& r) - { - if (l.first < r.first) - return true; - if (l.first > r.first) - return false; - if (cmp_nibblewise(l.second, r.second) < 0) - return true; - return false; - } - }; - struct CmpPairBitwise { bool operator()(const pair& l, const pair& r) @@ -382,7 +367,7 @@ class HashIndex : public LFNIndex { return true; if (l.first > r.first) return false; - if (cmp_bitwise(l.second, r.second) < 0) + if (cmp(l.second, r.second) < 0) return true; return false; } @@ -401,18 +386,11 @@ class HashIndex : public LFNIndex { 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 +403,6 @@ class HashIndex : public LFNIndex { 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 c498aa2612ad2..5ccdad2be8f64 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 c23b915206b35..6cb3ed76e218b 100644 --- a/src/os/filestore/LFNIndex.h +++ b/src/os/filestore/LFNIndex.h @@ -189,7 +189,6 @@ class LFNIndex : public CollectionIndex { 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 @@ class LFNIndex : public CollectionIndex { 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 2319050423e19..faf8ce4a5cc05 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 c4acd16590bdb..520cd8329ccf3 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -399,7 +399,7 @@ class KStore : public ObjectStore { 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 @@ class KStore : public ObjectStore { 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 4ff957527c59e..3415227bb6359 100644 --- a/src/os/memstore/MemStore.cc +++ b/src/os/memstore/MemStore.cc @@ -120,7 +120,7 @@ void MemStore::dump(Formatter *f) f->close_section(); f->open_array_section("objects"); - for (map::iterator q = p->second->object_map.begin(); + for (map::iterator q = p->second->object_map.begin(); q != p->second->object_map.end(); ++q) { f->open_object_section("object"); @@ -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; @@ -475,10 +473,10 @@ int MemStore::collection_list(const coll_t& cid, dout(10) << __func__ << " cid " << cid << " start " << start << " end " << end << dendl; - map::iterator p = c->object_map.lower_bound(start); + map::iterator p = c->object_map.lower_bound(start); while (p != c->object_map.end() && ls->size() < (unsigned)max && - cmp_bitwise(p->first, end) < 0) { + p->first < end) { ls->push_back(p->first); ++p; } @@ -1447,7 +1445,7 @@ int MemStore::_split_collection(const coll_t& cid, uint32_t bits, uint32_t match RWLock::WLocker l1(MIN(&(*sc), &(*dc))->lock); RWLock::WLocker l2(MAX(&(*sc), &(*dc))->lock); - map::iterator p = sc->object_map.begin(); + map::iterator p = sc->object_map.begin(); while (p != sc->object_map.end()) { if (p->first.match(bits, match)) { dout(20) << " moving " << p->first << dendl; diff --git a/src/os/memstore/MemStore.h b/src/os/memstore/MemStore.h index 4d8d4aadf7654..286351c400baa 100644 --- a/src/os/memstore/MemStore.h +++ b/src/os/memstore/MemStore.h @@ -99,7 +99,7 @@ class MemStore : public ObjectStore { CephContext *cct; bool use_page_set; ceph::unordered_map object_hash; ///< for lookup - map object_map; ///< for iteration + map object_map; ///< for iteration map xattr; RWLock lock; ///< for object_{map,hash} bool exists; @@ -141,7 +141,7 @@ class MemStore : public ObjectStore { ::encode(use_page_set, bl); uint32_t s = object_map.size(); ::encode(s, bl); - for (map::const_iterator p = object_map.begin(); + for (map::const_iterator p = object_map.begin(); p != object_map.end(); ++p) { ::encode(p->first, bl); @@ -168,7 +168,7 @@ class MemStore : public ObjectStore { uint64_t used_bytes() const { uint64_t result = 0; - for (map::const_iterator p = object_map.begin(); + for (map::const_iterator p = object_map.begin(); p != object_map.end(); ++p) { result += p->second->get_size(); @@ -327,8 +327,7 @@ class MemStore : public ObjectStore { 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/ECBackend.cc b/src/osd/ECBackend.cc index ddf238c83e023..d697843f33ad9 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -251,7 +251,7 @@ struct OnRecoveryReadComplete : struct RecoveryMessages { map reads; + ECBackend::read_request_t> reads; void read( ECBackend *ec, const hobject_t &hoid, uint64_t off, uint64_t len, @@ -888,7 +888,7 @@ void ECBackend::handle_sub_write( add_temp_objs(op.temp_added); } if (op.backfill) { - for (set::iterator i = op.temp_removed.begin(); + for (set::iterator i = op.temp_removed.begin(); i != op.temp_removed.end(); ++i) { dout(10) << __func__ << ": removing object " << *i @@ -941,7 +941,7 @@ void ECBackend::handle_sub_read( ECSubReadReply *reply) { shard_id_t shard = get_parent()->whoami_shard().shard; - for(map >, hobject_t::BitwiseComparator>::iterator i = + for(map >>::iterator i = op.to_read.begin(); i != op.to_read.end(); ++i) { @@ -1012,7 +1012,7 @@ void ECBackend::handle_sub_read( reply->buffers_read.erase(i->first); reply->errors[i->first] = r; } - for (set::iterator i = op.attrs_to_read.begin(); + for (set::iterator i = op.attrs_to_read.begin(); i != op.attrs_to_read.end(); ++i) { dout(10) << __func__ << ": fulfilling attr request on " @@ -1077,7 +1077,7 @@ void ECBackend::handle_sub_read_reply( return; } ReadOp &rop = iter->second; - for (map >, hobject_t::BitwiseComparator>::iterator i = + for (map >>::iterator i = op.buffers_read.begin(); i != op.buffers_read.end(); ++i) { @@ -1105,7 +1105,7 @@ void ECBackend::handle_sub_read_reply( riter->get<2>()[from].claim(j->second); } } - for (map, hobject_t::BitwiseComparator>::iterator i = op.attrs_read.begin(); + for (map>::iterator i = op.attrs_read.begin(); i != op.attrs_read.end(); ++i) { assert(!op.errors.count(i->first)); // if read error better not have sent an attribute @@ -1117,7 +1117,7 @@ void ECBackend::handle_sub_read_reply( rop.complete[i->first].attrs = map(); (*(rop.complete[i->first].attrs)).swap(i->second); } - for (map::iterator i = op.errors.begin(); + for (map::iterator i = op.errors.begin(); i != op.errors.end(); ++i) { rop.complete[i->first].errors.insert( @@ -1207,9 +1207,9 @@ void ECBackend::handle_sub_read_reply( void ECBackend::complete_read_op(ReadOp &rop, RecoveryMessages *m) { - map::iterator reqiter = + map::iterator reqiter = rop.to_read.begin(); - map::iterator resiter = + map::iterator resiter = rop.complete.begin(); assert(rop.to_read.size() == rop.complete.size()); for (; reqiter != rop.to_read.end(); ++reqiter, ++resiter) { @@ -1241,8 +1241,8 @@ void ECBackend::filter_read_op( const OSDMapRef& osdmap, ReadOp &op) { - set to_cancel; - for (map >::iterator i = op.source_to_obj.begin(); + set to_cancel; + for (map >::iterator i = op.source_to_obj.begin(); i != op.source_to_obj.end(); ++i) { if (osdmap->is_down(i->first.osd)) { @@ -1255,10 +1255,10 @@ void ECBackend::filter_read_op( if (to_cancel.empty()) return; - for (map >::iterator i = op.source_to_obj.begin(); + for (map >::iterator i = op.source_to_obj.begin(); i != op.source_to_obj.end(); ) { - for (set::iterator j = i->second.begin(); + for (set::iterator j = i->second.begin(); j != i->second.end(); ) { if (to_cancel.count(*j)) @@ -1274,7 +1274,7 @@ void ECBackend::filter_read_op( } } - for (set::iterator i = to_cancel.begin(); + for (set::iterator i = to_cancel.begin(); i != to_cancel.end(); ++i) { get_parent()->cancel_pull(*i); @@ -1341,7 +1341,7 @@ void ECBackend::on_change() i != tid_to_read_map.end(); ++i) { dout(10) << __func__ << ": cancelling " << i->second << dendl; - for (map::iterator j = + for (map::iterator j = i->second.to_read.begin(); j != i->second.to_read.end(); ++j) { @@ -1367,7 +1367,7 @@ void ECBackend::on_flushed() void ECBackend::dump_recovery_info(Formatter *f) const { f->open_array_section("recovery_ops"); - for (map::const_iterator i = recovery_ops.begin(); + for (map::const_iterator i = recovery_ops.begin(); i != recovery_ops.end(); ++i) { f->open_object_section("op"); @@ -1475,14 +1475,14 @@ int ECBackend::get_min_avail_to_read_shards( assert(!shards.count(i->shard)); const pg_info_t &info = get_parent()->get_shard_info(*i); const pg_missing_t &missing = get_parent()->get_shard_missing(*i); - if (cmp(hoid, info.last_backfill, get_parent()->sort_bitwise()) < 0 && + if (hoid < info.last_backfill && !missing.is_missing(hoid)) { have.insert(i->shard); shards.insert(make_pair(i->shard, *i)); } } - map, hobject_t::BitwiseComparator>::const_iterator miter = + map>::const_iterator miter = get_parent()->get_missing_loc_shards().find(hoid); if (miter != get_parent()->get_missing_loc_shards().end()) { for (set::iterator i = miter->second.begin(); @@ -1557,7 +1557,7 @@ int ECBackend::get_remaining_shards( void ECBackend::start_read_op( int priority, - map &to_read, + map &to_read, OpRequestRef _op, bool do_redundant_reads, bool for_recovery) @@ -1586,8 +1586,7 @@ void ECBackend::do_read_op(ReadOp &op) dout(10) << __func__ << ": starting read " << op << dendl; map messages; - for (map::iterator i = op.to_read.begin(); + for (map::iterator i = op.to_read.begin(); i != op.to_read.end(); ++i) { bool need_attrs = i->second.want_attrs; @@ -1785,7 +1784,7 @@ bool ECBackend::try_state_to_reads() assert(get_parent()->get_pool().is_hacky_ecoverwrites()); objects_read_async_no_cache( op->remote_read, - [this, op](hobject_t::bitwisemap > &&results) { + [this, op](map > &&results) { for (auto &&i: results) { op->remote_read_result.emplace(i.first, i.second.second); } @@ -1834,7 +1833,7 @@ bool ECBackend::try_reads_to_commit() trans[i->shard]; } - hobject_t::bitwisemap written; + map written; if (op->plan.t) { ECTransaction::generate_transactions( op->plan, @@ -1865,7 +1864,7 @@ bool ECBackend::try_reads_to_commit() } } - hobject_t::bitwisemap written_set; + map written_set; for (auto &&i: written) { written_set[i.first] = i.second.get_interval_set(); } @@ -2016,7 +2015,7 @@ void ECBackend::objects_read_async( Context *on_complete, bool fast_read) { - hobject_t::bitwisemap > > + map > > reads; uint32_t flags = 0; @@ -2066,7 +2065,7 @@ void ECBackend::objects_read_async( hoid(hoid), to_read(to_read), on_complete(on_complete) {} - void operator()(hobject_t::bitwisemap > &&results) { + void operator()(map > &&results) { auto dpp = ec->get_parent()->get_dpp(); ldpp_dout(dpp, 20) << "objects_read_async_cb: got: " << results << dendl; @@ -2119,7 +2118,7 @@ void ECBackend::objects_read_async( reads, fast_read, make_gen_lambda_context< - hobject_t::bitwisemap > &&, cb>( + map > &&, cb>( cb(this, hoid, to_read, @@ -2186,11 +2185,11 @@ struct CallClientContexts : }; void ECBackend::objects_read_and_reconstruct( - const hobject_t::bitwisemap< + const map > > &reads, bool fast_read, - GenContextURef > &&> &&func) + GenContextURef > &&> &&func) { in_progress_client_reads.emplace_back( reads.size(), std::move(func)); @@ -2202,7 +2201,7 @@ void ECBackend::objects_read_and_reconstruct( set want_to_read; get_want_to_read_shards(&want_to_read); - map for_read_op; + map for_read_op; for (auto &&to_read: reads) { set shards; int r = get_min_avail_to_read_shards( @@ -2261,7 +2260,7 @@ int ECBackend::send_all_remaining_reads( GenContext &> *c = rop.to_read.find(hoid)->second.cb; - map for_read_op; + map for_read_op; for_read_op.insert( make_pair( hoid, diff --git a/src/osd/ECBackend.h b/src/osd/ECBackend.h index 526112197f160..555ca38d14876 100644 --- a/src/osd/ECBackend.h +++ b/src/osd/ECBackend.h @@ -137,20 +137,19 @@ class ECBackend : public PGBackend { * check_recovery_sources. */ void objects_read_and_reconstruct( - const hobject_t::bitwisemap< - std::list > + const map > > &reads, bool fast_read, - GenContextURef > &&> &&func); + GenContextURef > &&> &&func); friend struct CallClientContexts; struct ClientAsyncReadStatus { unsigned objects_to_read; - GenContextURef > &&> func; - hobject_t::bitwisemap > results; + GenContextURef > &&> func; + map > results; explicit ClientAsyncReadStatus( unsigned objects_to_read, - GenContextURef > &&> &&func) + GenContextURef > &&> &&func) : objects_to_read(objects_to_read), func(std::move(func)) {} void complete_object( const hobject_t &hoid, @@ -178,10 +177,9 @@ class ECBackend : public PGBackend { template void objects_read_async_no_cache( - const hobject_t::bitwisemap &to_read, + const map &to_read, Func &&on_complete) { - hobject_t::bitwisemap< - std::list > > _to_read; + map > > _to_read; for (auto &&hpair: to_read) { auto &l = _to_read[hpair.first]; for (auto extent: hpair.second) { @@ -192,7 +190,7 @@ class ECBackend : public PGBackend { _to_read, false, make_gen_lambda_context< - hobject_t::bitwisemap > &&, Func>( + map > &&, Func>( std::forward(on_complete))); } void kick_reads() { @@ -294,7 +292,7 @@ class ECBackend : public PGBackend { RecoveryOp() : state(IDLE) {} }; friend ostream &operator<<(ostream &lhs, const RecoveryOp &rhs); - map recovery_ops; + map recovery_ops; void continue_recovery_op( RecoveryOp &op, @@ -372,11 +370,11 @@ class ECBackend : public PGBackend { // of the available shards. bool for_recovery; - map to_read; - map complete; + map to_read; + map complete; - map, hobject_t::BitwiseComparator> obj_to_source; - map > source_to_obj; + map> obj_to_source; + map > source_to_obj; void dump(Formatter *f) const; @@ -388,7 +386,7 @@ class ECBackend : public PGBackend { bool do_redundant_reads, bool for_recovery, OpRequestRef op, - map &&_to_read) + map &&_to_read) : priority(priority), tid(tid), op(op), do_redundant_reads(do_redundant_reads), for_recovery(for_recovery), to_read(std::move(_to_read)) { for (auto &&hpair: to_read) { @@ -416,7 +414,7 @@ class ECBackend : public PGBackend { map > shard_to_read_map; void start_read_op( int priority, - map &to_read, + map &to_read, OpRequestRef op, bool do_redundant_reads, bool for_recovery); @@ -453,14 +451,14 @@ class ECBackend : public PGBackend { eversion_t roll_forward_to; /// Soon to be generated internally /// Ancillary also provided from submit_transaction caller - map obc_map; + map obc_map; /// see call_write_ordered std::list > on_write; /// Generated internally - set temp_added; - set temp_cleared; + set temp_added; + set temp_cleared; ECTransaction::WritePlan plan; bool requires_rmw() const { return !plan.to_read.empty(); } @@ -470,9 +468,9 @@ class ECBackend : public PGBackend { bool using_cache = false; /// In progress read state; - hobject_t::bitwisemap pending_read; // subset already being read - hobject_t::bitwisemap remote_read; // subset we must read - hobject_t::bitwisemap remote_read_result; + map pending_read; // subset already being read + map remote_read; // subset we must read + map remote_read_result; bool read_in_progress() const { return !remote_read.empty() && remote_read_result.empty(); } @@ -614,7 +612,7 @@ class ECBackend : public PGBackend { const ECUtil::stripe_info_t sinfo; /// If modified, ensure that the ref is held until the update is applied - SharedPtrRegistry unstable_hashinfo_registry; + SharedPtrRegistry unstable_hashinfo_registry; ECUtil::HashInfoRef get_hash_info(const hobject_t &hoid, bool checks = true, const map *attr = NULL); diff --git a/src/osd/ECMsgTypes.cc b/src/osd/ECMsgTypes.cc index 2223e7f91a366..499784a8665f6 100644 --- a/src/osd/ECMsgTypes.cc +++ b/src/osd/ECMsgTypes.cc @@ -169,8 +169,8 @@ void ECSubRead::encode(bufferlist &bl, uint64_t features) const ENCODE_START(1, 1, bl); ::encode(from, bl); ::encode(tid, bl); - map >, hobject_t::BitwiseComparator> tmp; - for (map >, hobject_t::BitwiseComparator>::const_iterator m = to_read.begin(); + map >> tmp; + for (map >>::const_iterator m = to_read.begin(); m != to_read.end(); ++m) { list > tlist; for (list >::const_iterator l = m->second.begin(); @@ -199,9 +199,9 @@ void ECSubRead::decode(bufferlist::iterator &bl) ::decode(from, bl); ::decode(tid, bl); if (struct_v == 1) { - map >, hobject_t::BitwiseComparator>tmp; + map >>tmp; ::decode(tmp, bl); - for (map >, hobject_t::BitwiseComparator>::const_iterator m = tmp.begin(); + for (map >>::const_iterator m = tmp.begin(); m != tmp.end(); ++m) { list > tlist; for (list > ::const_iterator l = m->second.begin(); @@ -231,7 +231,7 @@ void ECSubRead::dump(Formatter *f) const f->dump_stream("from") << from; f->dump_unsigned("tid", tid); f->open_array_section("objects"); - for (map >, hobject_t::BitwiseComparator>::const_iterator i = + for (map >>::const_iterator i = to_read.begin(); i != to_read.end(); ++i) { @@ -254,7 +254,7 @@ void ECSubRead::dump(Formatter *f) const f->close_section(); f->open_array_section("object_attrs_requested"); - for (set::const_iterator i = attrs_to_read.begin(); + for (set::const_iterator i = attrs_to_read.begin(); i != attrs_to_read.end(); ++i) { f->open_object_section("object"); @@ -320,7 +320,7 @@ void ECSubReadReply::dump(Formatter *f) const f->dump_stream("from") << from; f->dump_unsigned("tid", tid); f->open_array_section("buffers_read"); - for (map >, hobject_t::BitwiseComparator>::const_iterator i = + for (map >>::const_iterator i = buffers_read.begin(); i != buffers_read.end(); ++i) { @@ -342,7 +342,7 @@ void ECSubReadReply::dump(Formatter *f) const f->close_section(); f->open_array_section("attrs_returned"); - for (map, hobject_t::BitwiseComparator>::const_iterator i = + for (map>::const_iterator i = attrs_read.begin(); i != attrs_read.end(); ++i) { @@ -363,7 +363,7 @@ void ECSubReadReply::dump(Formatter *f) const f->close_section(); f->open_array_section("errors"); - for (map::const_iterator i = errors.begin(); + for (map::const_iterator i = errors.begin(); i != errors.end(); ++i) { f->open_object_section("error_pair"); diff --git a/src/osd/ECMsgTypes.h b/src/osd/ECMsgTypes.h index d28b6efa7df22..bfcb5361ae1f0 100644 --- a/src/osd/ECMsgTypes.h +++ b/src/osd/ECMsgTypes.h @@ -31,8 +31,8 @@ struct ECSubWrite { eversion_t trim_to; eversion_t roll_forward_to; vector log_entries; - set temp_added; - set temp_removed; + set temp_added; + set temp_removed; boost::optional updated_hit_set_history; bool backfill = false; ECSubWrite() : tid(0) {} @@ -48,8 +48,8 @@ struct ECSubWrite { eversion_t roll_forward_to, vector log_entries, boost::optional updated_hit_set_history, - const set &temp_added, - const set &temp_removed, + const set &temp_added, + const set &temp_removed, bool backfill) : from(from), tid(tid), reqid(reqid), soid(soid), stats(stats), t(t), @@ -105,8 +105,8 @@ WRITE_CLASS_ENCODER(ECSubWriteReply) struct ECSubRead { pg_shard_t from; ceph_tid_t tid; - map >, hobject_t::BitwiseComparator> to_read; - set attrs_to_read; + map >> to_read; + set attrs_to_read; void encode(bufferlist &bl, uint64_t features) const; void decode(bufferlist::iterator &bl); void dump(Formatter *f) const; @@ -117,9 +117,9 @@ WRITE_CLASS_ENCODER_FEATURES(ECSubRead) struct ECSubReadReply { pg_shard_t from; ceph_tid_t tid; - map >, hobject_t::BitwiseComparator> buffers_read; - map, hobject_t::BitwiseComparator> attrs_read; - map errors; + map >> buffers_read; + map> attrs_read; + map errors; void encode(bufferlist &bl) const; void decode(bufferlist::iterator &bl); void dump(Formatter *f) const; diff --git a/src/osd/ECTransaction.cc b/src/osd/ECTransaction.cc index 4cb76d0f4eaa0..3119778664265 100644 --- a/src/osd/ECTransaction.cc +++ b/src/osd/ECTransaction.cc @@ -101,12 +101,12 @@ void ECTransaction::generate_transactions( pg_t pgid, bool legacy_log_entries, const ECUtil::stripe_info_t &sinfo, - const hobject_t::bitwisemap &partial_extents, + const map &partial_extents, vector &entries, - hobject_t::bitwisemap *written_map, + map *written_map, map *transactions, - set *temp_added, - set *temp_removed, + set *temp_added, + set *temp_removed, DoutPrefixProvider *dpp) { assert(written_map); @@ -122,7 +122,7 @@ void ECTransaction::generate_transactions( assert(temp_added); assert(temp_removed); - map obj_to_log; + map obj_to_log; for (auto &&i: entries) { obj_to_log.insert(make_pair(i.soid, &i)); } diff --git a/src/osd/ECTransaction.h b/src/osd/ECTransaction.h index a284167993506..346dcd146f3b0 100644 --- a/src/osd/ECTransaction.h +++ b/src/osd/ECTransaction.h @@ -26,10 +26,10 @@ namespace ECTransaction { struct WritePlan { PGTransactionUPtr t; bool invalidates_cache = false; // Yes, both are possible - hobject_t::bitwisemap to_read; - hobject_t::bitwisemap will_write; // superset of to_read + map to_read; + map will_write; // superset of to_read - hobject_t::bitwisemap hash_infos; + map hash_infos; }; bool requires_overwrite( @@ -182,12 +182,12 @@ namespace ECTransaction { pg_t pgid, bool legacy_log_entries, const ECUtil::stripe_info_t &sinfo, - const hobject_t::bitwisemap &partial_extents, + const map &partial_extents, vector &entries, - hobject_t::bitwisemap *written, + map *written, map *transactions, - set *temp_added, - set *temp_removed, + set *temp_added, + set *temp_removed, DoutPrefixProvider *dpp); }; diff --git a/src/osd/ExtentCache.h b/src/osd/ExtentCache.h index 07a7feab56884..4354ba6c7e696 100644 --- a/src/osd/ExtentCache.h +++ b/src/osd/ExtentCache.h @@ -182,7 +182,7 @@ class ExtentCache { set extent_set; bool operator<(const object_extent_set &rhs) const { - return cmp_bitwise(oid, rhs.oid) < 0; + return oid < rhs.oid; } struct uint_cmp { @@ -330,10 +330,10 @@ class ExtentCache { }; struct Cmp { bool operator()(const hobject_t &oid, const object_extent_set &rhs) const { - return cmp_bitwise(oid, rhs.oid) < 0; + return oid < rhs.oid; } bool operator()(const object_extent_set &lhs, const hobject_t &oid) const { - return cmp_bitwise(lhs.oid, oid) < 0; + return lhs.oid < oid; } }; diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 29fb6f46593e5..c101a2b8d1cac 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); @@ -5907,9 +5906,9 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector& cmd, buffe pg->lock(); fout << *pg << std::endl; - std::map::const_iterator mend = + std::map::const_iterator mend = pg->pg_log.get_missing().get_items().end(); - std::map::const_iterator mi = + std::map::const_iterator mi = pg->pg_log.get_missing().get_items().begin(); for (; mi != mend; ++mi) { fout << mi->first << " -> " << mi->second << std::endl; @@ -7573,6 +7572,11 @@ void OSD::activate_map() dout(7) << "activate_map version " << osdmap->get_epoch() << dendl; + if (!osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE)) { + derr << __func__ << " SORTBITWISE flag is not set" << dendl; + ceph_abort(); + } + if (osdmap->test_flag(CEPH_OSDMAP_FULL)) { dout(10) << " osdmap flagged full, doing onetime osdmap subscribe" << dendl; osdmap_subscribe(osdmap->get_epoch() + 1, false); @@ -8412,7 +8416,7 @@ void OSD::handle_pg_query(OpRequestRef op) * before the pg is recreated, we'll just start it off backfilling * instead of just empty */ if (service.deleting_pgs.lookup(pgid)) - empty.set_last_backfill(hobject_t(), true); + empty.set_last_backfill(hobject_t()); if (it->second.type == pg_query_t::LOG || it->second.type == pg_query_t::FULLLOG) { ConnectionRef con = service.get_con_osd_cluster(from, osdmap->get_epoch()); @@ -8900,7 +8904,7 @@ void OSD::handle_backoff(OpRequestRef& op, OSDMapRef& osdmap) // advance pos = _pgid.get_hobj_end(osdmap->get_pg_pool(pos.pool)->get_pg_num()); dout(20) << __func__ << " next pg " << pos << dendl; - } while (cmp_bitwise(pos, m->end) < 0); + } while (pos < m->end); } template diff --git a/src/osd/OSD.h b/src/osd/OSD.h index af5a847636beb..e2d35f01d32be 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -727,7 +727,7 @@ class OSDService { bool agent_valid_iterator; int agent_ops; int flush_mode_high_count; //once have one pg with FLUSH_MODE_HIGH then flush objects with high speed - set agent_oids; + set agent_oids; bool agent_active; struct AgentThread : public Thread { OSDService *osd; @@ -934,7 +934,7 @@ class OSDService { uint64_t recovery_ops_reserved; bool recovery_paused; #ifdef DEBUG_RECOVERY_OIDS - map > recovery_oids; + map > recovery_oids; #endif bool _recover_now(uint64_t *available_pushes); void _maybe_queue_recovery(); diff --git a/src/osd/PG.cc b/src/osd/PG.cc index e0000c30abd10..c31cc7bd32625 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -259,7 +259,6 @@ PG::PG(OSDService *o, OSDMapRef curmap, peer_features(CEPH_FEATURES_SUPPORTED_DEFAULT), acting_features(CEPH_FEATURES_SUPPORTED_DEFAULT), upacting_features(CEPH_FEATURES_SUPPORTED_DEFAULT), - do_sort_bitwise(false), last_epoch(0) { #ifdef PG_DEBUG_REFS @@ -354,7 +353,7 @@ void PG::proc_replica_log( dout(10) << " peer osd." << from << " now " << oinfo << " " << omissing << dendl; might_have_unfound.insert(from); - for (map::const_iterator i = + for (map::const_iterator i = omissing.get_items().begin(); i != omissing.get_items().end(); ++i) { @@ -476,7 +475,7 @@ bool PG::search_for_missing( { unsigned num_unfound_before = missing_loc.num_unfound(); bool found_missing = missing_loc.add_source_info( - from, oinfo, omissing, get_sort_bitwise(), ctx->handle); + from, oinfo, omissing, ctx->handle); if (found_missing && num_unfound_before != missing_loc.num_unfound()) publish_stats_to_osd(); if (found_missing && @@ -520,7 +519,7 @@ void PG::MissingLoc::add_batch_sources_info( ldout(pg->cct, 10) << __func__ << ": adding sources in batch " << sources.size() << dendl; unsigned loop = 0; - for (map::const_iterator i = needs_recovery_map.begin(); + for (map::const_iterator i = needs_recovery_map.begin(); i != needs_recovery_map.end(); ++i) { if (handle && ++loop >= pg->cct->_conf->osd_loop_before_reset_tphandle) { @@ -536,13 +535,12 @@ bool PG::MissingLoc::add_source_info( pg_shard_t fromosd, const pg_info_t &oinfo, const pg_missing_t &omissing, - bool sort_bitwise, ThreadPool::TPHandle* handle) { bool found_missing = false; unsigned loop = 0; // found items? - for (map::const_iterator p = needs_recovery_map.begin(); + for (map::const_iterator p = needs_recovery_map.begin(); p != needs_recovery_map.end(); ++p) { const hobject_t &soid(p->first); @@ -559,7 +557,7 @@ bool PG::MissingLoc::add_source_info( continue; } if (!oinfo.last_backfill.is_max() && - oinfo.last_backfill_bitwise != sort_bitwise) { + !oinfo.last_backfill_bitwise) { ldout(pg->cct, 10) << "search_for_missing " << soid << " " << need << " also missing on osd." << fromosd << " (last_backfill " << oinfo.last_backfill @@ -567,7 +565,7 @@ bool PG::MissingLoc::add_source_info( << dendl; continue; } - if (cmp(p->first, oinfo.last_backfill, sort_bitwise) >= 0) { + if (p->first >= oinfo.last_backfill) { // FIXME: this is _probably_ true, although it could conceivably // be in the undefined region! Hmm! ldout(pg->cct, 10) << "search_for_missing " << soid << " " << need @@ -1656,7 +1654,7 @@ void PG::activate(ObjectStore::Transaction& t, */ bool force_restart_backfill = !pi.last_backfill.is_max() && - pi.last_backfill_bitwise != get_sort_bitwise(); + !pi.last_backfill_bitwise; if (pi.last_update == info.last_update && !force_restart_backfill) { // empty log @@ -1702,7 +1700,7 @@ void PG::activate(ObjectStore::Transaction& t, pi.last_update = info.last_update; pi.last_complete = info.last_update; - pi.set_last_backfill(hobject_t(), get_sort_bitwise()); + pi.set_last_backfill(hobject_t()); pi.last_epoch_started = info.last_epoch_started; pi.history = info.history; pi.hit_set = info.hit_set; @@ -1742,7 +1740,7 @@ void PG::activate(ObjectStore::Transaction& t, for (list::iterator p = m->log.log.begin(); p != m->log.log.end(); ++p) - if (cmp(p->soid, pi.last_backfill, get_sort_bitwise()) <= 0) + if (p->soid <= pi.last_backfill) pm.add_next_event(*p); } @@ -1795,7 +1793,7 @@ void PG::activate(ObjectStore::Transaction& t, missing_loc.add_batch_sources_info(complete_shards, ctx->handle); } else { missing_loc.add_source_info(pg_whoami, info, pg_log.get_missing(), - get_sort_bitwise(), ctx->handle); + ctx->handle); for (set::iterator i = actingbackfill.begin(); i != actingbackfill.end(); ++i) { @@ -1807,7 +1805,6 @@ void PG::activate(ObjectStore::Transaction& t, *i, peer_info[*i], peer_missing[*i], - get_sort_bitwise(), ctx->handle); } } @@ -2264,15 +2261,14 @@ void PG::split_into(pg_t child_pgid, PG *child, unsigned split_bits) child->info.purged_snaps = info.purged_snaps; if (info.last_backfill.is_max()) { - child->info.set_last_backfill(hobject_t::get_max(), - info.last_backfill_bitwise); + child->info.set_last_backfill(hobject_t::get_max()); } else { // restart backfill on parent and child to be safe. we could // probably do better in the bitwise sort case, but it's more // fragile (there may be special work to do on backfill completion // in the future). - info.set_last_backfill(hobject_t(), info.last_backfill_bitwise); - child->info.set_last_backfill(hobject_t(), info.last_backfill_bitwise); + info.set_last_backfill(hobject_t()); + child->info.set_last_backfill(hobject_t()); } child->info.stats = info.stats; @@ -2366,11 +2362,11 @@ void PG::release_backoffs(const hobject_t& begin, const hobject_t& end) Mutex::Locker l(backoff_lock); auto p = backoffs.lower_bound(begin); while (p != backoffs.end()) { - int r = cmp_bitwise(p->first, end); + int r = cmp(p->first, end); dout(20) << __func__ << " ? " << r << " " << p->first << " " << p->second << dendl; // note: must still examine begin=end=p->first case - if (r > 0 || (r == 0 && cmp_bitwise(begin, end) < 0)) { + if (r > 0 || (r == 0 && begin < end)) { break; } dout(20) << __func__ << " checking " << p->first @@ -2378,9 +2374,8 @@ void PG::release_backoffs(const hobject_t& begin, const hobject_t& end) auto q = p->second.begin(); while (q != p->second.end()) { dout(20) << __func__ << " checking " << *q << dendl; - int r = cmp_bitwise((*q)->begin, begin); - if (r == 0 || (r > 0 && - cmp_bitwise((*q)->end, end) < 0)) { + int r = cmp((*q)->begin, begin); + if (r == 0 || (r > 0 && (*q)->end < end)) { bv.push_back(*q); q = p->second.erase(q); } else { @@ -2488,7 +2483,7 @@ void PG::split_backoffs(PG *child, unsigned split_bits) void PG::clear_backoffs() { dout(10) << __func__ << " " << dendl; - map,hobject_t::BitwiseComparator> ls; + map> ls; { Mutex::Locker l(backoff_lock); ls.swap(backoffs); @@ -2924,7 +2919,7 @@ void PG::init( if (backfill) { dout(10) << __func__ << ": Setting backfill" << dendl; - info.set_last_backfill(hobject_t(), get_sort_bitwise()); + info.set_last_backfill(hobject_t()); info.last_complete = info.last_update; pg_log.mark_log_for_rewrite(); } @@ -3264,7 +3259,7 @@ void PG::append_log( * here past last_backfill. It's ok for the same reason as * above */ if (transaction_applied && - (cmp(p->soid, info.last_backfill, get_sort_bitwise()) > 0)) { + p->soid > info.last_backfill) { pg_log.roll_forward(&handler); } } @@ -3518,9 +3513,9 @@ void PG::filter_snapc(vector &snaps) } } -void PG::requeue_object_waiters(map, hobject_t::BitwiseComparator>& m) +void PG::requeue_object_waiters(map>& m) { - for (map, hobject_t::BitwiseComparator>::iterator it = m.begin(); + for (map>::iterator it = m.begin(); it != m.end(); ++it) requeue_ops(it->second); @@ -3939,7 +3934,7 @@ void PG::_scan_rollback_obs( void PG::_scan_snaps(ScrubMap &smap) { - for (map::iterator i = smap.objects.begin(); + for (map::iterator i = smap.objects.begin(); i != smap.objects.end(); ++i) { const hobject_t &hoid = i->first; @@ -4324,8 +4319,6 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle) case PG::Scrubber::INACTIVE: dout(10) << "scrub start" << dendl; - scrubber.cleaned_meta_map.reset_bitwise(get_sort_bitwise()); - publish_stats_to_osd(); scrubber.epoch_start = info.history.same_interval_since; scrubber.active = true; @@ -4431,8 +4424,8 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle) for (auto p = projected_log.log.rbegin(); p != projected_log.log.rend(); ++p) { - if (cmp(p->soid, scrubber.start, get_sort_bitwise()) >= 0 && - cmp(p->soid, scrubber.end, get_sort_bitwise()) < 0) { + if (p->soid >= scrubber.start && + p->soid < scrubber.end) { scrubber.subset_last_update = p->version; break; } @@ -4442,8 +4435,8 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle) pg_log.get_log().log.rbegin(); p != pg_log.get_log().log.rend(); ++p) { - if (cmp(p->soid, scrubber.start, get_sort_bitwise()) >= 0 && - cmp(p->soid, scrubber.end, get_sort_bitwise()) < 0) { + if (p->soid >= scrubber.start && + p->soid < scrubber.end) { scrubber.subset_last_update = p->version; break; } @@ -4599,7 +4592,7 @@ void PG::scrub_compare_maps() // construct authoritative scrub map for type specific scrubbing scrubber.cleaned_meta_map.insert(scrubber.primary_scrubmap); - map, hobject_t::BitwiseComparator> missing_digest; + map> missing_digest; if (acting.size() > 1) { dout(10) << __func__ << " comparing replica scrub maps" << dendl; @@ -4607,7 +4600,7 @@ void PG::scrub_compare_maps() stringstream ss; // Map from object with errors to good peer - map, hobject_t::BitwiseComparator> authoritative; + map> authoritative; map maps; dout(2) << __func__ << " osd." << acting[0] << " has " @@ -4642,7 +4635,7 @@ void PG::scrub_compare_maps() osd->clog->error(ss); } - for (map, hobject_t::BitwiseComparator>::iterator i = authoritative.begin(); + for (map>::iterator i = authoritative.begin(); i != authoritative.end(); ++i) { list > good_peers; @@ -4657,7 +4650,7 @@ void PG::scrub_compare_maps() good_peers)); } - for (map, hobject_t::BitwiseComparator>::iterator i = authoritative.begin(); + for (map>::iterator i = authoritative.begin(); i != authoritative.end(); ++i) { scrubber.cleaned_meta_map.objects.erase(i->first); @@ -4667,7 +4660,7 @@ void PG::scrub_compare_maps() } } - ScrubMap for_meta_scrub(get_sort_bitwise()); + ScrubMap for_meta_scrub; if (scrubber.end.is_max() || scrubber.cleaned_meta_map.objects.empty()) { scrubber.cleaned_meta_map.swap(for_meta_scrub); @@ -4718,7 +4711,7 @@ bool PG::scrub_process_inconsistent() osd->clog->error(ss); if (repair) { state_clear(PG_STATE_CLEAN); - for (map >, hobject_t::BitwiseComparator>::iterator i = + for (map >>::iterator i = scrubber.authoritative.begin(); i != scrubber.authoritative.end(); ++i) { @@ -4947,7 +4940,6 @@ void PG::merge_new_log_entries( for (auto &&i: entries) { missing_loc.rebuild( i.soid, - get_sort_bitwise(), pg_whoami, actingbackfill, info, @@ -5332,7 +5324,7 @@ void PG::on_new_interval() upacting_features &= osdmap->get_xinfo(*p).features; } - do_sort_bitwise = osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE); + assert(osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE)); _on_new_interval(); } @@ -5444,9 +5436,6 @@ ostream& operator<<(ostream& out, const PG& pg) if (pg.scrubber.must_scrub) out << " MUST_SCRUB"; - if (!pg.get_sort_bitwise()) - out << " NIBBLEWISE"; - //out << " (" << pg.pg_log.get_tail() << "," << pg.pg_log.get_head() << "]"; if (pg.pg_log.get_missing().num_missing()) { out << " m=" << pg.pg_log.get_missing().num_missing(); diff --git a/src/osd/PG.h b/src/osd/PG.h index 07a674df79b4e..ab81b9a9696af 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -329,8 +329,8 @@ class PG : protected DoutPrefixProvider { ghobject_t pgmeta_oid; class MissingLoc { - map needs_recovery_map; - map, hobject_t::BitwiseComparator > missing_loc; + map needs_recovery_map; + map > missing_loc; set missing_loc_sources; PG *pg; set empty_set; @@ -349,7 +349,7 @@ class PG : protected DoutPrefixProvider { bool needs_recovery( const hobject_t &hoid, eversion_t *v = 0) const { - map::const_iterator i = + map::const_iterator i = needs_recovery_map.find(hoid); if (i == needs_recovery_map.end()) return false; @@ -367,7 +367,7 @@ class PG : protected DoutPrefixProvider { const set &acting) const; uint64_t num_unfound() const { uint64_t ret = 0; - for (map::const_iterator i = + for (map::const_iterator i = needs_recovery_map.begin(); i != needs_recovery_map.end(); ++i) { @@ -378,7 +378,7 @@ class PG : protected DoutPrefixProvider { } bool have_unfound() const { - for (map::const_iterator i = + for (map::const_iterator i = needs_recovery_map.begin(); i != needs_recovery_map.end(); ++i) { @@ -400,11 +400,11 @@ class PG : protected DoutPrefixProvider { missing_loc[hoid].erase(location); } void add_active_missing(const pg_missing_t &missing) { - for (map::const_iterator i = + for (map::const_iterator i = missing.get_items().begin(); i != missing.get_items().end(); ++i) { - map::const_iterator j = + map::const_iterator j = needs_recovery_map.find(i->first); if (j == needs_recovery_map.end()) { needs_recovery_map.insert(*i); @@ -427,7 +427,6 @@ class PG : protected DoutPrefixProvider { pg_shard_t source, ///< [in] source const pg_info_t &oinfo, ///< [in] info const pg_missing_t &omissing, ///< [in] (optional) missing - bool sort_bitwise, ///< [in] local sort bitwise (vs nibblewise) ThreadPool::TPHandle* handle ///< [in] ThreadPool handle ); ///< @return whether a new object location was discovered @@ -449,7 +448,6 @@ class PG : protected DoutPrefixProvider { /// Call to update structures for hoid after a change void rebuild( const hobject_t &hoid, - bool sort_bitwise, pg_shard_t self, const set to_recover, const pg_info_t &info, @@ -488,7 +486,7 @@ class PG : protected DoutPrefixProvider { auto pinfoiter = pinfo.find(i.first); assert(pinfoiter != pinfo.end()); if (item->need <= pinfoiter->second.last_update && - cmp(hoid, pinfoiter->second.last_backfill, sort_bitwise) <= 0 && + hoid <= pinfoiter->second.last_backfill && !i.second.is_missing(hoid)) mliter->second.insert(i.first); } @@ -498,10 +496,10 @@ class PG : protected DoutPrefixProvider { return missing_loc.count(hoid) ? missing_loc.find(hoid)->second : empty_set; } - const map, hobject_t::BitwiseComparator> &get_missing_locs() const { + const map> &get_missing_locs() const { return missing_loc; } - const map &get_needs_recovery() const { + const map &get_needs_recovery() const { return needs_recovery_map; } } missing_loc; @@ -519,7 +517,7 @@ class PG : protected DoutPrefixProvider { int recovery_ops_active; set waiting_on_backfill; #ifdef DEBUG_RECOVERY_OIDS - set recovering_oids; + set recovering_oids; #endif protected: @@ -726,31 +724,23 @@ class PG : protected DoutPrefixProvider { struct BackfillInterval { // info about a backfill interval on a peer eversion_t version; /// version at which the scan occurred - map objects; - bool sort_bitwise; + map objects; hobject_t begin; hobject_t end; - explicit BackfillInterval(bool bitwise=true) - : objects(hobject_t::Comparator(bitwise)), - sort_bitwise(bitwise) - {} - /// clear content - void clear(bool bitwise=true) { - *this = BackfillInterval(bitwise); + void clear() { + *this = BackfillInterval(); } /// clear objects list only void clear_objects() { - // make sure we preserve the allocator and ordering! - objects = map( - hobject_t::Comparator(sort_bitwise)); + objects.clear(); } /// reinstantiate with a new start+end position and sort order - void reset(hobject_t start, bool bitwise) { - clear(bitwise); + void reset(hobject_t start) { + clear(); begin = end = start; } @@ -768,7 +758,7 @@ class PG : protected DoutPrefixProvider { void trim_to(const hobject_t &soid) { trim(); while (!objects.empty() && - cmp(objects.begin()->first, soid, sort_bitwise) <= 0) { + objects.begin()->first <= soid) { pop_front(); } } @@ -793,7 +783,7 @@ class PG : protected DoutPrefixProvider { f->dump_stream("begin") << begin; f->dump_stream("end") << end; f->open_array_section("objects"); - for (map::const_iterator i = + for (map::const_iterator i = objects.begin(); i != objects.end(); ++i) { @@ -836,31 +826,23 @@ class PG : protected DoutPrefixProvider { list waiting_for_cache_not_full; list waiting_for_all_missing; - map, hobject_t::BitwiseComparator> waiting_for_unreadable_object, + map> waiting_for_unreadable_object, waiting_for_degraded_object, waiting_for_blocked_object; - set< - hobject_t, - hobject_t::BitwiseComparator> objects_blocked_on_cache_full; - map< - hobject_t, - snapid_t, - hobject_t::BitwiseComparator> objects_blocked_on_degraded_snap; - map< - hobject_t, - ObjectContextRef, - hobject_t::BitwiseComparator> objects_blocked_on_snap_promotion; + set objects_blocked_on_cache_full; + map objects_blocked_on_degraded_snap; + map objects_blocked_on_snap_promotion; // Callbacks should assume pg (and nothing else) is locked - map, hobject_t::BitwiseComparator> callbacks_for_degraded_object; + map> callbacks_for_degraded_object; map > > waiting_for_ondisk; void split_ops(PG *child, unsigned split_bits); - void requeue_object_waiters(map, hobject_t::BitwiseComparator>& m); + void requeue_object_waiters(map>& m); void requeue_op(OpRequestRef op); void requeue_ops(list &l); @@ -1086,7 +1068,7 @@ class PG : protected DoutPrefixProvider { // -- backoff -- Mutex backoff_lock; // orders inside Backoff::lock - map,hobject_t::BitwiseComparator> backoffs; + map> backoffs; void add_backoff(SessionRef s, const hobject_t& begin, const hobject_t& end); void release_backoffs(const hobject_t& begin, const hobject_t& end); @@ -1139,11 +1121,11 @@ class PG : protected DoutPrefixProvider { bool auto_repair; // Maps from objects with errors to missing/inconsistent peers - map, hobject_t::BitwiseComparator> missing; - map, hobject_t::BitwiseComparator> inconsistent; + map> missing; + map> inconsistent; // Map from object with errors to good peers - map >, hobject_t::BitwiseComparator> authoritative; + map >> authoritative; // Cleaned map pending snap metadata scrub ScrubMap cleaned_meta_map; @@ -1208,12 +1190,8 @@ class PG : protected DoutPrefixProvider { // classic (non chunk) scrubs block all writes // chunky scrubs only block writes to a range - bool write_blocked_by_scrub(const hobject_t &soid, bool sort_bitwise) { - if (cmp(soid, start, sort_bitwise) >= 0 && - cmp(soid, end, sort_bitwise) < 0) - return true; - - return false; + bool write_blocked_by_scrub(const hobject_t &soid) { + return (soid >= start && soid < end); } // clear all state @@ -1290,7 +1268,7 @@ class PG : protected DoutPrefixProvider { const hobject_t &begin, const hobject_t &end) = 0; virtual void scrub_snapshot_metadata( ScrubMap &map, - const std::map, hobject_t::BitwiseComparator> &missing_digest) { } + const std::map> &missing_digest) { } virtual void _scrub_clear_state() { } virtual void _scrub_finish() { } virtual void split_colls( @@ -2104,7 +2082,6 @@ class PG : protected DoutPrefixProvider { uint64_t acting_features; uint64_t upacting_features; - bool do_sort_bitwise; epoch_t last_epoch; public: @@ -2119,11 +2096,6 @@ class PG : protected DoutPrefixProvider { uint64_t get_min_acting_features() const { return acting_features; } uint64_t get_min_upacting_features() const { return upacting_features; } - /// true if we will sort hobjects bitwise for this pg interval - bool get_sort_bitwise() const { - return do_sort_bitwise; - } - void init_primary_up_acting( const vector &newup, const vector &newacting, diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 024657d8e4366..03adc47095bcc 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -174,7 +174,7 @@ void PGBackend::on_change_cleanup(ObjectStore::Transaction *t) { dout(10) << __func__ << dendl; // clear temp - for (set::iterator i = temp_contents.begin(); + for (set::iterator i = temp_contents.begin(); i != temp_contents.end(); ++i) { dout(10) << __func__ << ": Removing oid " @@ -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); @@ -626,7 +624,7 @@ map::const_iterator for (map::const_iterator j = maps.begin(); j != maps.end(); ++j) { - map::iterator i = + map::iterator i = j->second->objects.find(obj); if (i == j->second->objects.end()) { continue; @@ -717,19 +715,19 @@ map::const_iterator void PGBackend::be_compare_scrubmaps( const map &maps, bool repair, - map, hobject_t::BitwiseComparator> &missing, - map, hobject_t::BitwiseComparator> &inconsistent, - map, hobject_t::BitwiseComparator> &authoritative, - map, hobject_t::BitwiseComparator> &missing_digest, + map> &missing, + map> &inconsistent, + map> &authoritative, + map> &missing_digest, int &shallow_errors, int &deep_errors, Scrub::Store *store, const spg_t& pgid, const vector &acting, ostream &errorstream) { - map::const_iterator i; - map::const_iterator j; - set master_set; + map::const_iterator i; + map::const_iterator j; + set master_set; utime_t now = ceph_clock_now(); // Construct master set @@ -740,7 +738,7 @@ void PGBackend::be_compare_scrubmaps( } // Check maps against master set and each other - for (set::const_iterator k = master_set.begin(); + for (set::const_iterator k = master_set.begin(); k != master_set.end(); ++k) { object_info_t auth_oi; diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index b932ad31595e8..2470d377f2ca1 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -140,7 +140,7 @@ typedef ceph::shared_ptr OSDMapRef; virtual std::string gen_dbg_prefix() const = 0; - virtual const map, hobject_t::BitwiseComparator> &get_missing_loc_shards() + virtual const map> &get_missing_loc_shards() const = 0; virtual const pg_missing_tracker_t &get_local_missing() const = 0; @@ -243,7 +243,6 @@ typedef ceph::shared_ptr OSDMapRef; virtual pg_shard_t primary_shard() const = 0; virtual uint64_t min_peer_features() const = 0; - virtual bool sort_bitwise() const = 0; virtual hobject_t get_temp_recovery_object(eversion_t version, snapid_t snap) = 0; @@ -369,20 +368,20 @@ typedef ceph::shared_ptr OSDMapRef; virtual void dump_recovery_info(Formatter *f) const = 0; private: - set temp_contents; + set temp_contents; public: // Track contents of temp collection, clear on reset void add_temp_obj(const hobject_t &oid) { temp_contents.insert(oid); } - void add_temp_objs(const set &oids) { + void add_temp_objs(const set &oids) { temp_contents.insert(oids.begin(), oids.end()); } void clear_temp_obj(const hobject_t &oid) { temp_contents.erase(oid); } - void clear_temp_objs(const set &oids) { - for (set::const_iterator i = oids.begin(); + void clear_temp_objs(const set &oids) { + for (set::const_iterator i = oids.begin(); i != oids.end(); ++i) { temp_contents.erase(*i); @@ -540,10 +539,10 @@ typedef ceph::shared_ptr OSDMapRef; void be_compare_scrubmaps( const map &maps, bool repair, - map, hobject_t::BitwiseComparator> &missing, - map, hobject_t::BitwiseComparator> &inconsistent, - map, hobject_t::BitwiseComparator> &authoritative, - map, hobject_t::BitwiseComparator> &missing_digest, + map> &missing, + map> &inconsistent, + map> &authoritative, + map> &missing_digest, int &shallow_errors, int &deep_errors, Scrub::Store *store, const spg_t& pgid, diff --git a/src/osd/PGLog.cc b/src/osd/PGLog.cc index 99ca4ef054a56..cba1a5244593c 100644 --- a/src/osd/PGLog.cc +++ b/src/osd/PGLog.cc @@ -157,7 +157,7 @@ void PGLog::proc_replica_log( we will send the peer enough log to arrive at the same state. */ - for (map::const_iterator i = omissing.get_items().begin(); + for (map::const_iterator i = omissing.get_items().begin(); i != omissing.get_items().end(); ++i) { dout(20) << " before missing " << i->first << " need " << i->second.need @@ -285,7 +285,7 @@ void PGLog::merge_log(ObjectStore::Transaction& t, // The logs must overlap. assert(log.head >= olog.tail && olog.head >= log.tail); - for (map::const_iterator i = missing.get_items().begin(); + for (map::const_iterator i = missing.get_items().begin(); i != missing.get_items().end(); ++i) { dout(20) << "pg_missing_t sobject: " << i->first << dendl; diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 713d3d8ce3562..2d44c64810643 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -573,10 +573,6 @@ struct PGLog : DoutPrefixProvider { //////////////////// get or set missing //////////////////// const pg_missing_tracker_t& get_missing() const { return missing; } - void resort_missing(bool sort_bitwise) { - missing.resort(sort_bitwise); - } - void revise_have(hobject_t oid, eversion_t have) { missing.revise_have(oid, have); } @@ -712,7 +708,7 @@ struct PGLog : DoutPrefixProvider { protected: static void split_by_object( mempool::osd::list &entries, - map, hobject_t::BitwiseComparator> *out_entries) { + map> *out_entries) { while (!entries.empty()) { mempool::osd::list &out_list = (*out_entries)[entries.front().soid]; out_list.splice(out_list.end(), entries, entries.begin()); @@ -753,7 +749,7 @@ struct PGLog : DoutPrefixProvider { ldpp_dout(dpp, 20) << __func__ << ": merging hoid " << hoid << " entries: " << entries << dendl; - if (cmp(hoid, info.last_backfill, info.last_backfill_bitwise) > 0) { + if (hoid > info.last_backfill) { ldpp_dout(dpp, 10) << __func__ << ": hoid " << hoid << " after last_backfill" << dendl; return; @@ -932,9 +928,9 @@ struct PGLog : DoutPrefixProvider { LogEntryHandler *rollbacker, ///< [in] optional rollbacker object const DoutPrefixProvider *dpp ///< [in] logging provider ) { - map, hobject_t::BitwiseComparator > split; + map > split; split_by_object(entries, &split); - for (map, hobject_t::BitwiseComparator>::iterator i = split.begin(); + for (map>::iterator i = split.begin(); i != split.end(); ++i) { _merge_object_divergent_entries( @@ -1002,7 +998,7 @@ struct PGLog : DoutPrefixProvider { ldpp_dout(dpp, 20) << "update missing, append " << *p << dendl; log->add(*p); } - if (cmp(p->soid, last_backfill, last_backfill_bitwise) <= 0 && + if (p->soid <= last_backfill && !p->is_error()) { missing.add_next_event(*p); if (rollbacker) { @@ -1185,14 +1181,14 @@ struct PGLog : DoutPrefixProvider { << info.last_complete << "," << info.last_update << "]" << dendl; - set did; - set checked; - set skipped; + set did; + set checked; + set skipped; for (list::reverse_iterator i = log.log.rbegin(); i != log.log.rend(); ++i) { if (!debug_verify_stored_missing && i->version <= info.last_complete) break; - if (cmp(i->soid, info.last_backfill, info.last_backfill_bitwise) > 0) + if (i->soid > info.last_backfill) continue; if (i->is_error()) continue; @@ -1240,7 +1236,7 @@ struct PGLog : DoutPrefixProvider { if (checked.count(i.first)) continue; if (i.second.need > log.tail || - cmp(i.first, info.last_backfill, info.last_backfill_bitwise) > 0) { + i.first > info.last_backfill) { lderr(dpp->get_cct()) << __func__ << ": invalid missing set entry found " << i.first << dendl; @@ -1266,7 +1262,7 @@ struct PGLog : DoutPrefixProvider { i != divergent_priors.rend(); ++i) { if (i->first <= info.last_complete) break; - if (cmp(i->second, info.last_backfill, info.last_backfill_bitwise) > 0) + if (i->second > info.last_backfill) continue; if (did.count(i->second)) continue; did.insert(i->second); diff --git a/src/osd/PGTransaction.h b/src/osd/PGTransaction.h index 5b8f721c8a58e..2e1013bca86a2 100644 --- a/src/osd/PGTransaction.h +++ b/src/osd/PGTransaction.h @@ -36,7 +36,7 @@ */ class PGTransaction { public: - map obc_map; + map obc_map; class ObjectOperation { public: @@ -245,7 +245,7 @@ class PGTransaction { friend class PGTransaction; }; - map op_map; + map op_map; private: ObjectOperation &get_object_op_for_modify(const hobject_t &hoid) { auto &op = op_map[hoid]; @@ -523,7 +523,7 @@ class PGTransaction { */ template void safe_create_traverse(T &&t) { - map, hobject_t::BitwiseComparator> dgraph; + map> dgraph; list stack; // Populate stack with roots, dgraph with edges diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 35a8c1997424d..977a0dbca8d38 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -437,7 +437,7 @@ void PrimaryLogPG::on_global_recover( missing_loc.recovered(soid); publish_stats_to_osd(); dout(10) << "pushed " << soid << " to all replicas" << dendl; - map::iterator i = recovering.find(soid); + map::iterator i = recovering.find(soid); assert(i != recovering.end()); // recover missing won't have had an obc, but it gets filled in @@ -537,7 +537,7 @@ void PrimaryLogPG::maybe_kick_recovery( if (!missing_loc.needs_recovery(soid, &v)) return; - map::const_iterator p = recovering.find(soid); + map::const_iterator p = recovering.find(soid); if (p != recovering.end()) { dout(7) << "object " << soid << " v " << v << ", already recovering." << dendl; } else if (missing_loc.is_unfound(soid)) { @@ -593,8 +593,8 @@ bool PrimaryLogPG::is_degraded_or_backfilling_object(const hobject_t& soid) // Object is degraded if after last_backfill AND // we are backfilling it if (is_backfill_targets(peer) && - cmp(peer_info[peer].last_backfill, soid, get_sort_bitwise()) <= 0 && - cmp(last_backfill_started, soid, get_sort_bitwise()) >= 0 && + peer_info[peer].last_backfill <= soid && + last_backfill_started >= soid && backfills_in_flight.count(soid)) return true; } @@ -979,9 +979,9 @@ int PrimaryLogPG::do_command( } f->dump_int("num_missing", missing.num_missing()); f->dump_int("num_unfound", get_num_unfound()); - const map &needs_recovery_map = + const map &needs_recovery_map = missing_loc.get_needs_recovery(); - map::const_iterator p = + map::const_iterator p = needs_recovery_map.upper_bound(offset); { f->open_array_section("objects"); @@ -1108,11 +1108,8 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) hobject_t pg_end = info.pgid.pgid.get_hobj_end(pool.info.get_pg_num()); dout(10) << " pgnls lower_bound " << lower_bound << " pg_end " << pg_end << dendl; - if (get_sort_bitwise() && - ((!lower_bound.is_max() && - cmp_bitwise(lower_bound, pg_end) >= 0) || - (lower_bound != hobject_t() && - cmp_bitwise(lower_bound, pg_start) < 0))) { + if (((!lower_bound.is_max() && lower_bound >= pg_end) || + (lower_bound != hobject_t() && lower_bound < pg_start))) { // this should only happen with a buggy client. dout(10) << "outside of PG bounds " << pg_start << " .. " << pg_end << dendl; @@ -1135,10 +1132,7 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) assert(snapid == CEPH_NOSNAP || pg_log.get_missing().get_items().empty()); - // ensure sort order is correct - pg_log.resort_missing(get_sort_bitwise()); - - map::const_iterator missing_iter = + map::const_iterator missing_iter = pg_log.get_missing().get_items().lower_bound(current); vector::iterator ls_iter = sentries.begin(); hobject_t _max = hobject_t::get_max(); @@ -1159,7 +1153,7 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) ++ls_iter; ++missing_iter; } - } else if (cmp(mcand, lcand, get_sort_bitwise()) < 0) { + } else if (mcand < lcand) { candidate = mcand; assert(!mcand.is_max()); ++missing_iter; @@ -1172,7 +1166,7 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) dout(10) << " pgnls candidate 0x" << std::hex << candidate.get_hash() << " vs lower bound 0x" << lower_bound.get_hash() << dendl; - if (cmp(candidate, next, get_sort_bitwise()) >= 0) { + if (candidate >= next) { break; } @@ -1241,15 +1235,9 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) ls_iter == sentries.end()) { result = 1; - if (get_osdmap()->test_flag(CEPH_OSDMAP_SORTBITWISE)) { - // Set response.handle to the start of the next PG - // according to the object sort order. Only do this if - // the cluster is in bitwise mode; with legacy nibblewise - // sort PGs don't always cover contiguous ranges of the - // hash order. - response.handle = info.pgid.pgid.get_hobj_end( - pool.info.get_pg_num()); - } + // Set response.handle to the start of the next PG according + // to the object sort order. + response.handle = info.pgid.pgid.get_hobj_end(pool.info.get_pg_num()); } else { response.handle = next; } @@ -1322,10 +1310,7 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) assert(snapid == CEPH_NOSNAP || pg_log.get_missing().get_items().empty()); - // ensure sort order is correct - pg_log.resort_missing(get_sort_bitwise()); - - map::const_iterator missing_iter = + map::const_iterator missing_iter = pg_log.get_missing().get_items().lower_bound(current); vector::iterator ls_iter = sentries.begin(); hobject_t _max = hobject_t::get_max(); @@ -1346,7 +1331,7 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) ++ls_iter; ++missing_iter; } - } else if (cmp(mcand, lcand, get_sort_bitwise()) < 0) { + } else if (mcand < lcand) { candidate = mcand; assert(!mcand.is_max()); ++missing_iter; @@ -1356,7 +1341,7 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) ++ls_iter; } - if (cmp(candidate, next, get_sort_bitwise()) >= 0) { + if (candidate >= next) { break; } @@ -1581,8 +1566,6 @@ PrimaryLogPG::PrimaryLogPG(OSDService *o, OSDMapRef curmap, _pool.info, curmap, this, coll_t(p), ch, o->store, cct)), object_contexts(o->cct, o->cct->_conf->osd_pg_object_context_cache_count), snapset_contexts_lock("PrimaryLogPG::snapset_contexts_lock"), - backfills_in_flight(hobject_t::Comparator(true)), - pending_backfill_updates(hobject_t::Comparator(true)), new_backfill(false), temp_seq(0), snap_trimmer_machine(this) @@ -1609,10 +1592,10 @@ void PrimaryLogPG::handle_backoff(OpRequestRef& op) session->put(); // get_priv takes a ref, and so does the SessionRef hobject_t begin = info.pgid.pgid.get_hobj_start(); hobject_t end = info.pgid.pgid.get_hobj_end(pool.info.get_pg_num()); - if (cmp_bitwise(begin, m->begin) < 0) { + if (begin < m->begin) { begin = m->begin; } - if (cmp_bitwise(end, m->end) > 0) { + if (end > m->end) { end = m->end; } dout(10) << __func__ << " backoff ack id " << m->id @@ -1763,7 +1746,7 @@ hobject_t PrimaryLogPG::earliest_backfill() const pg_shard_t bt = *i; map::const_iterator iter = peer_info.find(bt); assert(iter != peer_info.end()); - if (cmp(iter->second.last_backfill, e, get_sort_bitwise()) < 0) + if (iter->second.last_backfill < e) e = iter->second.last_backfill; } return e; @@ -1974,7 +1957,7 @@ void PrimaryLogPG::do_op(OpRequestRef& op) } if (write_ordered && - scrubber.write_blocked_by_scrub(head, get_sort_bitwise())) { + scrubber.write_blocked_by_scrub(head)) { dout(20) << __func__ << ": waiting for scrub" << dendl; waiting_for_scrub.push_back(op); op->mark_delayed("waiting for scrub"); @@ -2207,7 +2190,7 @@ void PrimaryLogPG::do_op(OpRequestRef& op) // verify there is in fact a flush in progress // FIXME: we could make this a stronger test. - map::iterator p = flush_ops.find(obc->obs.oi.soid); + map::iterator p = flush_ops.find(obc->obs.oi.soid); if (p == flush_ops.end()) { dout(10) << __func__ << " no flush in progress, aborting" << dendl; reply_ctx(ctx, -EINVAL); @@ -2721,7 +2704,7 @@ void PrimaryLogPG::finish_proxy_read(hobject_t oid, ceph_tid_t tid, int r) } proxyread_ops.erase(tid); - map, hobject_t::BitwiseComparator>::iterator q = in_progress_proxy_ops.find(oid); + map>::iterator q = in_progress_proxy_ops.find(oid); if (q == in_progress_proxy_ops.end()) { dout(10) << __func__ << " no in_progress_proxy_ops found" << dendl; return; @@ -2750,7 +2733,7 @@ void PrimaryLogPG::finish_proxy_read(hobject_t oid, ceph_tid_t tid, int r) void PrimaryLogPG::kick_proxy_ops_blocked(hobject_t& soid) { - map, hobject_t::BitwiseComparator>::iterator p = in_progress_proxy_ops.find(soid); + map>::iterator p = in_progress_proxy_ops.find(soid); if (p == in_progress_proxy_ops.end()) return; @@ -2793,7 +2776,7 @@ void PrimaryLogPG::cancel_proxy_ops(bool requeue) } if (requeue) { - map, hobject_t::BitwiseComparator>::iterator p = + map>::iterator p = in_progress_proxy_ops.begin(); while (p != in_progress_proxy_ops.end()) { list& ls = p->second; @@ -2982,7 +2965,7 @@ void PrimaryLogPG::promote_object(ObjectContextRef obc, { hobject_t hoid = obc ? obc->obs.oi.soid : missing_oid; assert(hoid != hobject_t()); - if (scrubber.write_blocked_by_scrub(hoid, get_sort_bitwise())) { + if (scrubber.write_blocked_by_scrub(hoid)) { dout(10) << __func__ << " " << hoid << " blocked by scrub" << dendl; if (op) { @@ -3008,7 +2991,7 @@ void PrimaryLogPG::promote_object(ObjectContextRef obc, * for this case we don't use DONTNEED. */ unsigned src_fadvise_flags = LIBRADOS_OP_FLAG_FADVISE_SEQUENTIAL; - map, hobject_t::BitwiseComparator>::iterator q = in_progress_proxy_ops.find(obc->obs.oi.soid); + map>::iterator q = in_progress_proxy_ops.find(obc->obs.oi.soid); if (q == in_progress_proxy_ops.end()) { src_fadvise_flags |= LIBRADOS_OP_FLAG_FADVISE_DONTNEED; } @@ -3477,7 +3460,7 @@ void PrimaryLogPG::do_backfill(OpRequestRef op) { assert(cct->_conf->osd_kill_backfill_at != 2); - info.set_last_backfill(m->last_backfill, get_sort_bitwise()); + info.set_last_backfill(m->last_backfill); if (m->compat_stat_sum) { info.stats.stats = m->stats.stats; // Previously, we only sent sum } else { @@ -6896,14 +6879,14 @@ void PrimaryLogPG::apply_stats( ++i) { pg_shard_t bt = *i; pg_info_t& pinfo = peer_info[bt]; - if (cmp(soid, pinfo.last_backfill, get_sort_bitwise()) <= 0) + if (soid <= pinfo.last_backfill) pinfo.stats.stats.add(delta_stats); - else if (cmp(soid, last_backfill_started, get_sort_bitwise()) <= 0) + else if (soid <= last_backfill_started) pending_backfill_updates[soid].stats.add(delta_stats); } if (is_primary() && scrubber.active) { - if (cmp(soid, scrubber.start, get_sort_bitwise()) < 0) { + if (soid < scrubber.start) { scrub_cstat.add(delta_stats); } } @@ -7291,7 +7274,7 @@ void PrimaryLogPG::process_copy_chunk(hobject_t oid, ceph_tid_t tid, int r) { dout(10) << __func__ << " " << oid << " tid " << tid << " " << cpp_strerror(r) << dendl; - map::iterator p = copy_ops.find(oid); + map::iterator p = copy_ops.find(oid); if (p == copy_ops.end()) { dout(10) << __func__ << " no copy_op found" << dendl; return; @@ -7719,7 +7702,7 @@ void PrimaryLogPG::finish_promote(int r, CopyResults *results, // pass error to everyone blocked on this object // FIXME: this is pretty sloppy, but at this point we got // something unexpected and don't have many other options. - map, hobject_t::BitwiseComparator>::iterator blocked_iter = + map>::iterator blocked_iter = waiting_for_blocked_object.find(soid); if (blocked_iter != waiting_for_blocked_object.end()) { while (!blocked_iter->second.empty()) { @@ -7844,7 +7827,7 @@ void PrimaryLogPG::cancel_copy(CopyOpRef cop, bool requeue) void PrimaryLogPG::cancel_copy_ops(bool requeue) { dout(10) << __func__ << dendl; - map::iterator p = copy_ops.begin(); + map::iterator p = copy_ops.begin(); while (p != copy_ops.end()) { // requeue this op? can I queue up all of them? cancel_copy((p++)->second, requeue); @@ -7956,7 +7939,7 @@ int PrimaryLogPG::start_flush( if (blocking) obc->start_block(); - map::iterator p = flush_ops.find(soid); + map::iterator p = flush_ops.find(soid); if (p != flush_ops.end()) { FlushOpRef fop = p->second; if (fop->op == op) { @@ -8108,7 +8091,7 @@ void PrimaryLogPG::finish_flush(hobject_t oid, ceph_tid_t tid, int r) { dout(10) << __func__ << " " << oid << " tid " << tid << " " << cpp_strerror(r) << dendl; - map::iterator p = flush_ops.find(oid); + map::iterator p = flush_ops.find(oid); if (p == flush_ops.end()) { dout(10) << __func__ << " no flush_op found" << dendl; return; @@ -8184,7 +8167,7 @@ int PrimaryLogPG::try_flush_mark_clean(FlushOpRef fop) } if (!fop->blocking && - scrubber.write_blocked_by_scrub(oid, get_sort_bitwise())) { + scrubber.write_blocked_by_scrub(oid)) { if (fop->op) { dout(10) << __func__ << " blocked by scrub" << dendl; requeue_op(fop->op); @@ -8298,7 +8281,7 @@ void PrimaryLogPG::cancel_flush(FlushOpRef fop, bool requeue) void PrimaryLogPG::cancel_flush_ops(bool requeue) { dout(10) << __func__ << dendl; - map::iterator p = flush_ops.begin(); + map::iterator p = flush_ops.begin(); while (p != flush_ops.end()) { cancel_flush((p++)->second, requeue); } @@ -8899,7 +8882,7 @@ void PrimaryLogPG::handle_watch_timeout(WatchRef watch) return; } - if (scrubber.write_blocked_by_scrub(obc->obs.oi.soid, get_sort_bitwise())) { + if (scrubber.write_blocked_by_scrub(obc->obs.oi.soid)) { dout(10) << "handle_watch_timeout waiting for scrub on obj " << obc->obs.oi.soid << dendl; @@ -9357,7 +9340,7 @@ void PrimaryLogPG::kick_object_context_blocked(ObjectContextRef obc) return; } - map, hobject_t::BitwiseComparator>::iterator p = waiting_for_blocked_object.find(soid); + map>::iterator p = waiting_for_blocked_object.find(soid); if (p != waiting_for_blocked_object.end()) { list& ls = p->second; dout(10) << __func__ << " " << soid << " requeuing " << ls.size() << " requests" << dendl; @@ -9386,7 +9369,7 @@ SnapSetContext *PrimaryLogPG::get_snapset_context( { Mutex::Locker l(snapset_contexts_lock); SnapSetContext *ssc; - map::iterator p = snapset_contexts.find( + map::iterator p = snapset_contexts.find( oid.get_snapdir()); if (p != snapset_contexts.end()) { if (can_create || p->second->exists) { @@ -9805,9 +9788,9 @@ void PrimaryLogPG::mark_all_unfound_lost( mempool::osd::list log_entries; utime_t mtime = ceph_clock_now(); - map::const_iterator m = + map::const_iterator m = missing_loc.get_needs_recovery().begin(); - map::const_iterator mend = + map::const_iterator mend = missing_loc.get_needs_recovery().end(); ObcLockManager manager; @@ -9996,7 +9979,7 @@ void PrimaryLogPG::on_removal(ObjectStore::Transaction *t) dout(10) << "on_removal" << dendl; // adjust info to backfill - info.set_last_backfill(hobject_t(), true); + info.set_last_backfill(hobject_t()); pg_log.reset_backfill(); dirty_info = true; @@ -10096,12 +10079,6 @@ void PrimaryLogPG::on_activate() void PrimaryLogPG::_on_new_interval() { - // re-sort obc map? - if (object_contexts.get_comparator().bitwise != get_sort_bitwise()) { - dout(20) << __func__ << " resorting object_contexts" << dendl; - object_contexts.reset_comparator( - hobject_t::ComparatorWithDefault(get_sort_bitwise())); - } } void PrimaryLogPG::on_change(ObjectStore::Transaction *t) @@ -10138,7 +10115,7 @@ void PrimaryLogPG::on_change(ObjectStore::Transaction *t) } else { waiting_for_unreadable_object.clear(); } - for (map, hobject_t::BitwiseComparator>::iterator p = waiting_for_degraded_object.begin(); + for (map>::iterator p = waiting_for_degraded_object.begin(); p != waiting_for_degraded_object.end(); waiting_for_degraded_object.erase(p++)) { release_backoffs(p->first); @@ -10152,7 +10129,7 @@ void PrimaryLogPG::on_change(ObjectStore::Transaction *t) // requeues waiting_for_scrub scrub_clear_state(); - for (map, hobject_t::BitwiseComparator>::iterator p = waiting_for_blocked_object.begin(); + for (auto p = waiting_for_blocked_object.begin(); p != waiting_for_blocked_object.end(); waiting_for_blocked_object.erase(p++)) { if (is_primary()) @@ -10160,8 +10137,7 @@ void PrimaryLogPG::on_change(ObjectStore::Transaction *t) else p->second.clear(); } - for (map, hobject_t::BitwiseComparator>::iterator i = - callbacks_for_degraded_object.begin(); + for (auto i = callbacks_for_degraded_object.begin(); i != callbacks_for_degraded_object.end(); ) { finish_degraded_object((i++)->first); @@ -10250,14 +10226,14 @@ void PrimaryLogPG::_clear_recovery_state() recovering_oids.clear(); #endif last_backfill_started = hobject_t(); - set::iterator i = backfills_in_flight.begin(); + set::iterator i = backfills_in_flight.begin(); while (i != backfills_in_flight.end()) { assert(recovering.count(*i)); backfills_in_flight.erase(i++); } list blocked_ops; - for (map::iterator i = recovering.begin(); + for (map::iterator i = recovering.begin(); i != recovering.end(); recovering.erase(i++)) { if (i->second) { @@ -10353,7 +10329,7 @@ void PG::MissingLoc::check_recovery_sources(const OSDMapRef& osdmap) << missing_loc_sources << dendl; // filter missing_loc - map, hobject_t::BitwiseComparator>::iterator p = missing_loc.begin(); + map>::iterator p = missing_loc.begin(); while (p != missing_loc.end()) { set::iterator q = p->second.begin(); while (q != p->second.end()) @@ -10770,7 +10746,7 @@ uint64_t PrimaryLogPG::recover_replicas(uint64_t max, ThreadPool::TPHandle &hand handle.reset_tp_timeout(); const hobject_t soid(p->second); - if (cmp(soid, pi->second.last_backfill, get_sort_bitwise()) > 0) { + if (soid > pi->second.last_backfill) { if (!recovering.count(soid)) { derr << __func__ << ": object added to missing set for backfill, but " << "is not in recovering, error!" << dendl; @@ -10807,7 +10783,7 @@ uint64_t PrimaryLogPG::recover_replicas(uint64_t max, ThreadPool::TPHandle &hand } dout(10) << __func__ << ": recover_object_replicas(" << soid << ")" << dendl; - map::const_iterator r = m.get_items().find(soid); + map::const_iterator r = m.get_items().find(soid); started += prep_object_replica_pushes(soid, r->second.need, h); } @@ -10827,7 +10803,7 @@ hobject_t PrimaryLogPG::earliest_peer_backfill() const map::const_iterator iter = peer_backfill_info.find(peer); assert(iter != peer_backfill_info.end()); - if (cmp(iter->second.begin, e, get_sort_bitwise()) < 0) + if (iter->second.begin < e) e = iter->second.begin; } return e; @@ -10888,7 +10864,6 @@ uint64_t PrimaryLogPG::recover_backfill( dout(10) << "recover_backfill (" << max << ")" << " bft=" << backfill_targets << " last_backfill_started " << last_backfill_started - << " sort " << (get_sort_bitwise() ? "bitwise" : "nibblewise") << (new_backfill ? " new_backfill":"") << dendl; assert(!backfill_targets.empty()); @@ -10899,34 +10874,17 @@ uint64_t PrimaryLogPG::recover_backfill( assert(last_backfill_started == earliest_backfill()); new_backfill = false; - // initialize BackfillIntervals (with proper sort order) + // initialize BackfillIntervals for (set::iterator i = backfill_targets.begin(); i != backfill_targets.end(); ++i) { - peer_backfill_info[*i].reset(peer_info[*i].last_backfill, - get_sort_bitwise()); + peer_backfill_info[*i].reset(peer_info[*i].last_backfill); } - backfill_info.reset(last_backfill_started, - get_sort_bitwise()); + backfill_info.reset(last_backfill_started); - // initialize comparators - backfills_in_flight = set( - hobject_t::Comparator(get_sort_bitwise())); - pending_backfill_updates = map( - hobject_t::Comparator(get_sort_bitwise())); - } - - // sanity check sort orders - assert(backfill_info.sort_bitwise == get_sort_bitwise()); - for (map::iterator i = - peer_backfill_info.begin(); - i != peer_backfill_info.end(); - ++i) { - assert(i->second.sort_bitwise == get_sort_bitwise()); - assert(i->second.objects.key_comp().bitwise == get_sort_bitwise()); + backfills_in_flight.clear(); + pending_backfill_updates.clear(); } - assert(backfills_in_flight.key_comp().bitwise == get_sort_bitwise()); - assert(pending_backfill_updates.key_comp().bitwise == get_sort_bitwise()); for (set::iterator i = backfill_targets.begin(); i != backfill_targets.end(); @@ -10947,23 +10905,21 @@ uint64_t PrimaryLogPG::recover_backfill( vector > > to_push; vector > to_remove; - set add_to_stat; + set add_to_stat; for (set::iterator i = backfill_targets.begin(); i != backfill_targets.end(); ++i) { peer_backfill_info[*i].trim_to( - MAX_HOBJ(peer_info[*i].last_backfill, last_backfill_started, - get_sort_bitwise())); + std::max(peer_info[*i].last_backfill, last_backfill_started)); } backfill_info.trim_to(last_backfill_started); while (ops < max) { - if (cmp(backfill_info.begin, earliest_peer_backfill(), - get_sort_bitwise()) <= 0 && + if (backfill_info.begin <= earliest_peer_backfill() && !backfill_info.extends_to_end() && backfill_info.empty()) { hobject_t next = backfill_info.end; - backfill_info.reset(next, get_sort_bitwise()); + backfill_info.reset(next); backfill_info.end = hobject_t::get_max(); update_range(&backfill_info, handle); backfill_info.trim(); @@ -10979,7 +10935,7 @@ uint64_t PrimaryLogPG::recover_backfill( BackfillInterval& pbi = peer_backfill_info[bt]; dout(20) << " peer shard " << bt << " backfill " << pbi << dendl; - if (cmp(pbi.begin, backfill_info.begin, get_sort_bitwise()) <= 0 && + if (pbi.begin <= backfill_info.begin && !pbi.extends_to_end() && pbi.empty()) { dout(10) << " scanning peer osd." << bt << " from " << pbi.end << dendl; epoch_t e = get_osdmap()->get_epoch(); @@ -11010,7 +10966,7 @@ uint64_t PrimaryLogPG::recover_backfill( // the set of targets for which that object applies. hobject_t check = earliest_peer_backfill(); - if (cmp(check, backfill_info.begin, get_sort_bitwise()) < 0) { + if (check < backfill_info.begin) { set check_targets; for (set::iterator i = backfill_targets.begin(); @@ -11107,8 +11063,7 @@ uint64_t PrimaryLogPG::recover_backfill( // Only include peers that we've caught up to their backfill line // otherwise, they only appear to be missing this object // because their pbi.begin > backfill_info.begin. - if (cmp(backfill_info.begin, pinfo.last_backfill, - get_sort_bitwise()) > 0) + if (backfill_info.begin > pinfo.last_backfill) missing_targs.push_back(bt); else skip_targs.push_back(bt); @@ -11172,10 +11127,10 @@ uint64_t PrimaryLogPG::recover_backfill( } } - hobject_t backfill_pos = MIN_HOBJ(backfill_info.begin, earliest_peer_backfill(), - get_sort_bitwise()); + hobject_t backfill_pos = + std::min(backfill_info.begin, earliest_peer_backfill()); - for (set::iterator i = add_to_stat.begin(); + for (set::iterator i = add_to_stat.begin(); i != add_to_stat.end(); ++i) { ObjectContextRef obc = get_object_context(*i, false); @@ -11190,8 +11145,7 @@ uint64_t PrimaryLogPG::recover_backfill( // ordered before any subsequent updates send_remove_op(to_remove[i].get<0>(), to_remove[i].get<1>(), to_remove[i].get<2>()); - if (cmp(to_remove[i].get<0>(), last_backfill_started, - get_sort_bitwise()) <= 0) + if (to_remove[i].get<0>() <= last_backfill_started) pending_backfill_updates[to_remove[i].get<0>()]; // add empty stat! } @@ -11204,7 +11158,7 @@ uint64_t PrimaryLogPG::recover_backfill( pgbackend->run_recovery_op(h, get_recovery_op_priority()); dout(5) << "backfill_pos is " << backfill_pos << dendl; - for (set::iterator i = backfills_in_flight.begin(); + for (set::iterator i = backfills_in_flight.begin(); i != backfills_in_flight.end(); ++i) { dout(20) << *i << " is still in flight" << dendl; @@ -11214,20 +11168,20 @@ uint64_t PrimaryLogPG::recover_backfill( backfill_pos : *(backfills_in_flight.begin()); hobject_t new_last_backfill = earliest_backfill(); dout(10) << "starting new_last_backfill at " << new_last_backfill << dendl; - for (map::iterator i = + for (map::iterator i = pending_backfill_updates.begin(); i != pending_backfill_updates.end() && - cmp(i->first, next_backfill_to_complete, get_sort_bitwise()) < 0; + i->first < next_backfill_to_complete; pending_backfill_updates.erase(i++)) { dout(20) << " pending_backfill_update " << i->first << dendl; - assert(cmp(i->first, new_last_backfill, get_sort_bitwise()) > 0); + assert(i->first > new_last_backfill); for (set::iterator j = backfill_targets.begin(); j != backfill_targets.end(); ++j) { pg_shard_t bt = *j; pg_info_t& pinfo = peer_info[bt]; //Add stats to all peers that were missing object - if (cmp(i->first, pinfo.last_backfill, get_sort_bitwise()) > 0) + if (i->first > pinfo.last_backfill) pinfo.stats.add(i->second); } new_last_backfill = i->first; @@ -11253,8 +11207,8 @@ uint64_t PrimaryLogPG::recover_backfill( pg_shard_t bt = *i; pg_info_t& pinfo = peer_info[bt]; - if (cmp(new_last_backfill, pinfo.last_backfill, get_sort_bitwise()) > 0) { - pinfo.set_last_backfill(new_last_backfill, get_sort_bitwise()); + if (new_last_backfill > pinfo.last_backfill) { + pinfo.set_last_backfill(new_last_backfill); epoch_t e = get_osdmap()->get_epoch(); MOSDPGBackfill *m = NULL; if (pinfo.last_backfill.is_max()) { @@ -11365,8 +11319,8 @@ void PrimaryLogPG::update_range( dout(10) << __func__ << ": updating from version " << e.version << dendl; const hobject_t &soid = e.soid; - if (cmp(soid, bi->begin, get_sort_bitwise()) >= 0 && - cmp(soid, bi->end, get_sort_bitwise()) < 0) { + if (soid >= bi->begin && + soid < bi->end) { if (e.is_update()) { dout(10) << __func__ << ": " << e.soid << " updated to version " << e.version << dendl; @@ -11448,7 +11402,7 @@ void PrimaryLogPG::check_local() return; // just scan the log. - set did; + set did; for (list::const_reverse_iterator p = pg_log.get_log().log.rbegin(); p != pg_log.get_log().log.rend(); ++p) { @@ -11556,7 +11510,7 @@ void PrimaryLogPG::hit_set_remove_all() // Once we hit a degraded object just skip if (is_degraded_or_backfilling_object(aoid)) return; - if (scrubber.write_blocked_by_scrub(aoid, get_sort_bitwise())) + if (scrubber.write_blocked_by_scrub(aoid)) return; } @@ -11675,7 +11629,7 @@ void PrimaryLogPG::hit_set_persist() // Once we hit a degraded object just skip further trim if (is_degraded_or_backfilling_object(aoid)) return; - if (scrubber.write_blocked_by_scrub(aoid, get_sort_bitwise())) + if (scrubber.write_blocked_by_scrub(aoid)) return; } @@ -11709,7 +11663,7 @@ void PrimaryLogPG::hit_set_persist() new_hset.using_gmt); // If the current object is degraded we skip this persist request - if (scrubber.write_blocked_by_scrub(oid, get_sort_bitwise())) + if (scrubber.write_blocked_by_scrub(oid)) return; hit_set->seal(); @@ -11953,7 +11907,7 @@ bool PrimaryLogPG::agent_work(int start_max, int agent_flush_quota) osd->logger->inc(l_osd_agent_skip); continue; } - if (scrubber.write_blocked_by_scrub(obc->obs.oi.soid, get_sort_bitwise())) { + if (scrubber.write_blocked_by_scrub(obc->obs.oi.soid)) { dout(20) << __func__ << " skip (scrubbing) " << obc->obs.oi << dendl; osd->logger->inc(l_osd_agent_skip); continue; @@ -12010,8 +11964,8 @@ bool PrimaryLogPG::agent_work(int start_max, int agent_flush_quota) // See if we've made a full pass over the object hash space // This might check at most ls_max objects a second time to notice that // we've checked every objects at least once. - if (cmp(agent_state->position, agent_state->start, get_sort_bitwise()) < 0 && - cmp(next, agent_state->start, get_sort_bitwise()) >= 0) { + if (agent_state->position < agent_state->start && + next >= agent_state->start) { dout(20) << __func__ << " wrap around " << agent_state->start << dendl; if (total_started == 0) need_delay = true; @@ -12603,7 +12557,7 @@ bool PrimaryLogPG::_range_available_for_scrub( next.second = object_contexts.lookup(begin); next.first = begin; bool more = true; - while (more && cmp(next.first, end, get_sort_bitwise()) < 0) { + while (more && next.first < end) { if (next.second && next.second->is_blocked()) { next.second->requeue_scrub_on_unblock = true; dout(10) << __func__ << ": scrub delayed, " @@ -12699,7 +12653,7 @@ unsigned PrimaryLogPG::process_clones_to(const boost::optional &head, */ void PrimaryLogPG::scrub_snapshot_metadata( ScrubMap &scrubmap, - const map, hobject_t::BitwiseComparator> &missing_digest) + const map> &missing_digest) { dout(10) << __func__ << dendl; @@ -12718,7 +12672,7 @@ void PrimaryLogPG::scrub_snapshot_metadata( bufferlist last_data; - for (map::reverse_iterator + for (map::reverse_iterator p = scrubmap.objects.rbegin(); p != scrubmap.objects.rend(); ++p) { const hobject_t& soid = p->first; soid_error = inconsistent_snapset_wrapper{soid}; @@ -12992,7 +12946,7 @@ void PrimaryLogPG::scrub_snapshot_metadata( if (head && head_error.errors) scrubber.store->add_snap_error(pool.id, head_error); - for (map, hobject_t::BitwiseComparator>::const_iterator p = + for (map>::const_iterator p = missing_digest.begin(); p != missing_digest.end(); ++p) { diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index a0b0ec3d01350..69aa55d1d5f1b 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -305,7 +305,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { std::string gen_dbg_prefix() const override { return gen_prefix(); } - const map, hobject_t::BitwiseComparator> + const map> &get_missing_loc_shards() const override { return missing_loc.get_missing_locs(); } @@ -395,8 +395,8 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { assert(peer_info.count(peer)); bool should_send = hoid.pool != (int64_t)info.pgid.pool() || - cmp(hoid, last_backfill_started, get_sort_bitwise()) <= 0 || - cmp(hoid, peer_info[peer].last_backfill, get_sort_bitwise()) <= 0; + hoid <= last_backfill_started || + hoid <= peer_info[peer].last_backfill; if (!should_send) assert(is_backfill_targets(peer)); return should_send; @@ -433,9 +433,6 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { uint64_t min_peer_features() const override { return get_min_peer_features(); } - bool sort_bitwise() const override { - return get_sort_bitwise(); - } void send_message_osd_cluster( int peer, Message *m, epoch_t from_epoch) override; @@ -821,9 +818,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { if (!to_req.empty()) { // requeue at front of scrub blocking queue if we are blocked by scrub for (auto &&p: to_req) { - if (scrubber.write_blocked_by_scrub( - p.first.get_head(), - get_sort_bitwise())) { + if (scrubber.write_blocked_by_scrub(p.first.get_head())) { waiting_for_scrub.splice( waiting_for_scrub.begin(), p.second, @@ -937,13 +932,13 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { bool already_ack(eversion_t v); // projected object info - SharedLRU object_contexts; + SharedLRU object_contexts; // map from oid.snapdir() to SnapSetContext * - map snapset_contexts; + map snapset_contexts; Mutex snapset_contexts_lock; // debug order that client ops are applied - map, hobject_t::BitwiseComparator> debug_op_order; + map> debug_op_order; void populate_obc_watchers(ObjectContextRef obc); void check_blacklisted_obc_watchers(ObjectContextRef obc); @@ -995,7 +990,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { } void put_snapset_context(SnapSetContext *ssc); - map recovering; + map recovering; /* * Backfill @@ -1011,8 +1006,8 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { * - are not included in pg stats (yet) * - have their stats in pending_backfill_updates on the primary */ - set backfills_in_flight; - map pending_backfill_updates; + set backfills_in_flight; + map pending_backfill_updates; void dump_recovery_info(Formatter *f) const override { f->open_array_section("backfill_targets"); @@ -1045,7 +1040,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { } { f->open_array_section("backfills_in_flight"); - for (set::const_iterator i = backfills_in_flight.begin(); + for (set::const_iterator i = backfills_in_flight.begin(); i != backfills_in_flight.end(); ++i) { f->dump_stream("object") << *i; @@ -1054,7 +1049,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { } { f->open_array_section("recovering"); - for (map::const_iterator i = recovering.begin(); + for (map::const_iterator i = recovering.begin(); i != recovering.end(); ++i) { f->dump_stream("object") << i->first; @@ -1233,7 +1228,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { void recover_got(hobject_t oid, eversion_t v); // -- copyfrom -- - map copy_ops; + map copy_ops; int fill_in_copy_get( OpContext *ctx, @@ -1278,7 +1273,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { friend struct C_Copyfrom; // -- flush -- - map flush_ops; + map flush_ops; /// start_flush takes ownership of on_flush iff ret == -EINPROGRESS int start_flush( @@ -1300,8 +1295,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { const hobject_t &begin, const hobject_t &end) override; virtual void scrub_snapshot_metadata( ScrubMap &map, - const std::map, - hobject_t::BitwiseComparator> &missing_digest) override; + const std::map> &missing_digest) override; virtual void _scrub_clear_state() override; virtual void _scrub_finish() override; object_stat_collection_t scrub_cstat; @@ -1319,7 +1313,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { bool pgls_filter(PGLSFilter *filter, hobject_t& sobj, bufferlist& outdata); int get_pgls_filter(bufferlist::iterator& iter, PGLSFilter **pfilter); - map, hobject_t::BitwiseComparator> in_progress_proxy_ops; + map> in_progress_proxy_ops; void kick_proxy_ops_blocked(hobject_t& soid); void cancel_proxy_ops(bool requeue); @@ -1456,7 +1450,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener { }; struct SnapTrimmer : public boost::statechart::state_machine< SnapTrimmer, NotTrimming > { PrimaryLogPG *pg; - set in_flight; + set in_flight; snapid_t snap_to_trim; explicit SnapTrimmer(PrimaryLogPG *pg) : pg(pg) {} ~SnapTrimmer(); diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 51b50e10b6646..f94ddf8833923 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -158,13 +158,13 @@ void ReplicatedBackend::recover_object( void ReplicatedBackend::check_recovery_sources(const OSDMapRef& osdmap) { - for(map >::iterator i = pull_from_peer.begin(); + for(map >::iterator i = pull_from_peer.begin(); i != pull_from_peer.end(); ) { if (osdmap->is_down(i->first.osd)) { dout(10) << "check_recovery_sources resetting pulls from osd." << i->first << ", osdmap has it marked down" << dendl; - for (set::iterator j = i->second.begin(); + for (set::iterator j = i->second.begin(); j != i->second.end(); ++j) { get_parent()->cancel_pull(*j); @@ -388,8 +388,8 @@ void generate_transaction( bool legacy_log_entries, vector &log_entries, ObjectStore::Transaction *t, - set *added, - set *removed) + set *added, + set *removed) { assert(t); assert(added); @@ -551,7 +551,7 @@ void ReplicatedBackend::submit_transaction( vector log_entries(_log_entries); ObjectStore::Transaction op_t; PGTransactionUPtr t(std::move(_t)); - set added, removed; + set added, removed; generate_transaction( t, coll, @@ -1261,7 +1261,7 @@ void ReplicatedBackend::calc_head_subsets( const pg_missing_t& missing, const hobject_t &last_backfill, interval_set& data_subset, - map, hobject_t::BitwiseComparator>& clone_subsets, + map>& clone_subsets, ObcLockManager &manager) { dout(10) << "calc_head_subsets " << head @@ -1292,7 +1292,7 @@ void ReplicatedBackend::calc_head_subsets( c.snap = snapset.clones[j]; prev.intersection_of(snapset.clone_overlap[snapset.clones[j]]); if (!missing.is_missing(c) && - cmp(c, last_backfill, get_parent()->sort_bitwise()) < 0 && + c < last_backfill && get_parent()->try_lock_for_read(c, manager)) { dout(10) << "calc_head_subsets " << head << " has prev " << c << " overlap " << prev << dendl; @@ -1325,7 +1325,7 @@ void ReplicatedBackend::calc_clone_subsets( const pg_missing_t& missing, const hobject_t &last_backfill, interval_set& data_subset, - map, hobject_t::BitwiseComparator>& clone_subsets, + map>& clone_subsets, ObcLockManager &manager) { dout(10) << "calc_clone_subsets " << soid @@ -1360,7 +1360,7 @@ void ReplicatedBackend::calc_clone_subsets( c.snap = snapset.clones[j]; prev.intersection_of(snapset.clone_overlap[snapset.clones[j]]); if (!missing.is_missing(c) && - cmp(c, last_backfill, get_parent()->sort_bitwise()) < 0 && + c < last_backfill && get_parent()->try_lock_for_read(c, manager)) { dout(10) << "calc_clone_subsets " << soid << " has prev " << c << " overlap " << prev << dendl; @@ -1381,7 +1381,7 @@ void ReplicatedBackend::calc_clone_subsets( c.snap = snapset.clones[j]; next.intersection_of(snapset.clone_overlap[snapset.clones[j-1]]); if (!missing.is_missing(c) && - cmp(c, last_backfill, get_parent()->sort_bitwise()) < 0 && + c < last_backfill && get_parent()->try_lock_for_read(c, manager)) { dout(10) << "calc_clone_subsets " << soid << " has next " << c << " overlap " << next << dendl; @@ -1419,11 +1419,11 @@ void ReplicatedBackend::prepare_pull( eversion_t _v = get_parent()->get_local_missing().get_items().find( soid)->second.need; assert(_v == v); - const map, hobject_t::BitwiseComparator> &missing_loc( + const map> &missing_loc( get_parent()->get_missing_loc_shards()); const map &peer_missing( get_parent()->get_shard_missing()); - map, hobject_t::BitwiseComparator>::const_iterator q = missing_loc.find(soid); + map>::const_iterator q = missing_loc.find(soid); assert(q != missing_loc.end()); assert(!q->second.empty()); @@ -1525,7 +1525,7 @@ void ReplicatedBackend::prep_push_to_replica( dout(10) << __func__ << ": " << soid << " v" << oi.version << " size " << size << " to osd." << peer << dendl; - map, hobject_t::BitwiseComparator> clone_subsets; + map> clone_subsets; interval_set data_subset; ObcLockManager lock_manager; @@ -1596,7 +1596,7 @@ void ReplicatedBackend::prep_push(ObjectContextRef obc, interval_set data_subset; if (obc->obs.oi.size) data_subset.insert(0, obc->obs.oi.size); - map, hobject_t::BitwiseComparator> clone_subsets; + map> clone_subsets; prep_push(obc, soid, peer, obc->obs.oi.version, data_subset, clone_subsets, @@ -1608,7 +1608,7 @@ void ReplicatedBackend::prep_push( const hobject_t& soid, pg_shard_t peer, eversion_t version, interval_set &data_subset, - map, hobject_t::BitwiseComparator>& clone_subsets, + map>& clone_subsets, PushOp *pop, bool cache_dont_need, ObcLockManager &&lock_manager) @@ -1749,7 +1749,7 @@ void ReplicatedBackend::submit_push_data( void ReplicatedBackend::submit_push_complete(ObjectRecoveryInfo &recovery_info, ObjectStore::Transaction *t) { - for (map, hobject_t::BitwiseComparator>::const_iterator p = + for (map>::const_iterator p = recovery_info.clone_subset.begin(); p != recovery_info.clone_subset.end(); ++p) { @@ -2414,7 +2414,7 @@ void ReplicatedBackend::_failed_push(pg_shard_t from, const hobject_t &soid) } void ReplicatedBackend::clear_pull( - map::iterator piter, + map::iterator piter, bool clear_pull_from_peer) { auto from = piter->second.from; diff --git a/src/osd/ReplicatedBackend.h b/src/osd/ReplicatedBackend.h index efe795d74f2d9..2b021845bf52e 100644 --- a/src/osd/ReplicatedBackend.h +++ b/src/osd/ReplicatedBackend.h @@ -95,14 +95,14 @@ class ReplicatedBackend : public PGBackend { virtual void dump_recovery_info(Formatter *f) const { { f->open_array_section("pull_from_peer"); - for (map >::const_iterator i = pull_from_peer.begin(); + for (map >::const_iterator i = pull_from_peer.begin(); i != pull_from_peer.end(); ++i) { f->open_object_section("pulling_from"); f->dump_stream("pull_from") << i->first; { f->open_array_section("pulls"); - for (set::const_iterator j = i->second.begin(); + for (set::const_iterator j = i->second.begin(); j != i->second.end(); ++j) { f->open_object_section("pull_info"); @@ -118,7 +118,7 @@ class ReplicatedBackend : public PGBackend { } { f->open_array_section("pushing"); - for (map, hobject_t::BitwiseComparator>::const_iterator i = + for (map>::const_iterator i = pushing.begin(); i != pushing.end(); ++i) { @@ -182,7 +182,7 @@ class ReplicatedBackend : public PGBackend { } } }; - map, hobject_t::BitwiseComparator> pushing; + map> pushing; // pull struct PullInfo { @@ -214,12 +214,12 @@ class ReplicatedBackend : public PGBackend { } }; - map pulling; + map pulling; // Reverse mapping from osd peer to objects beging pulled from that peer - map > pull_from_peer; + map > pull_from_peer; void clear_pull( - map::iterator piter, + map::iterator piter, bool clear_pull_from_peer = true); void sub_op_push(OpRequestRef op); @@ -294,7 +294,7 @@ class ReplicatedBackend : public PGBackend { SnapSet& snapset, const hobject_t& poid, const pg_missing_t& missing, const hobject_t &last_backfill, interval_set& data_subset, - map, hobject_t::BitwiseComparator>& clone_subsets, + map>& clone_subsets, ObcLockManager &lock_manager); void prepare_pull( eversion_t v, @@ -318,7 +318,7 @@ class ReplicatedBackend : public PGBackend { const hobject_t& soid, pg_shard_t peer, eversion_t version, interval_set &data_subset, - map, hobject_t::BitwiseComparator>& clone_subsets, + map>& clone_subsets, PushOp *op, bool cache, ObcLockManager &&lock_manager); @@ -327,7 +327,7 @@ class ReplicatedBackend : public PGBackend { const pg_missing_t& missing, const hobject_t &last_backfill, interval_set& data_subset, - map, hobject_t::BitwiseComparator>& clone_subsets, + map>& clone_subsets, ObcLockManager &lock_manager); ObjectRecoveryInfo recalc_subsets( const ObjectRecoveryInfo& recovery_info, diff --git a/src/osd/Session.cc b/src/osd/Session.cc index 8f93ea95ae967..125bd1f15790b 100644 --- a/src/osd/Session.cc +++ b/src/osd/Session.cc @@ -11,7 +11,7 @@ void Session::clear_backoffs() { - map,hobject_t::BitwiseComparator> ls; + map> ls; { Mutex::Locker l(backoff_lock); ls.swap(backoffs); @@ -47,8 +47,8 @@ void Session::ack_backoff( auto p = backoffs.lower_bound(begin); while (p != backoffs.end()) { // note: must still examine begin=end=p->first case - int r = cmp_bitwise(p->first, end); - if (r > 0 || (r == 0 && cmp_bitwise(begin, end) < 0)) { + int r = cmp(p->first, end); + if (r > 0 || (r == 0 && begin < end)) { break; } auto q = p->second.begin(); diff --git a/src/osd/Session.h b/src/osd/Session.h index 63a73c30073e6..6492c4bd4e4fd 100644 --- a/src/osd/Session.h +++ b/src/osd/Session.h @@ -139,7 +139,7 @@ struct Session : public RefCountedObject { /// protects backoffs; orders inside Backoff::lock *and* PG::backoff_lock Mutex backoff_lock; std::atomic_int backoff_count= {0}; ///< simple count of backoffs - map, hobject_t::BitwiseComparator> backoffs; + map> backoffs; std::atomic backoff_seq = {0}; @@ -169,14 +169,14 @@ struct Session : public RefCountedObject { assert(backoff_count == (int)backoffs.size()); auto p = backoffs.lower_bound(oid); if (p != backoffs.begin() && - cmp_bitwise(p->first, oid) > 0) { + p->first > oid) { --p; } if (p != backoffs.end()) { - int r = cmp_bitwise(oid, p->first); + int r = cmp(oid, p->first); if (r == 0 || r > 0) { for (auto& q : p->second) { - if (r == 0 || cmp_bitwise(oid, q->end) < 0) { + if (r == 0 || oid < q->end) { return &(*q); } } diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 93a8664549c34..ff3c97268b6c8 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -4853,9 +4853,9 @@ void ObjectRecoveryInfo::decode(bufferlist::iterator &bl, if (struct_v < 2) { if (!soid.is_max() && soid.pool == -1) soid.pool = pool; - map, hobject_t::BitwiseComparator> tmp; + map> tmp; tmp.swap(clone_subset); - for (map, hobject_t::BitwiseComparator>::iterator i = tmp.begin(); + for (map>::iterator i = tmp.begin(); i != tmp.end(); ++i) { hobject_t first(i->first); @@ -5134,11 +5134,11 @@ void ScrubMap::merge_incr(const ScrubMap &l) assert(valid_through == l.incr_since); valid_through = l.valid_through; - for (map::const_iterator p = l.objects.begin(); + for (map::const_iterator p = l.objects.begin(); p != l.objects.end(); ++p){ if (p->second.negative) { - map::iterator q = objects.find(p->first); + map::iterator q = objects.find(p->first); if (q != objects.end()) { objects.erase(q); } @@ -5176,9 +5176,9 @@ void ScrubMap::decode(bufferlist::iterator& bl, int64_t pool) // handle hobject_t upgrade if (struct_v < 3) { - map tmp; + map tmp; tmp.swap(objects); - for (map::iterator i = tmp.begin(); + for (map::iterator i = tmp.begin(); i != tmp.end(); ++i) { hobject_t first(i->first); @@ -5194,7 +5194,7 @@ void ScrubMap::dump(Formatter *f) const f->dump_stream("valid_through") << valid_through; f->dump_stream("incremental_since") << incr_since; f->open_array_section("objects"); - for (map::const_iterator p = objects.begin(); p != objects.end(); ++p) { + for (map::const_iterator p = objects.begin(); p != objects.end(); ++p) { f->open_object_section("object"); f->dump_string("name", p->first.oid.name); f->dump_unsigned("hash", p->first.get_hash()); diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 8a30b287856b0..318a902856aa0 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -2210,9 +2210,9 @@ struct pg_info_t { last_backfill_bitwise(false) { } - void set_last_backfill(hobject_t pos, bool sort) { + void set_last_backfill(hobject_t pos) { last_backfill = pos; - last_backfill_bitwise = sort; + last_backfill_bitwise = true; } bool is_empty() const { return last_update.version == 0; } @@ -3120,7 +3120,7 @@ ostream& operator<<(ostream& out, const pg_missing_item &item); class pg_missing_const_i { public: - virtual const map & + virtual const map & get_items() const = 0; virtual const map &get_rmissing() const = 0; virtual unsigned int num_missing() const = 0; @@ -3145,7 +3145,7 @@ class ChangeTracker { }; template <> class ChangeTracker { - set _changed; + set _changed; public: void changed(const hobject_t &obj) { _changed.insert(obj); @@ -3167,7 +3167,7 @@ class ChangeTracker { template class pg_missing_set : public pg_missing_const_i { using item = pg_missing_item; - map missing; // oid -> (need v, have v) + map missing; // oid -> (need v, have v) map rmissing; // v -> oid ChangeTracker tracker; @@ -3184,7 +3184,7 @@ class pg_missing_set : public pg_missing_const_i { tracker.changed(i.first); } - const map &get_items() const override { + const map &get_items() const override { return missing; } const map &get_rmissing() const override { @@ -3205,7 +3205,7 @@ class pg_missing_set : public pg_missing_const_i { return true; } bool is_missing(const hobject_t& oid, eversion_t v) const override { - map::const_iterator m = + map::const_iterator m = missing.find(oid); if (m == missing.end()) return false; @@ -3215,7 +3215,7 @@ class pg_missing_set : public pg_missing_const_i { return true; } eversion_t have_old(const hobject_t& oid) const override { - map::const_iterator m = + map::const_iterator m = missing.find(oid); if (m == missing.end()) return eversion_t(); @@ -3235,7 +3235,7 @@ class pg_missing_set : public pg_missing_const_i { */ void add_next_event(const pg_log_entry_t& e) { if (e.is_update()) { - map::iterator missing_it; + map::iterator missing_it; missing_it = missing.find(e.soid); bool is_missing_divergent_item = missing_it != missing.end(); if (e.prior_version == eversion_t() || e.is_clone()) { @@ -3291,25 +3291,25 @@ class pg_missing_set : public pg_missing_const_i { } void rm(const hobject_t& oid, eversion_t v) { - std::map::iterator p = missing.find(oid); + std::map::iterator p = missing.find(oid); if (p != missing.end() && p->second.need <= v) rm(p); } - void rm(std::map::const_iterator m) { + void rm(std::map::const_iterator m) { tracker.changed(m->first); rmissing.erase(m->second.need.version); missing.erase(m); } void got(const hobject_t& oid, eversion_t v) { - std::map::iterator p = missing.find(oid); + std::map::iterator p = missing.find(oid); assert(p != missing.end()); assert(p->second.need <= v); got(p); } - void got(std::map::const_iterator m) { + void got(std::map::const_iterator m) { tracker.changed(m->first); rmissing.erase(m->second.need.version); missing.erase(m); @@ -3320,7 +3320,7 @@ class pg_missing_set : public pg_missing_const_i { unsigned split_bits, pg_missing_set *omissing) { unsigned mask = ~((~0)<::iterator i = missing.begin(); + for (map::iterator i = missing.begin(); i != missing.end(); ) { if ((i->first.get_hash() & mask) == child_pgid.m_seed) { @@ -3339,16 +3339,6 @@ class pg_missing_set : public pg_missing_const_i { rmissing.clear(); } - void resort(bool sort_bitwise) { - if (missing.key_comp().bitwise != sort_bitwise) { - map tmp; - tmp.swap(missing); - missing = map( - hobject_t::ComparatorWithDefault(sort_bitwise)); - missing.insert(tmp.begin(), tmp.end()); - } - } - void encode(bufferlist &bl) const { ENCODE_START(3, 2, bl); ::encode(missing, bl); @@ -3363,8 +3353,8 @@ class pg_missing_set : public pg_missing_const_i { if (struct_v < 3) { // Handle hobject_t upgrade - map tmp; - for (map::iterator i = + map tmp; + for (map::iterator i = missing.begin(); i != missing.end(); ) { @@ -3380,7 +3370,7 @@ class pg_missing_set : public pg_missing_const_i { missing.insert(tmp.begin(), tmp.end()); } - for (map::iterator it = + for (map::iterator it = missing.begin(); it != missing.end(); ++it) @@ -3390,7 +3380,7 @@ class pg_missing_set : public pg_missing_const_i { } void dump(Formatter *f) const { f->open_array_section("missing"); - for (map::const_iterator p = + for (map::const_iterator p = missing.begin(); p != missing.end(); ++p) { f->open_object_section("item"); f->dump_stream("object") << p->first; @@ -3462,7 +3452,7 @@ class pg_missing_set : public pg_missing_const_i { } if (oss && !ok) { *oss << "check_missing: " << check_missing << "\n"; - set changed; + set changed; tracker.get_changed([&](const hobject_t &hoid) { changed.insert(hoid); }); *oss << "changed: " << changed << "\n"; } @@ -4498,7 +4488,7 @@ class ObcLockManager { ObjectContext::RWState::State type) : obc(obc), type(type) {} }; - map locks; + map locks; public: ObcLockManager() = default; ObcLockManager(ObcLockManager &&) = default; @@ -4616,7 +4606,7 @@ struct ObjectRecoveryInfo { object_info_t oi; SnapSet ss; interval_set copy_subset; - map, hobject_t::BitwiseComparator> clone_subset; + map> clone_subset; ObjectRecoveryInfo() : size(0) { } @@ -4745,15 +4735,10 @@ struct ScrubMap { }; WRITE_CLASS_ENCODER(object) - bool bitwise; // ephemeral, not encoded - map objects; + map objects; eversion_t valid_through; eversion_t incr_since; - ScrubMap() : bitwise(true) {} - ScrubMap(bool bitwise) - : bitwise(bitwise), objects(hobject_t::ComparatorWithDefault(bitwise)) {} - void merge_incr(const ScrubMap &l); void insert(const ScrubMap &r) { objects.insert(r.objects.begin(), r.objects.end()); @@ -4767,16 +4752,6 @@ struct ScrubMap { void encode(bufferlist& bl) const; void decode(bufferlist::iterator& bl, int64_t pool=-1); void dump(Formatter *f) const; - void reset_bitwise(bool new_bitwise) { - if (bitwise == new_bitwise) - return; - map new_objects( - objects.begin(), - objects.end(), - hobject_t::ComparatorWithDefault(new_bitwise)); - ::swap(new_objects, objects); - bitwise = new_bitwise; - } static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(ScrubMap::object) diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 52da00c170291..cdeff10383464 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -3075,15 +3075,15 @@ void Objecter::_send_op(Op *op, MOSDOp *m) auto q = op->session->backoffs.lower_bound(hoid); if (q != op->session->backoffs.begin()) { --q; - if (cmp_bitwise(hoid, q->second.end) >= 0) { + if (hoid >= q->second.end) { ++q; } } if (q != op->session->backoffs.end()) { ldout(cct, 20) << __func__ << " ? " << q->first << " [" << q->second.begin << "," << q->second.end << ")" << dendl; - int r = cmp_bitwise(hoid, q->second.begin); - if (r == 0 || (r > 0 && cmp_bitwise(hoid, q->second.end) < 0)) { + int r = cmp(hoid, q->second.begin); + if (r == 0 || (r > 0 && hoid < q->second.end)) { ldout(cct, 10) << __func__ << " backoff on " << hoid << ", queuing " << op << " tid " << op->tid << dendl; return; @@ -5014,7 +5014,7 @@ void Objecter::enumerate_objects( { assert(result); - if (!end.is_max() && cmp_bitwise(start, end) > 0) { + if (!end.is_max() && start > end) { lderr(cct) << __func__ << ": start " << start << " > end " << end << dendl; on_finish->complete(-EINVAL); return; @@ -5105,7 +5105,7 @@ void Objecter::_enumerate_reply( ldout(cct, 20) << __func__ << ": response.entries.size " << response.entries.size() << ", response.entries " << response.entries << dendl; - if (cmp_bitwise(response.handle, end) <= 0) { + if (response.handle <= end) { *next = response.handle; } else { ldout(cct, 10) << __func__ << ": adjusted next down to end " << end @@ -5133,7 +5133,7 @@ void Objecter::_enumerate_reply( hash, pool_id, response.entries.back().nspace); - if (cmp_bitwise(last, end) < 0) + if (last < end) break; ldout(cct, 20) << __func__ << " dropping item " << last << " >= end " << end << dendl; diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 8682a61d7ad41..09ae6d7061f59 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1236,8 +1236,8 @@ class Objecter : public md_config_obs_t, public Dispatcher { bool contained_by(const hobject_t& begin, const hobject_t& end) { hobject_t h = get_hobj(); - int r = cmp_bitwise(h, begin); - return r == 0 || (r > 0 && cmp_bitwise(h, end) < 0); + int r = cmp(h, begin); + return r == 0 || (r > 0 && h < end); } void dump(Formatter *f) const; @@ -1807,7 +1807,7 @@ class Objecter : public md_config_obs_t, public Dispatcher { map command_ops; // backoffs - map backoffs; + map backoffs; multimap backoffs_by_id; int osd; diff --git a/src/test/objectstore/FileStoreDiff.cc b/src/test/objectstore/FileStoreDiff.cc index 2596166546bd4..5134522017aba 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 da74c1b701aa4..76f6a2687e7df 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 (start > *i) { cout << start << " should follow " << *i << std::endl; return false; } @@ -2218,7 +2218,7 @@ TEST_P(StoreTest, SimpleListTest) { r = apply_transaction(store, &osr, std::move(t)); ASSERT_EQ(r, 0); } - set all; + set all; { ObjectStore::Transaction t; for (int i=0; i<200; ++i) { @@ -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; + { + 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) { @@ -2266,7 +2262,7 @@ TEST_P(StoreTest, SimpleListTest) { } { ObjectStore::Transaction t; - for (set::iterator p = all.begin(); p != all.end(); ++p) + for (set::iterator p = all.begin(); p != all.end(); ++p) t.remove(cid, *p); t.remove_collection(cid); cerr << "Cleaning" << std::endl; @@ -2286,7 +2282,7 @@ TEST_P(StoreTest, ListEndTest) { r = apply_transaction(store, &osr, std::move(t)); ASSERT_EQ(r, 0); } - set all; + set all; { ObjectStore::Transaction t; for (int i=0; i<200; ++i) { @@ -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) { @@ -2318,7 +2313,7 @@ TEST_P(StoreTest, ListEndTest) { } { ObjectStore::Transaction t; - for (set::iterator p = all.begin(); p != all.end(); ++p) + for (set::iterator p = all.begin(); p != all.end(); ++p) t.remove(cid, *p); t.remove_collection(cid); cerr << "Cleaning" << std::endl; @@ -2334,24 +2329,24 @@ TEST_P(StoreTest, Sort) { ASSERT_EQ(a, b); b.oid.name = "b"; ASSERT_NE(a, b); - ASSERT_TRUE(cmp_bitwise(a, b) < 0); + ASSERT_TRUE(a < b); a.pool = 1; b.pool = 2; - ASSERT_TRUE(cmp_bitwise(a, b) < 0); + ASSERT_TRUE(a < b); a.pool = 3; - ASSERT_TRUE(cmp_bitwise(a, b) > 0); + ASSERT_TRUE(a > b); } { ghobject_t a(hobject_t(sobject_t("a", CEPH_NOSNAP))); ghobject_t b(hobject_t(sobject_t("b", CEPH_NOSNAP))); a.hobj.pool = 1; b.hobj.pool = 1; - ASSERT_TRUE(cmp_bitwise(a, b) < 0); + ASSERT_TRUE(a < b); a.hobj.pool = -3; - ASSERT_TRUE(cmp_bitwise(a, b) < 0); + ASSERT_TRUE(a < b); a.hobj.pool = 1; b.hobj.pool = -3; - ASSERT_TRUE(cmp_bitwise(a, b) > 0); + ASSERT_TRUE(a > b); } } @@ -2367,7 +2362,7 @@ TEST_P(StoreTest, MultipoolListTest) { r = apply_transaction(store, &osr, std::move(t)); ASSERT_EQ(r, 0); } - set all, saw; + set all, saw; { ObjectStore::Transaction t; for (int i=0; i<200; ++i) { @@ -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; @@ -2405,7 +2399,7 @@ TEST_P(StoreTest, MultipoolListTest) { } { ObjectStore::Transaction t; - for (set::iterator p = all.begin(); p != all.end(); ++p) + for (set::iterator p = all.begin(); p != all.end(); ++p) t.remove(cid, *p); t.remove_collection(cid); cerr << "Cleaning" << std::endl; @@ -3019,7 +3013,7 @@ TEST_P(StoreTest, ManyObjectTest) { coll_t cid; string base = ""; for (int i = 0; i < 100; ++i) base.append("aaaaa"); - set created; + set created; { ObjectStore::Transaction t; t.create_collection(cid, 0); @@ -3040,16 +3034,16 @@ TEST_P(StoreTest, ManyObjectTest) { ASSERT_EQ(r, 0); } - for (set::iterator i = created.begin(); + for (set::iterator i = created.begin(); i != created.end(); ++i) { struct stat buf; ASSERT_TRUE(!store->stat(cid, *i, &buf)); } - set listed, listed2; + 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) { @@ -3115,13 +3091,13 @@ TEST_P(StoreTest, ManyObjectTest) { ASSERT_TRUE(listed.size() == created.size()); if (listed2.size()) ASSERT_EQ(listed.size(), listed2.size()); - for (set::iterator i = listed.begin(); + for (set::iterator i = listed.begin(); i != listed.end(); ++i) { ASSERT_TRUE(created.count(*i)); } - for (set::iterator i = created.begin(); + for (set::iterator i = created.begin(); i != created.end(); ++i) { ObjectStore::Transaction t; @@ -3184,9 +3160,9 @@ class SyntheticWorkloadState { unsigned write_alignment; unsigned max_object_len, max_write_len; unsigned in_flight; - map contents; - set available_objects; - set in_flight_objects; + map contents; + set available_objects; + set in_flight_objects; ObjectGenerator *object_gen; gen_type *rng; ObjectStore *store; @@ -3323,7 +3299,7 @@ class SyntheticWorkloadState { 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; @@ -3347,7 +3323,7 @@ class SyntheticWorkloadState { cond.Wait(lock); boost::uniform_int<> choose(0, available_objects.size() - 1); int index = choose(*rng); - set::iterator i = available_objects.begin(); + set::iterator i = available_objects.begin(); for ( ; index > 0; --index, ++i) ; ghobject_t ret = *i; return ret; @@ -3893,15 +3869,14 @@ class SyntheticWorkloadState { while (in_flight) cond.Wait(lock); vector objects; - set objects_set, objects_set2; + set objects_set, objects_set2; 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; @@ -3926,17 +3901,18 @@ class SyntheticWorkloadState { } ASSERT_EQ(objects_set.size(), available_objects.size()); - for (set::iterator i = objects_set.begin(); + for (set::iterator i = objects_set.begin(); i != objects_set.end(); ++i) { 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()); - for (set::iterator i = objects_set2.begin(); + for (set::iterator i = objects_set2.begin(); i != objects_set2.end(); ++i) { ASSERT_GT(available_objects.count(*i), (unsigned)0); @@ -4392,7 +4368,7 @@ TEST_P(StoreTest, HashCollisionTest) { } string base = ""; for (int i = 0; i < 100; ++i) base.append("aaaaa"); - set created; + set created; for (int n = 0; n < 10; ++n) { char nbuf[100]; sprintf(nbuf, "n%d", n); @@ -4413,19 +4389,19 @@ 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()); + set listed(objects.begin(), objects.end()); cerr << "listed.size() is " << listed.size() << " and created.size() is " << created.size() << std::endl; ASSERT_TRUE(listed.size() == created.size()); objects.clear(); 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) { @@ -4442,13 +4418,13 @@ TEST_P(StoreTest, HashCollisionTest) { } cerr << "listed.size() is " << listed.size() << std::endl; ASSERT_TRUE(listed.size() == created.size()); - for (set::iterator i = listed.begin(); + for (set::iterator i = listed.begin(); i != listed.end(); ++i) { ASSERT_TRUE(created.count(*i)); } - for (set::iterator i = created.begin(); + for (set::iterator i = created.begin(); i != created.end(); ++i) { ObjectStore::Transaction t; @@ -4474,7 +4450,7 @@ TEST_P(StoreTest, ScrubTest) { ASSERT_EQ(r, 0); } string base = "aaaaa"; - set created; + set created; for (int i = 0; i < 1000; ++i) { char buf[100]; sprintf(buf, "%d", i); @@ -4511,20 +4487,20 @@ 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()); + set listed(objects.begin(), objects.end()); cerr << "listed.size() is " << listed.size() << " and created.size() is " << created.size() << std::endl; ASSERT_TRUE(listed.size() == created.size()); objects.clear(); 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)) @@ -4540,13 +4516,13 @@ TEST_P(StoreTest, ScrubTest) { } cerr << "listed.size() is " << listed.size() << std::endl; ASSERT_TRUE(listed.size() == created.size()); - for (set::iterator i = listed.begin(); + for (set::iterator i = listed.begin(); i != listed.end(); ++i) { ASSERT_TRUE(created.count(*i)); } - for (set::iterator i = created.begin(); + for (set::iterator i = created.begin(); i != created.end(); ++i) { ObjectStore::Transaction t; @@ -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 b5e6dde149a0a..a529e576b7909 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 367bba2dd945c..87a5a00e01f2a 100644 --- a/src/test/os/TestLFNIndex.cc +++ b/src/test/os/TestLFNIndex.cc @@ -80,7 +80,6 @@ class TestWrapLFNIndex : public LFNIndex { 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/test/osd/TestPGLog.cc b/src/test/osd/TestPGLog.cc index e00449ca860e0..e6e7c0e366555 100644 --- a/src/test/osd/TestPGLog.cc +++ b/src/test/osd/TestPGLog.cc @@ -92,7 +92,7 @@ class PGLogTest : public ::testing::Test, protected PGLog { pg_missing_t init; pg_missing_t final; - set toremove; + set toremove; list torollback; private: @@ -153,7 +153,7 @@ class PGLogTest : public ::testing::Test, protected PGLog { }; struct LogHandler : public PGLog::LogEntryHandler { - set removed; + set removed; list rolledback; void rollback( @@ -204,8 +204,8 @@ class PGLogTest : public ::testing::Test, protected PGLog { } { - set::const_iterator titer = tcase.toremove.begin(); - set::const_iterator hiter = handler.removed.begin(); + set::const_iterator titer = tcase.toremove.begin(); + set::const_iterator hiter = handler.removed.begin(); for (; titer != tcase.toremove.end(); ++titer, ++hiter) { EXPECT_EQ(*titer, *hiter); } @@ -490,8 +490,9 @@ TEST_F(PGLogTest, merge_old_entry) { list remove_snap; info.last_backfill = hobject_t(); - info.last_backfill.set_hash(1); + info.last_backfill.set_hash(100); oe.soid.set_hash(2); + ASSERT_GT(oe.soid, info.last_backfill); EXPECT_FALSE(is_dirty()); EXPECT_TRUE(remove_snap.empty()); diff --git a/src/test/osd/types.cc b/src/test/osd/types.cc index 419c637177bc3..d1d600789d885 100644 --- a/src/test/osd/types.cc +++ b/src/test/osd/types.cc @@ -1442,14 +1442,14 @@ TEST(ghobject_t, cmp) { sep.set_shard(shard_id_t(1)); sep.hobj.pool = -1; cout << min << " < " << sep << std::endl; - ASSERT_TRUE(cmp_bitwise(min, sep) < 0); + ASSERT_TRUE(min < sep); sep.set_shard(shard_id_t::NO_SHARD); cout << "sep shard " << sep.shard_id << std::endl; ghobject_t o(hobject_t(object_t(), string(), CEPH_NOSNAP, 0x42, 1, string())); cout << "o " << o << std::endl; - ASSERT_TRUE(cmp_bitwise(o, sep) > 0); + ASSERT_TRUE(o > sep); } TEST(ghobject_t, parse) { diff --git a/src/test/test_snap_mapper.cc b/src/test/test_snap_mapper.cc index a48fd03a95185..db4924a97d8fc 100644 --- a/src/test/test_snap_mapper.cc +++ b/src/test/test_snap_mapper.cc @@ -438,8 +438,8 @@ TEST_F(MapCacherTest, Random) class MapperVerifier { PausyAsyncMap *driver; boost::scoped_ptr< SnapMapper > mapper; - map > snap_to_hobject; - map, hobject_t::BitwiseComparator> hobject_to_snap; + map > snap_to_hobject; + map> hobject_to_snap; snapid_t next; uint32_t mask; uint32_t bits; @@ -491,7 +491,7 @@ class MapperVerifier { for (set::iterator i = snaps.begin(); i != snaps.end(); ++i) { - map >::iterator j = snap_to_hobject.find(*i); + map >::iterator j = snap_to_hobject.find(*i); assert(j != snap_to_hobject.end()); j->second.insert(obj); } @@ -506,9 +506,9 @@ class MapperVerifier { Mutex::Locker l(lock); if (snap_to_hobject.empty()) return; - map >::iterator snap = + map >::iterator snap = rand_choose(snap_to_hobject); - set hobjects = snap->second; + set hobjects = snap->second; vector hoids; while (mapper->get_next_objects_to_trim( @@ -518,7 +518,7 @@ class MapperVerifier { assert(hobjects.count(hoid)); hobjects.erase(hoid); - map, hobject_t::BitwiseComparator>::iterator j = + map>::iterator j = hobject_to_snap.find(hoid); assert(j->second.count(snap->first)); set old_snaps(j->second); @@ -548,12 +548,12 @@ class MapperVerifier { Mutex::Locker l(lock); if (hobject_to_snap.empty()) return; - map, hobject_t::BitwiseComparator>::iterator obj = + map>::iterator obj = rand_choose(hobject_to_snap); for (set::iterator i = obj->second.begin(); i != obj->second.end(); ++i) { - map >::iterator j = + map >::iterator j = snap_to_hobject.find(*i); assert(j->second.count(obj->first)); j->second.erase(obj->first); @@ -572,7 +572,7 @@ class MapperVerifier { Mutex::Locker l(lock); if (hobject_to_snap.empty()) return; - map, hobject_t::BitwiseComparator>::iterator obj = + map>::iterator obj = rand_choose(hobject_to_snap); set snaps; int r = mapper->get_snaps(obj->first, &snaps); diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index d7d1319f6c35b..0e5cbf93efbc2 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;