]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Move scrubber info out of recovery_state and add fields to scrubber::dump()
authorDavid Zafman <dzafman@redhat.com>
Tue, 11 Aug 2020 02:51:12 +0000 (19:51 -0700)
committerDavid Zafman <dzafman@redhat.com>
Mon, 14 Sep 2020 16:36:09 +0000 (09:36 -0700)
Add scrubber::dump() function which is a more obvious place when adding fields
Indicate that the scrubber info in recovery_state is deprecated

Signed-off-by: David Zafman <dzafman@redhat.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/PrimaryLogPG.cc

index 8e48546ac98a556beae7adce40575d5a6ae52139..3d220732ccc79bfea978407b7be64c7e1a278235 100644 (file)
@@ -3773,12 +3773,54 @@ void PG::handle_initialize(PeeringCtx &rctx)
   recovery_state.handle_event(evt, &rctx);
 }
 
+void PG::Scrubber::dump(Formatter *f)
+{
+  f->open_object_section("scrubber");
+  f->dump_stream("epoch_start") << epoch_start;
+  f->dump_bool("active", active);
+  if (active) {
+    f->dump_string("state", state_string(state));
+    f->dump_stream("start") << start;
+    f->dump_stream("end") << end;
+    f->dump_stream("max_end") << max_end;
+    f->dump_stream("subset_last_update") << subset_last_update;
+    f->dump_bool("deep", deep);
+    f->dump_bool("must_scrub", must_scrub);
+    f->dump_bool("must_deep_scrub", must_deep_scrub);
+    f->dump_bool("must_repair", must_repair);
+    f->dump_bool("need_auto", need_auto);
+    f->dump_bool("req_scrub", req_scrub);
+    f->dump_bool("time_for_deep", time_for_deep);
+    f->dump_bool("auto_repair", auto_repair);
+    f->dump_bool("check_repair", check_repair);
+    f->dump_bool("deep_scrub_on_error", deep_scrub_on_error);
+    f->dump_stream("scrub_reg_stamp") << scrub_reg_stamp; //utime_t
+    f->dump_stream("waiting_on_whom") << waiting_on_whom; //set<pg_shard_t>
+    f->dump_unsigned("priority", priority);
+    f->dump_int("shallow_errors", shallow_errors);
+    f->dump_int("deep_errors", deep_errors);
+    f->dump_int("fixed", fixed);
+    {
+      f->open_array_section("waiting_on_whom");
+      for (set<pg_shard_t>::iterator p = waiting_on_whom.begin();
+          p != waiting_on_whom.end();
+          ++p) {
+       f->dump_stream("shard") << *p;
+      }
+      f->close_section();
+    }
+  }
+  f->close_section();
+}
+
 void PG::handle_query_state(Formatter *f)
 {
   dout(10) << "handle_query_state" << dendl;
   PeeringState::QueryState q(f);
   recovery_state.handle_event(q, 0);
 
+  // This code has moved to after the close of recovery_state array.
+  // I don't think that scrub is a recovery state
   if (is_primary() && is_active()) {
     f->open_object_section("scrub");
     f->dump_stream("scrubber.epoch_start") << scrubber.epoch_start;
@@ -3798,6 +3840,7 @@ void PG::handle_query_state(Formatter *f)
       }
       f->close_section();
     }
+    f->dump_string("comment", "DEPRECATED - may be removed in the next release");
     f->close_section();
   }
 }
index 53eb3cb6820becd3142b178b9a5fe43714d3a705..2b17ba52c537da14fc6cd207e6a40ba2f81092ba 100644 (file)
@@ -1191,6 +1191,7 @@ public:
 
     void create_results(const hobject_t& obj);
     void cleanup_store(ObjectStore::Transaction *t);
+    void dump(ceph::Formatter *f);
   } scrubber;
 
 protected:
index 3bba568ce4c3943ccd8098c1e6e3a7f2e66d64e7..fbcb64c72e84f9a1ae1eaa9d66ef933faaaca222 100644 (file)
@@ -1006,6 +1006,10 @@ void PrimaryLogPG::do_command(
     handle_query_state(f.get());
     f->close_section();
 
+    if (is_primary() && is_active()) {
+      scrubber.dump(f.get());
+    }
+
     f->open_object_section("agent_state");
     if (agent_state)
       agent_state->dump(f.get());