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
osd: add "heap *" admin command #13073
osd: add "heap *" admin command #13073
Conversation
@chardan mentioned one of the commits (I'm guessing the rgw one) mistakenly made it into the branch. He will be rebasing the branch and repushing soon. |
21a8ef0
to
894f117
Compare
qa/workunits/cephtool/test.sh
Outdated
|
||
[[ $do_test -eq 0 ]] && return 0 | ||
|
||
admin_socket = "--admin-deamon out/osd.0.asok" |
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.
typo: should be daemon
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.
Good eyes! Thanks.
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.
this still needs to be fixed it looks like?
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 at first, you don't succeed... (should be corrected now, thank you).
nice cleanup to share the command implementation! looks like it'll need a rebase for the command->admin_command rename |
src/osd/OSD.cc
Outdated
string cmd; | ||
std::vector<std::string> cmd_vec; | ||
|
||
if (false == cmd_getval(&cct, cmdmap, "heapcmd", cmd)) { |
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.
usually we don't do yoda conditions - any reason to avoid !cmd_getval(...) here?
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.
lol @"yoda conditions". No reason here, and changing it makes it consistent with the rest of the function.
The build error in jenkins looks real:
other than that lgtm. |
Not sure why I didn't see that build issue locally, but I just did a clean build with this patch. |
I'm getting the same error as jenkins when building locally - perhaps due to merging with the latest master |
@chardan could you squash the commits into a single one? |
@tchaikov Sure-- would you rather see all of them together, or do you mean that you want the "corrections" commits squashed? Thanks! |
@chardan the latter. =) sorry for the confusion! |
Hi, it would be better to update commit message and PR' title, likes: |
832f0ae
to
8c79cd1
Compare
@tchaikov: I'm working on figuring out how to do that, but it looks like it is beyond my feeble git-fu at this time. (I believe the problem is the merge commit-- when I "git rebase -i HEAD~2", it's picking up all the individual commits in the merge. I'm not sure what the right way around this is, ideas more than welcomed!) |
@chardan you need to remove the merge commit first, here is how i do this git rebase -i 5c18dd4~
# 1. remove all commits way down to 8c79cd1 (exclusive) in the editor
# 2. resolve the conflict
# 3. reorder the commits and squash the related ones
# 4. voilà |
Personally, I think the commit messages are verbose enough as they are, and do not necessarily need to be changed. However, I'm with @tchaikov on the commits needing squashing, and I would not mind the commits being properly rebased on top of master instead of having merge commits polluting the branch's history :) (edit: seems like I didn't refresh the page and the party continued in the mean time; consider above comments with that in mind) |
8c79cd1
to
b093bf5
Compare
test this please |
@chardan @jdurgin FYI Build failed: [ 34%] Building CXX object src/CMakeFiles/common-objs.dir/log/Log.cc.o |
qa/workunits/cephtool/test.sh
Outdated
@@ -1726,7 +1726,7 @@ function test_admin_heap_profiler() | |||
|
|||
[[ $do_test -eq 0 ]] && return 0 | |||
|
|||
admin_socket = "--admin-deamon out/osd.0.asok" | |||
admin_socket = "--admin-daemon out/osd.0.asok" |
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.
please squash this change into 48116a6
@@ -1951,9 +1951,9 @@ bool OSD::asok_command(string admin_command, cmdmap_t& cmdmap, string format, | |||
f->dump_bool("success", success); | |||
f->dump_int("value", value); | |||
f->close_section(); | |||
} else if (command == "dump_objectstore_kv_stats") { | |||
} else if (admin_command == "dump_objectstore_kv_stats") { |
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.
and squash this change into 1371e27
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.
Done.
namespace ceph { | ||
namespace osd_cmds { | ||
|
||
int heap(CephContext& cct, cmdmap_t& cmdmap, Formatter& f, std::ostream& os) |
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.
nit, this helper function should be in an anonymous namespace.
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.
The reason I've added them to a named namespace is that I foresee moving these into a new source module. One factor is that this having a function that works in both consoles is a different pattern than already exists in the code; they have to be given some sort of name, and I think the namespace helps to make the purpose clear. As more such commands are added, I'm confident the organizational benefit will provide better returns than for this single function.
src/osd/OSD.h
Outdated
namespace ceph { | ||
namespace osd_cmds { | ||
|
||
int heap(CephContext& cct, cmdmap_t& cmdmap, Formatter& f, std::ostream& os); |
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.
it's not necessary to have this declaration in the header file. it's only used in OSD.cc
.
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.
I agree, will do. I think ultimately the "real" right solution is to split these into their own source file away from the other OSD.cc code, but that's a much more significant change.
store->get_db_statistics(f); | ||
} else if (command == "dump_scrubs") { | ||
} else if (admin_command == "dump_scrubs") { |
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.
you should also change https://github.com/ceph/ceph/pull/13073/files#diff-fa6c2eba8356ae1442d1bf749beacfdfR1958.
@@ -1782,20 +1782,20 @@ class OSDSocketHook : public AdminSocketHook { | |||
OSD *osd; | |||
public: | |||
explicit OSDSocketHook(OSD *o) : osd(o) {} | |||
bool call(std::string command, cmdmap_t& cmdmap, std::string format, | |||
bool call(std::string admin_command, cmdmap_t& cmdmap, std::string format, |
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.
i don't understand how this helps us to search the admin_command? IIUC, all commands in OSD.cc are admin commands.
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.
Consider the console commands, around line 5509 or so. It was not obvious to me which of these were "admin" vs. "console" commands at first, and having the above change in would have saved me quite a bit of time. That said, the reason the change is in a separate commit is because it's indeed optional; if there are a lot of strong feelings against it, we don't need to include it, but I know I would have found it helpful.
b093bf5
to
8e2734f
Compare
8e2734f
to
7e01e47
Compare
Any next steps or things I should attend to here? Thanks to everyone for the great input! |
4511cd7
to
38903e2
Compare
@chardan needs rebase. |
Fixes: http://tracker.ceph.com/issues/15475 Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
38903e2
to
2823b75
Compare
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
2823b75
to
fc4a4aa
Compare
jenkins: retest this please |
Extends the OSD admin console with a heap profiling command.