From: Mykola Golub Date: Thu, 30 Jul 2020 14:21:28 +0000 (+0100) Subject: osd: add and utilize OSD_FIXED_COLLECTION_LIST feature X-Git-Tag: v14.2.12~81^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4f1d1626f952f7294a04c597dc51bf447cce59fd;p=ceph.git osd: add and utilize OSD_FIXED_COLLECTION_LIST feature If all osds from upacting set have this feature set the backend can use the new "fixed" collection_list method, otherwise it fallbacks to the legacy method. Signed-off-by: Mykola Golub (cherry picked from commit 8f9d335bc7cccb221ca7316ee0c8f22198d0f9ef) Conflicts: src/include/ceph_features.h: trivial src/osd/PGBackend.h: trivial src/osd/PrimaryLogPG.h: PG::get_min_upacting_features instead of PeeringState::get_min_upacting_features --- diff --git a/src/include/ceph_features.h b/src/include/ceph_features.h index 5925b897d65e..6fec3a0c5140 100644 --- a/src/include/ceph_features.h +++ b/src/include/ceph_features.h @@ -118,7 +118,7 @@ DEFINE_CEPH_FEATURE(21, 2, RADOS_BACKOFF) // overlap DEFINE_CEPH_FEATURE(21, 2, OSDMAP_PG_UPMAP) // overlap DEFINE_CEPH_FEATURE(21, 2, CRUSH_CHOOSE_ARGS) // overlap DEFINE_CEPH_FEATURE_RETIRED(22, 1, BACKFILL_RESERVATION, JEWEL, LUMINOUS) - +DEFINE_CEPH_FEATURE(22, 2, OSD_FIXED_COLLECTION_LIST) DEFINE_CEPH_FEATURE(23, 1, MSG_AUTH) // 3.19 req (unless nocephx_require_signatures) DEFINE_CEPH_FEATURE_RETIRED(24, 1, RECOVERY_RESERVATION, JEWEL, LUNINOUS) DEFINE_CEPH_FEATURE(24, 2, RECOVERY_RESERVATION_2) @@ -248,6 +248,7 @@ DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facin CEPH_FEATURE_SERVER_NAUTILUS | \ CEPH_FEATURE_CEPHX_V2 | \ CEPH_FEATURE_OSD_PGLOG_HARDLIMIT | \ + CEPH_FEATURE_OSD_FIXED_COLLECTION_LIST | \ 0ULL) #define CEPH_FEATURES_SUPPORTED_DEFAULT CEPH_FEATURES_ALL diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index db24ed363f4f..6c193c6ab772 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -350,13 +350,24 @@ int PGBackend::objects_list_partial( while (!_next.is_max() && ls->size() < (unsigned)min) { vector objects; - r = store->collection_list( - ch, - _next, - ghobject_t::get_max(), - max - ls->size(), - &objects, - &_next); + if (HAVE_FEATURE(parent->min_upacting_features(), + OSD_FIXED_COLLECTION_LIST)) { + r = store->collection_list( + ch, + _next, + ghobject_t::get_max(), + max - ls->size(), + &objects, + &_next); + } else { + r = store->collection_list_legacy( + ch, + _next, + ghobject_t::get_max(), + max - ls->size(), + &objects, + &_next); + } if (r != 0) { derr << __func__ << " list collection " << ch << " got: " << cpp_strerror(r) << dendl; break; @@ -385,13 +396,25 @@ int PGBackend::objects_list_range( { ceph_assert(ls); vector objects; - int r = store->collection_list( - 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), - INT_MAX, - &objects, - NULL); + int r; + if (HAVE_FEATURE(parent->min_upacting_features(), + OSD_FIXED_COLLECTION_LIST)) { + r = store->collection_list( + 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), + INT_MAX, + &objects, + NULL); + } else { + r = store->collection_list_legacy( + 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), + INT_MAX, + &objects, + NULL); + } ls->reserve(objects.size()); for (vector::iterator i = objects.begin(); i != objects.end(); diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index e19695fcd6db..18ef723590f5 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -273,6 +273,7 @@ typedef std::shared_ptr OSDMapRef; virtual spg_t primary_spg_t() const = 0; virtual pg_shard_t primary_shard() const = 0; + virtual uint64_t min_upacting_features() const = 0; virtual hobject_t get_temp_recovery_object(const hobject_t& target, eversion_t version) = 0; diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 39f3b04c28db..ba5a5123b42d 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -500,6 +500,9 @@ public: pg_shard_t primary_shard() const override { return primary; } + uint64_t min_upacting_features() const override { + return get_min_upacting_features(); + } void send_message_osd_cluster( int peer, Message *m, epoch_t from_epoch) override;