Merge pull request #12728 from Liuchang0812/fix-17861

osd: add asock command to dump the scrub queue

Reviewed-by: Samuel Just <sjust@redhat.com>
Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2017-01-05 22:07:31 +08:00 committed by GitHub
commit 0d5780c93d
2 changed files with 28 additions and 2 deletions

View File

@ -1937,6 +1937,8 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format,
f->close_section();
} else if (command == "dump_objectstore_kv_stats") {
store->get_db_statistics(f);
} else if (command == "dump_scrubs") {
service.dumps_scrub(f);
} else {
assert(0 == "broken asok registration");
}
@ -2395,8 +2397,16 @@ void OSD::final_init()
"get malloc extension heap property");
assert(r == 0);
r = admin_socket->register_command("dump_objectstore_kv_stats", "dump_objectstore_kv_stats", asok_hook,
"print statistics of kvdb which used by bluestore");
r = admin_socket->register_command("dump_objectstore_kv_stats",
"dump_objectstore_kv_stats",
asok_hook,
"print statistics of kvdb which used by bluestore");
assert(r == 0);
r = admin_socket->register_command("dump_scrubs",
"dump_scrubs",
asok_hook,
"print scheduled scrubs");
assert(r == 0);
test_ops_hook = new TestOpsSocketHook(&(this->service), this->store);

View File

@ -685,6 +685,22 @@ public:
return true;
}
void dumps_scrub(Formatter *f) {
assert(f != nullptr);
Mutex::Locker l(sched_scrub_lock);
f->open_array_section("scrubs");
for (const auto &i: sched_scrub_pg) {
f->open_object_section("scrub");
f->dump_stream("pgid") << i.pgid;
f->dump_stream("sched_time") << i.sched_time;
f->dump_stream("deadline") << i.deadline;
f->dump_bool("forced", i.sched_time == i.deadline);
f->close_section();
}
f->close_section();
}
bool can_inc_scrubs_pending();
bool inc_scrubs_pending();
void inc_scrubs_active(bool reserved);