]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/LogMonitor: simplify summary logic
authorSage Weil <sage@redhat.com>
Thu, 12 Apr 2018 18:40:41 +0000 (13:40 -0500)
committerSage Weil <sage@redhat.com>
Thu, 12 Apr 2018 21:07:20 +0000 (16:07 -0500)
Instead of sending the last 1 message, send from the last committed
segment.

This may be >1 entry, which is a bit odd, but otherwise the behavior is
similar.  Note that since the channel filtering is happening on the
client this may mean a higher chance of getting something visible at
all.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/LogMonitor.cc
src/mon/LogMonitor.h

index 2d785d4d884cb88213ea55133746324ad6b5fa58..bfcd2a42afa207c459f7976ed45a87c9a547611a 100644 (file)
@@ -563,12 +563,7 @@ void LogMonitor::check_sub(Subscription *s)
 
   if (s->next == 0) { 
     /* First timer, heh? */
-    bool ret = _create_sub_summary(mlog, sub_level);
-    if (!ret) {
-      dout(1) << __func__ << " ret = " << ret << dendl;
-      mlog->put();
-      return;
-    }
+    _create_sub_incremental(mlog, sub_level, get_last_committed());
   } else {
     /* let us send you an incremental log... */
     _create_sub_incremental(mlog, sub_level, s->next);
@@ -589,37 +584,6 @@ void LogMonitor::check_sub(Subscription *s)
     s->next = summary_version+1;
 }
 
-/**
- * Create a log message containing only the last message in the summary.
- *
- * @param mlog Log message we'll send to the client.
- * @param level Maximum log level the client is interested in.
- * @return     'true' if we consider we successfully populated @mlog;
- *             'false' otherwise.
- */
-bool LogMonitor::_create_sub_summary(MLog *mlog, int level)
-{
-  dout(10) << __func__ << dendl;
-
-  assert(mlog != NULL);
-
-  if (!summary.tail.size())
-    return false;
-
-  list<LogEntry>::reverse_iterator it = summary.tail.rbegin();
-  for (; it != summary.tail.rend(); ++it) {
-    LogEntry e = *it;
-    if (e.prio < level)
-      continue;
-
-    mlog->entries.push_back(e);
-    mlog->version = summary.version;
-    break;
-  }
-
-  return true;
-}
-
 /**
  * Create an incremental log message from version \p sv to \p summary.version
  *
index 7c8043689ec0af3e4930885ede4b5e6da02cf321..023251609e693782b1104abab2c2c1eebebf6161 100644 (file)
@@ -155,7 +155,6 @@ private:
   bool preprocess_command(MonOpRequestRef op);
   bool prepare_command(MonOpRequestRef op);
 
-  bool _create_sub_summary(MLog *mlog, int level);
   void _create_sub_incremental(MLog *mlog, int level, version_t sv);
 
  public: