New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mon/LogMonitor: 'log last' command #15497

Merged
merged 5 commits into from Jun 7, 2017

Conversation

Projects
None yet
2 participants
@liewegas
Member

liewegas commented Jun 5, 2017

  • also clean up LogSummary class

liewegas added some commits Jun 5, 2017

common/LogEntry: make prune size tunable (and raise 50 -> 1024)
Signed-off-by: Sage Weil <sage@redhat.com>
common/LogEntry: make LogSummary::contains() efficient
A linear search here is dumb.  Use an unordered_set.

Signed-off-by: Sage Weil <sage@redhat.com>
mon/LogMonitor: 'log last [num]' command
Default to 20 lines of log if not specified.

Signed-off-by: Sage Weil <sage@redhat.com>

@liewegas liewegas requested review from jcsp and jdurgin Jun 5, 2017

@liewegas

This comment has been minimized.

Member

liewegas commented Jun 5, 2017

The use of LogSummary could stand to be rewritten, but this is simple and works (for up to 1024 recent entries).

@@ -97,24 +105,22 @@ WRITE_CLASS_ENCODER_FEATURES(LogEntry)
struct LogSummary {
version_t version;
list<LogEntry> tail;
ceph::unordered_set<LogEntryKey> keys;

This comment has been minimized.

@tchaikov

tchaikov Jun 6, 2017

Contributor

if we want to be spacial efficient, probably we can just keep the hashed LogEntryKey around?

@@ -197,6 +197,9 @@ COMMAND_WITH_FLAG("scrub", "scrub the monitor stores", \
COMMAND("fsid", "show cluster FSID/UUID", "mon", "r", "cli,rest")
COMMAND("log name=logtext,type=CephString,n=N", \
"log supplied text to the monitor log", "mon", "rw", "cli,rest")
COMMAND("log last name=num,type=CephInt,range=1,req=false", \

This comment has been minimized.

@tchaikov

tchaikov Jun 6, 2017

Contributor

can we have a test in, for example, src/test/mon/misc.sh ?

liewegas added some commits Jun 6, 2017

common/LogEntry: make LogEntryKey opaque and cache its hash value
This avoids recalculating.  We eliminate the default ctor at the same
time and make the type totally opaque (so that its fields cannot be
modified except by the ctor and decode).

Signed-off-by: Sage Weil <sage@redhat.com>
qa/workunits/cephtool/test.sh: test 'log last [n]'
Signed-off-by: Sage Weil <sage@redhat.com>

@tchaikov tchaikov merged commit b55b464 into ceph:master Jun 7, 2017

3 checks passed

Signed-off-by all commits in this PR are signed
Details
Unmodifed Submodules submodules for project are unmodified
Details
default Build finished.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment