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: compact osd feature #16045
Merged
Merged
osd: compact osd feature #16045
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ | |
|
||
#include "common/errno.h" | ||
#include "common/ceph_argparse.h" | ||
#include "common/ceph_time.h" | ||
#include "common/version.h" | ||
#include "common/io_priority.h" | ||
|
||
|
@@ -159,6 +160,7 @@ | |
#undef dout_prefix | ||
#define dout_prefix _prefix(_dout, whoami, get_osdmap_epoch()) | ||
|
||
|
||
const double OSD::OSD_TICK_INTERVAL = 1.0; | ||
|
||
static ostream& _prefix(std::ostream* _dout, int whoami, epoch_t epoch) { | ||
|
@@ -2209,6 +2211,18 @@ bool OSD::asok_command(string admin_command, cmdmap_t& cmdmap, string format, | |
pg->unlock(); | ||
} | ||
f->close_section(); | ||
} else if (admin_command == "compact") { | ||
dout(1) << "triggering manual compaction" << dendl; | ||
auto start = ceph::coarse_mono_clock::now(); | ||
store->compact(); | ||
auto end = ceph::coarse_mono_clock::now(); | ||
auto time_span = chrono::duration_cast<chrono::duration<double>>(end - start); | ||
dout(1) << "finished manual compaction in " | ||
<< time_span.count() | ||
<< " seconds" << dendl; | ||
f->open_object_section("compact_result"); | ||
f->dump_float("elapsed_time", time_span.count()); | ||
f->close_section(); | ||
} else { | ||
assert(0 == "broken asok registration"); | ||
} | ||
|
@@ -2746,6 +2760,12 @@ void OSD::final_init() | |
"show recent state history"); | ||
assert(r == 0); | ||
|
||
r = admin_socket->register_command("compact", "compact", | ||
asok_hook, | ||
"Commpact object store's omap." | ||
" WARNING: Compaction probably slows your requests"); | ||
assert(r == 0); | ||
|
||
test_ops_hook = new TestOpsSocketHook(&(this->service), this->store); | ||
// Note: pools are CephString instead of CephPoolname because | ||
// these commands traditionally support both pool names and numbers | ||
|
@@ -3211,12 +3231,15 @@ int OSD::shutdown() | |
cct->get_admin_socket()->unregister_command("dump_watchers"); | ||
cct->get_admin_socket()->unregister_command("dump_reservations"); | ||
cct->get_admin_socket()->unregister_command("get_latest_osdmap"); | ||
cct->get_admin_socket()->unregister_command("heap"); | ||
cct->get_admin_socket()->unregister_command("set_heap_property"); | ||
cct->get_admin_socket()->unregister_command("get_heap_property"); | ||
cct->get_admin_socket()->unregister_command("dump_objectstore_kv_stats"); | ||
cct->get_admin_socket()->unregister_command("dump_scrubs"); | ||
cct->get_admin_socket()->unregister_command("calc_objectstore_db_histogram"); | ||
cct->get_admin_socket()->unregister_command("flush_store_cache"); | ||
cct->get_admin_socket()->unregister_command("dump_pgstate_history"); | ||
cct->get_admin_socket()->unregister_command("compact"); | ||
delete asok_hook; | ||
asok_hook = NULL; | ||
|
||
|
@@ -3228,6 +3251,8 @@ int OSD::shutdown() | |
cct->get_admin_socket()->unregister_command("injectdataerr"); | ||
cct->get_admin_socket()->unregister_command("injectmdataerr"); | ||
cct->get_admin_socket()->unregister_command("set_recovery_delay"); | ||
cct->get_admin_socket()->unregister_command("trigger_scrub"); | ||
cct->get_admin_socket()->unregister_command("injectfull"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This commit looks good. |
||
delete test_ops_hook; | ||
test_ops_hook = NULL; | ||
|
||
|
@@ -6193,6 +6218,10 @@ COMMAND("dump_pg_recovery_stats", "dump pg recovery statistics", | |
"osd", "r", "cli,rest") | ||
COMMAND("reset_pg_recovery_stats", "reset pg recovery statistics", | ||
"osd", "rw", "cli,rest") | ||
COMMAND("compact", | ||
"compact object store's omap. " | ||
"WARNING: Compaction probably slows your requests", | ||
"osd", "rw", "cli,rest") | ||
}; | ||
|
||
void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, bufferlist& data) | ||
|
@@ -6607,6 +6636,18 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe | |
} | ||
} | ||
|
||
else if (prefix == "compact") { | ||
dout(1) << "triggering manual compaction" << dendl; | ||
auto start = ceph::coarse_mono_clock::now(); | ||
store->compact(); | ||
auto end = ceph::coarse_mono_clock::now(); | ||
auto time_span = chrono::duration_cast<chrono::duration<double>>(end - start); | ||
dout(1) << "finished manual compaction in " | ||
<< time_span.count() | ||
<< " seconds" << dendl; | ||
ss << "compacted omap in " << time_span.count() << " seconds"; | ||
} | ||
|
||
else { | ||
ss << "unrecognized command! " << cmd; | ||
r = -EINVAL; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Need to see the impact to front end IO's when compaction is progress, from mark's runs we have seen a slowdown in IO's when compaction is in progress. It is better to warn users when issuing the command. We shouldn't be seeing any timeouts because of this invocation.