From: David Zafman Date: Fri, 20 Jul 2018 15:09:52 +0000 (-0700) Subject: osd: be_select_auth_object() gives chksum objectstore priority if osd_distrust_data_d... X-Git-Tag: v13.2.2~117^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=87333dd8da55a44545744b18e0852ec037ac2c4d;p=ceph.git osd: be_select_auth_object() gives chksum objectstore priority if osd_distrust_data_digest true Signed-off-by: David Zafman (cherry picked from commit 4df59f8735afe7585803da4130e7e93e9f4946d3) --- diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index b5e609435824..92d72cec744a 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -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::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::const_iterator map::const_iterator auth = maps.end(); digest_match = true; for (auto &l : shards) { + bool oi_prio = false; map::const_iterator j = maps.find(l); map::iterator i = j->second->objects.find(obj); @@ -915,11 +920,21 @@ map::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 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: diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 4fe40c3c2fe7..c211c58bbd17 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -4965,6 +4965,7 @@ struct ScrubMap { eversion_t valid_through; eversion_t incr_since; bool has_large_omap_object_errors:1; + boost::optional has_builtin_csum; void merge_incr(const ScrubMap &l); void clear_from(const hobject_t& start) {