]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: add osd_distrust_data_digest option 23184/head
authorSage Weil <sage@redhat.com>
Mon, 23 Jul 2018 15:11:53 +0000 (10:11 -0500)
committerSage Weil <sage@redhat.com>
Mon, 23 Jul 2018 15:11:53 +0000 (10:11 -0500)
If we have reason to distrust the stored full-object oi data digests,
this option will ignore them (and opportunistically clear them).  It
basically affects the same behaviors that osd_skip_data_digest except
the previous option only takes effect if bluestore is in use, while this
option is unconditional.

This serves a workaround for clusters that suffered the 12.2.6 bug that
produced bad full-object digests and *also* had PGs' primaries move from
bluestore to filestore nodes.  In those situations, this option can be
set to true.

After all OSDs are upgrade and all PGs come back with a clean deep
scrub this option can be disabled again.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit b8476ebc5b3c5b5d801bf875bbd6dce5b113325c)

# Conflicts:
# src/osd/PrimaryLogPG.cc

- osd->osd_skip_data_digest, not g_conf->osd_skip_data_digest

src/common/legacy_config_opts.h
src/common/options.cc
src/osd/PrimaryLogPG.cc

index ee642b1ca9ebd4df55013e2486f85400c8960089..b77e75ea5e9b288e6d5cde743d5015d799ea3e37 100644 (file)
@@ -737,6 +737,7 @@ OPTION(osd_deep_scrub_stride, OPT_INT)
 OPTION(osd_deep_scrub_keys, OPT_INT)
 OPTION(osd_deep_scrub_update_digest_min_age, OPT_INT)   // objects must be this old (seconds) before we update the whole-object digest on scrub
 OPTION(osd_skip_data_digest, OPT_BOOL)
+OPTION(osd_distrust_data_digest, OPT_BOOL)
 OPTION(osd_deep_scrub_large_omap_object_key_threshold, OPT_U64)
 OPTION(osd_deep_scrub_large_omap_object_value_sum_threshold, OPT_U64)
 OPTION(osd_class_dir, OPT_STR) // where rados plugins are stored
index 35fade3fd6365aad158bbb336f00b6265836e747..dd7c5d37444d248b7a23ac34888ca5f6088bbb5f 100644 (file)
@@ -2320,6 +2320,10 @@ std::vector<Option> get_global_options() {
     .set_default(false)
     .set_description("Do not store full-object checksums if the backend (bluestore) does its own checksums.  Only usable with all BlueStore OSDs."),
 
+    Option("osd_distrust_data_digest", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(false)
+    .set_description("Do not trust stored data_digest (due to previous bug or corruption)"),
+
     Option("osd_op_queue", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .set_default("wpq")
     .set_enum_allowed( { "wpq", "prioritized", "mclock_opclass", "mclock_client", "debug_random" } )
index eafd3a32b1c1ec1607a97833680c4978394015f9..02ab4b7daba107951182cb28e4c368a258b729c6 100644 (file)
@@ -5082,8 +5082,9 @@ int PrimaryLogPG::do_checksum(OpContext *ctx, OSDOp& osd_op,
                              bufferlist::iterator *bl_it)
 {
   dout(20) << __func__ << dendl;
-  bool skip_data_digest = osd->store->has_builtin_csum() &&
-    osd->osd_skip_data_digest;
+  bool skip_data_digest =
+    (osd->store->has_builtin_csum() && osd->osd_skip_data_digest) ||
+    g_conf->osd_distrust_data_digest;
 
   auto& op = osd_op.op;
   if (op.checksum.chunk_size > 0) {
@@ -5300,8 +5301,9 @@ int PrimaryLogPG::do_extent_cmp(OpContext *ctx, OSDOp& osd_op)
 {
   dout(20) << __func__ << dendl;
   ceph_osd_op& op = osd_op.op;
-  bool skip_data_digest = osd->store->has_builtin_csum() &&
-    osd->osd_skip_data_digest;
+  bool skip_data_digest =
+    (osd->store->has_builtin_csum() && osd->osd_skip_data_digest) ||
+    g_conf->osd_distrust_data_digest;
 
   auto& oi = ctx->new_obs.oi;
   uint64_t size = oi.size;
@@ -5385,8 +5387,9 @@ int PrimaryLogPG::do_read(OpContext *ctx, OSDOp& osd_op) {
   __u32 seq = oi.truncate_seq;
   uint64_t size = oi.size;
   bool trimmed_read = false;
-  bool skip_data_digest = osd->store->has_builtin_csum() &&
-    osd->osd_skip_data_digest;
+  bool skip_data_digest =
+    (osd->store->has_builtin_csum() && osd->osd_skip_data_digest) ||
+    g_conf->osd_distrust_data_digest;
 
   // are we beyond truncate_size?
   if ( (seq < op.extent.truncate_seq) &&
@@ -5472,8 +5475,9 @@ int PrimaryLogPG::do_sparse_read(OpContext *ctx, OSDOp& osd_op) {
   auto& op = osd_op.op;
   auto& oi = ctx->new_obs.oi;
   auto& soid = oi.soid;
-  bool skip_data_digest = osd->store->has_builtin_csum() &&
-    osd->osd_skip_data_digest;
+  bool skip_data_digest =
+    (osd->store->has_builtin_csum() && osd->osd_skip_data_digest) ||
+    g_conf->osd_distrust_data_digest;
 
   if (op.extent.truncate_seq) {
     dout(0) << "sparse_read does not support truncation sequence " << dendl;
@@ -5618,8 +5622,9 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
   ObjectState& obs = ctx->new_obs;
   object_info_t& oi = obs.oi;
   const hobject_t& soid = oi.soid;
-  const bool skip_data_digest = osd->store->has_builtin_csum() &&
-    osd->osd_skip_data_digest;
+  const bool skip_data_digest =
+    (osd->store->has_builtin_csum() && osd->osd_skip_data_digest) ||
+    g_conf->osd_distrust_data_digest;
 
   PGTransaction* t = ctx->op_t.get();
 
@@ -8529,8 +8534,9 @@ int PrimaryLogPG::do_copy_get(OpContext *ctx, bufferlist::iterator& bp,
   int result = 0;
   object_copy_cursor_t cursor;
   uint64_t out_max;
-  bool skip_data_digest = osd->store->has_builtin_csum() &&
-    osd->osd_skip_data_digest;
+  bool skip_data_digest =
+    (osd->store->has_builtin_csum() && osd->osd_skip_data_digest) ||
+    g_conf->osd_distrust_data_digest;
 
   try {
     decode(cursor, bp);