]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: be_select_auth_object() gives chksum objectstore priority if osd_distrust_data_d...
authorDavid Zafman <dzafman@redhat.com>
Fri, 20 Jul 2018 15:09:52 +0000 (08:09 -0700)
committerDavid Zafman <dzafman@redhat.com>
Thu, 26 Jul 2018 22:03:27 +0000 (15:03 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 4df59f8735afe7585803da4130e7e93e9f4946d3)

src/osd/PGBackend.cc
src/osd/osd_types.h

index b5e60943582488465d72383d0260e85bfd647d01..92d72cec744a09de1dae871a58d9c3c2f9fb0d18 100644 (file)
@@ -740,9 +740,12 @@ bool PGBackend::be_compare_scrub_objects(
   return error == FOUND_ERROR;
 }
 
-static int dcount(const object_info_t &oi)
+static int dcount(const object_info_t &oi, bool prioritize)
 {
   int count = 0;
+  // Prioritize bluestore objects when osd_distrust_data_digest is set
+  if (prioritize)
+    count += 1000;
   if (oi.is_data_digest())
     count++;
   if (oi.is_omap_digest())
@@ -760,6 +763,7 @@ map<pg_shard_t, ScrubMap *>::const_iterator
   bool &digest_match)
 {
   eversion_t auth_version;
+  bool auth_prio = false;
   bufferlist first_oi_bl, first_ss_bl, first_hk_bl;
 
   // Create list of shards with primary first so it will be auth copy all
@@ -777,6 +781,7 @@ map<pg_shard_t, ScrubMap *>::const_iterator
   map<pg_shard_t, ScrubMap *>::const_iterator auth = maps.end();
   digest_match = true;
   for (auto &l : shards) {
+    bool oi_prio = false;
     map<pg_shard_t, ScrubMap *>::const_iterator j = maps.find(l);
     map<hobject_t, ScrubMap::object>::iterator i =
       j->second->objects.find(obj);
@@ -915,11 +920,21 @@ map<pg_shard_t, ScrubMap *>::const_iterator
     if (shard_info.errors)
       goto out;
 
+    // XXX: Do I want replicated only?
+    if (parent->get_pool().is_replicated() && cct->_conf->osd_distrust_data_digest) {
+      // This is a boost::optional<bool> so see if option set AND it has the value true
+      // We give priority to a replica where the ObjectStore like BlueStore has builtin checksum
+      if (j->second->has_builtin_csum && j->second->has_builtin_csum == true) {
+        oi_prio = true;
+      }
+    }
+
     if (auth_version == eversion_t() || oi.version > auth_version ||
-        (oi.version == auth_version && dcount(oi) > dcount(*auth_oi))) {
+        (oi.version == auth_version && dcount(oi, oi_prio) > dcount(*auth_oi, auth_prio))) {
       auth = j;
       *auth_oi = oi;
       auth_version = oi.version;
+      auth_prio = oi_prio;
     }
 
 out:
index 4fe40c3c2fe7a77ccf58aaceb175549e4a78fadd..c211c58bbd17fb6a6084fa2bc46ce68dc23b4e4f 100644 (file)
@@ -4965,6 +4965,7 @@ struct ScrubMap {
   eversion_t valid_through;
   eversion_t incr_since;
   bool has_large_omap_object_errors:1;
+  boost::optional<bool> has_builtin_csum;
 
   void merge_incr(const ScrubMap &l);
   void clear_from(const hobject_t& start) {