Skip to content
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
Merged

Conversation

liewegas
Copy link
Member

@liewegas liewegas commented Jun 5, 2017

  • also clean up LogSummary class

Signed-off-by: Sage Weil <sage@redhat.com>
A linear search here is dumb.  Use an unordered_set.

Signed-off-by: Sage Weil <sage@redhat.com>
Default to 20 lines of log if not specified.

Signed-off-by: Sage Weil <sage@redhat.com>
@liewegas
Copy link
Member Author

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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", \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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>
Signed-off-by: Sage Weil <sage@redhat.com>
@liewegas
Copy link
Member Author

liewegas commented Jun 7, 2017

@tchaikov tchaikov merged commit b55b464 into ceph:master Jun 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants