From: Sage Weil Date: Tue, 9 Oct 2018 14:13:41 +0000 (-0500) Subject: ceph-kvstore-tool: rename repair -> destructive-repair X-Git-Tag: v12.2.14~18^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F33195%2Fhead;p=ceph.git ceph-kvstore-tool: rename repair -> destructive-repair This is shown to corrupt otherwise healthy rocksdb databases. Rename to make it clear that it is generally not safe to run and shoud only be used as a last resort. Signed-off-by: Sage Weil (cherry picked from commit 8cc636951132c2ee93e32bfc999777e3da023dd7) Conflicts: PendingReleaseNotes: drop this change as "repair" command did not exist in luminous before this change. qa/workunits/cephtool/test_kvstore_tool.sh: drop this change, as this test was not added before this change. src/tools/ceph_kvstore_tool.cc: trivial resolution. --- diff --git a/doc/man/8/ceph-kvstore-tool.rst b/doc/man/8/ceph-kvstore-tool.rst index bcea79694a95..00357ee9e30a 100644 --- a/doc/man/8/ceph-kvstore-tool.rst +++ b/doc/man/8/ceph-kvstore-tool.rst @@ -72,8 +72,10 @@ which are as follows: :command:`compact-range ` Compact some entries specified by the URL encoded prefix and range. -:command:`repair` - Try to repair the kvstore. +:command:`destructive-repair` + Make a (potentially destructive) effort to recover a corrupted database. + Note that in the case of rocksdb this may corrupt an otherwise uncorrupted + database--use this only as a last resort! Availability ============ diff --git a/src/test/cli/ceph-kvstore-tool/help.t b/src/test/cli/ceph-kvstore-tool/help.t index 3556d3483c06..a6bd00664227 100644 --- a/src/test/cli/ceph-kvstore-tool/help.t +++ b/src/test/cli/ceph-kvstore-tool/help.t @@ -16,6 +16,6 @@ compact compact-prefix compact-range - repair + destructive-repair (use only as last resort! may corrupt healthy data) [1] diff --git a/src/tools/ceph_kvstore_tool.cc b/src/tools/ceph_kvstore_tool.cc index 079023cd99e2..140a5087ffb9 100644 --- a/src/tools/ceph_kvstore_tool.cc +++ b/src/tools/ceph_kvstore_tool.cc @@ -282,7 +282,7 @@ class StoreTool db->compact_range(prefix, start, end); } - int repair() { + int destructive_repair() { return db->repair(std::cout); } }; @@ -306,7 +306,7 @@ void usage(const char *pname) << " compact\n" << " compact-prefix \n" << " compact-range \n" - << " repair\n" + << " destructive-repair (use only as last resort! may corrupt healthy data)\n" << std::endl; } @@ -331,15 +331,17 @@ int main(int argc, const char *argv[]) string path(args[1]); string cmd(args[2]); - bool need_open_db = (cmd != "repair"); + bool need_open_db = (cmd != "destructive-repair"); StoreTool st(type, path, need_open_db); - if (cmd == "repair") { - int ret = st.repair(); + if (cmd == "destructive-repair") { + int ret = st.destructive_repair(); if (!ret) { - std::cout << "repair kvstore successfully" << std::endl; + std::cout << "destructive-repair completed without reporting an error" + << std::endl; } else { - std::cout << "repair kvstore failed" << std::endl; + std::cout << "destructive-repair failed with " << cpp_strerror(ret) + << std::endl; } return ret; } else if (cmd == "list" || cmd == "list-crc") {