]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add and utilize OSD_FIXED_COLLECTION_LIST feature
authorMykola Golub <mgolub@suse.com>
Thu, 30 Jul 2020 14:21:28 +0000 (15:21 +0100)
committerMykola Golub <mgolub@suse.com>
Wed, 9 Sep 2020 09:25:57 +0000 (12:25 +0300)
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 <mgolub@suse.com>
(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

src/include/ceph_features.h
src/osd/PGBackend.cc
src/osd/PGBackend.h
src/osd/PrimaryLogPG.h

index 5925b897d65e661d6d7526312286e76f089b466a..6fec3a0c5140e455489da039407fa87e153c4ca6 100644 (file)
@@ -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
index db24ed363f4fc6cb80c5b2af037df000cbc852c5..6c193c6ab772c1297bb4a4bf60b8cb50adec09dd 100644 (file)
@@ -350,13 +350,24 @@ int PGBackend::objects_list_partial(
 
   while (!_next.is_max() && ls->size() < (unsigned)min) {
     vector<ghobject_t> 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<ghobject_t> 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<ghobject_t>::iterator i = objects.begin();
        i != objects.end();
index e19695fcd6dbb855198981000575c79323525ad0..18ef723590f50da6af217517e3a2ac7c01d3b04f 100644 (file)
@@ -273,6 +273,7 @@ typedef std::shared_ptr<const OSDMap> 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;
 
index 39f3b04c28db7bb11feaa127a38ef995472f3ba3..ba5a5123b42d014c53284c30603bbe30f2e0df66 100644 (file)
@@ -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;