]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: select interval sort order based on OSDMap
authorSage Weil <sage@redhat.com>
Fri, 7 Aug 2015 20:06:39 +0000 (16:06 -0400)
committerSage Weil <sage@redhat.com>
Fri, 7 Aug 2015 20:23:46 +0000 (16:23 -0400)
If the OSDMap says sort bitwise, sort bitwise... unless we have
enabled osd_debug_randomize_hobject_sort_order, in which case
sometimes we won't.

If the OSDMap doesn't say sort bitwise, don't.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc
src/osd/PG.h

index f4a7af0665d613c7cf01b775a2122a312ebe54c4..dce03559a4efb46ee727232349abc23eee700459 100644 (file)
@@ -218,7 +218,7 @@ PG::PG(OSDService *o, OSDMapRef curmap,
   peer_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
   acting_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
   upacting_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
-  randomly_sort_nibblewise(false)
+  do_sort_bitwise(false)
 {
 #ifdef PG_DEBUG_REFS
   osd->add_pgid(p, this);
@@ -4840,13 +4840,16 @@ void PG::on_new_interval()
     upacting_features &= osdmap->get_xinfo(*p).features;
   }
 
-  if (g_conf->osd_debug_randomize_hobject_sort_order) {
-    // randomly use a nibblewise sort (when we otherwise might have
-    // done bitwise) based on some *deterministic* function such that
-    // all peers/osds will agree.
-    randomly_sort_nibblewise = (info.history.same_interval_since + info.pgid.ps()) & 1;
-  } else {
-    randomly_sort_nibblewise = false;
+  do_sort_bitwise = get_osdmap()->test_flag(CEPH_OSDMAP_SORTBITWISE);
+  if (do_sort_bitwise) {
+    assert(get_min_upacting_features() & CEPH_FEATURE_OSD_BITWISE_HOBJ_SORT);
+    if (g_conf->osd_debug_randomize_hobject_sort_order) {
+      // randomly use a nibblewise sort (when we otherwise might have
+      // done bitwise) based on some *deterministic* function such that
+      // all peers/osds will agree.
+      do_sort_bitwise =
+       (info.history.same_interval_since + info.pgid.ps()) & 1;
+    }
   }
 
   _on_new_interval();
index fcc6ec12d7ef4ffbe87d3f3e14fef0fb22808b96..4eddc67686ff024ca7a0f435260aefe5bc878e6b 100644 (file)
@@ -2033,7 +2033,7 @@ public:
   uint64_t acting_features;
   uint64_t upacting_features;
 
-  bool randomly_sort_nibblewise;
+  bool do_sort_bitwise;
 
  public:
   const spg_t&      get_pgid() const { return pg_id; }
@@ -2050,8 +2050,7 @@ public:
 
   /// true if we will sort hobjects bitwise for this pg interval
   bool get_sort_bitwise() const {
-    return (get_min_upacting_features() & CEPH_FEATURE_OSD_BITWISE_HOBJ_SORT) &&
-      !randomly_sort_nibblewise;
+    return do_sort_bitwise;
   }
 
   void init_primary_up_acting(