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
Conversation
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>
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; |
There was a problem hiding this comment.
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", \ |
There was a problem hiding this comment.
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>