From: NitzanMordhai Date: Wed, 8 Jun 2022 13:41:13 +0000 (+0000) Subject: osd: add option to dump pg log to pg command X-Git-Tag: v18.0.0~624^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5ccce8d0236ebf89d7083fc202de0545e10f889f;p=ceph.git osd: add option to dump pg log to pg command Currently we need to stop the cluster and use ceph_objectstore_tool to dump pg log with that commit we will be able to dump pg logs with PG command Signed-off-by: Nitzan Mordechai --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index ef55e440b06c..03c6553395e9 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2527,6 +2527,7 @@ void OSD::asok_command( // --- PG commands are routed here to PG::do_command --- if (prefix == "pg" || prefix == "query" || + prefix == "log" || prefix == "mark_unfound_lost" || prefix == "list_unfound" || prefix == "scrub" || @@ -4188,6 +4189,13 @@ void OSD::final_init() asok_hook, ""); ceph_assert(r == 0); + r = admin_socket->register_command( + "pg " \ + "name=pgid,type=CephPgid " \ + "name=cmd,type=CephChoices,strings=log", + asok_hook, + ""); + ceph_assert(r == 0); r = admin_socket->register_command( "pg " \ "name=pgid,type=CephPgid " \ @@ -4226,6 +4234,11 @@ void OSD::final_init() asok_hook, "show details of a specific pg"); ceph_assert(r == 0); + r = admin_socket->register_command( + "log", + asok_hook, + "dump pg_log of a specific pg"); + ceph_assert(r == 0); r = admin_socket->register_command( "mark_unfound_lost " \ "name=pgid,type=CephPgid,req=false " \ diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 1b60dfc0793a..b71c2eab8093 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -1038,7 +1038,14 @@ void PrimaryLogPG::do_command( f->close_section(); } - + else if (prefix == "log") { + + f->open_object_section("op_log"); + f->open_object_section("pg_log_t"); + recovery_state.get_pg_log().get_log().dump(f.get()); + f->close_section(); + f->close_section(); + } else if (prefix == "mark_unfound_lost") { string mulcmd; cmd_getval(cmdmap, "mulcmd", mulcmd);