]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/OpTracker: don't dump ops if tracking is not enabled
authorZhiqiang Wang <zhiqiang.wang@intel.com>
Mon, 30 Mar 2015 06:41:21 +0000 (14:41 +0800)
committerDavid Zafman <dzafman@redhat.com>
Mon, 21 Nov 2016 19:40:03 +0000 (11:40 -0800)
If tracking is disabled, there is nothing to dump. No need to go through
each sharded list. This is true for both in flight and historical ops.

Signed-off-by: Zhiqiang Wang <zhiqiang.wang@intel.com>
(cherry picked from commit ec3c40952bbc4b495875e08b57d764a7487c6c09)

src/mds/MDS.cc
src/osd/OSD.cc

index 69d6be05a4953e64e2e4a0a55a25b5fcb6a54d6c..66232acbb9df88a8d386e8bfcd3d0ccffff2ebba 100644 (file)
@@ -242,9 +242,17 @@ bool MDS::asok_command(string command, cmdmap_t& cmdmap, string format,
       f->dump_string("error", "mds_not_active");
     } else if (command == "dump_ops_in_flight" ||
               command == "ops") {
-      op_tracker.dump_ops_in_flight(f);
+      if (!op_tracker.tracking_enabled) {
+        ss << "op_tracker tracking is not enabled";
+      } else {
+        op_tracker.dump_ops_in_flight(f);
+      }
     } else if (command == "dump_historic_ops") {
-      op_tracker.dump_historic_ops(f);
+      if (!op_tracker.tracking_enabled) {
+       ss << "op_tracker tracking is not enabled";
+      } else {
+        op_tracker.dump_historic_ops(f);
+      }
     } else if (command == "osdmap barrier") {
       int64_t target_epoch = 0;
       bool got_val = cmd_getval(g_ceph_context, cmdmap, "target_epoch", target_epoch);
index fc9674d099fd90a1c09d7a6071f6e57a64551d4c..d49b64ada942c7ac8cc63aaf2a171c22f9765755 100644 (file)
@@ -1685,9 +1685,17 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format,
     store->sync_and_flush();
   } else if (command == "dump_ops_in_flight" ||
             command == "ops") {
-    op_tracker.dump_ops_in_flight(f);
+    if (!op_tracker.tracking_enabled) {
+      ss << "op_tracker tracking is not enabled";
+    } else {
+      op_tracker.dump_ops_in_flight(f);
+    }
   } else if (command == "dump_historic_ops") {
-    op_tracker.dump_historic_ops(f);
+    if (!op_tracker.tracking_enabled) {
+      ss << "op_tracker tracking is not enabled";
+    } else {
+      op_tracker.dump_historic_ops(f);
+    }
   } else if (command == "dump_op_pq_state") {
     f->open_object_section("pq");
     op_shardedwq.dump(f);