]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OpRequest: only show a small set of the oldest messages, instead of all.
authorJoao Eduardo Luis <jecluis@gmail.com>
Tue, 1 May 2012 18:55:30 +0000 (19:55 +0100)
committerSage Weil <sage@newdream.net>
Thu, 3 May 2012 22:49:51 +0000 (15:49 -0700)
Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
Reviewed-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/common/config_opts.h
src/osd/OpRequest.cc

index 1d5ba22057d767345cecfc1d586f791ac477f53f..7b6d6f3c80cd3b58d3be510c9507670ea5aa94bd 100644 (file)
@@ -325,6 +325,7 @@ OPTION(osd_kill_backfill_at, OPT_INT, 0)
 OPTION(osd_min_pg_log_entries, OPT_U32, 1000) // number of entries to keep in the pg log when trimming it
 OPTION(osd_op_complaint_time, OPT_FLOAT, 30) // how many seconds old makes an op complaint-worthy
 OPTION(osd_command_max_records, OPT_INT, 256)
+OPTION(osd_op_log_threshold, OPT_INT, 5) // how many op log messages to show in one go
 OPTION(filestore, OPT_BOOL, false)
 OPTION(filestore_debug_omap_check, OPT_BOOL, 0) // Expensive debugging check on sync
 // Use omap for xattrs for attrs over
index f10a3a944d847e6de67d3b2e85097994d0c0fd2f..5203b57407d408cc842a9f6c565f2af5952ac90f 100644 (file)
@@ -3,6 +3,7 @@
 #include "OpRequest.h"
 #include "common/Formatter.h"
 #include <iostream>
+#include <vector>
 #include "common/debug.h"
 #include "common/config.h"
 #include "msg/Message.h"
@@ -74,24 +75,55 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector)
   utime_t too_old = now;
   too_old -= g_conf->osd_op_complaint_time;
 
+  utime_t oldest_secs = now - ops_in_flight.front()->received_time;
+
   dout(10) << "ops_in_flight.size: " << ops_in_flight.size()
-           << "; oldest is " << now - ops_in_flight.front()->received_time
+           << "; oldest is " << oldest_secs
            << " seconds old" << dendl;
+
   xlist<OpRequest*>::iterator i = ops_in_flight.begin();
-  warning_vector.reserve(ops_in_flight.size());
+  warning_vector.reserve(g_conf->osd_op_log_threshold + 1);
+  warning_vector.push_back("");
+
+  int total = 0, skipped = 0;
+
   while (!i.end() && (*i)->received_time < too_old) {
     // exponential backoff of warning intervals
     if ( ( (*i)->received_time +
            (g_conf->osd_op_complaint_time *
             (*i)->warn_interval_multiplier) )< now) {
+
+      if (total++ >= g_conf->osd_op_log_threshold)
+        break;
+
       stringstream ss;
-      ss << "old request " << *((*i)->request) << " received at "
-          << (*i)->received_time << " currently " << (*i)->state_string();
-      (*i)->warn_interval_multiplier *= 2;
+      ss << "received at " << (*i)->received_time
+          << ": " << *((*i)->request) << " currently " << (*i)->state_string();
       warning_vector.push_back(ss.str());
+      // only those that have been shown will backoff
+      (*i)->warn_interval_multiplier *= 2;
+    } else {
+      skipped++;
     }
     ++i;
   }
+
+  stringstream ss;
+  ss << "there are " << ops_in_flight.size()
+      << " ops in flight; the oldest is blocked for >"
+      << oldest_secs << " secs";
+
+  if (total) {
+    ss << "; these are ";
+    if (!skipped)
+      ss << "the " << warning_vector.size()-1 << " oldest:";
+    else {
+      ss << warning_vector.size()-1 << " amongst the oldest ("
+          << skipped << " precedes them):";
+    }
+  }
+  warning_vector[0] = ss.str();
+
   return warning_vector.size();
 }