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: v16.1.0~1160^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8f9d335bc7cccb221ca7316ee0c8f22198d0f9ef;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 --- diff --git a/src/include/ceph_features.h b/src/include/ceph_features.h index 88813e4f440..78a74a6df69 100644 --- a/src/include/ceph_features.h +++ b/src/include/ceph_features.h @@ -115,7 +115,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) -// available +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, LUMINOUS) DEFINE_CEPH_FEATURE(24, 2, RECOVERY_RESERVATION_2) @@ -246,6 +246,7 @@ DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facin CEPH_FEATUREMASK_SERVER_OCTOPUS | \ CEPH_FEATUREMASK_OSD_REPOP_MLCOD | \ CEPH_FEATUREMASK_SERVER_PACIFIC | \ + 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 630df7a57f4..4025afc8b8d 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -366,13 +366,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; @@ -401,13 +412,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 de60db344fb..ad49626c583 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_peer_features() 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 84e503e9800..6ddd9d88ec9 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -536,6 +536,9 @@ public: uint64_t min_peer_features() const override { return recovery_state.get_min_peer_features(); } + uint64_t min_upacting_features() const override { + return recovery_state.get_min_upacting_features(); + } void send_message_osd_cluster( int peer, Message *m, epoch_t from_epoch) override { osd->send_message_osd_cluster(peer, m, from_epoch);