]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-kvstore-tool: rename repair -> destructive-repair 33195/head
authorSage Weil <sage@redhat.com>
Tue, 9 Oct 2018 14:13:41 +0000 (09:13 -0500)
committerKefu Chai <kchai@redhat.com>
Tue, 11 Feb 2020 11:06:32 +0000 (19:06 +0800)
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 <sage@redhat.com>
(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.

doc/man/8/ceph-kvstore-tool.rst
src/test/cli/ceph-kvstore-tool/help.t
src/tools/ceph_kvstore_tool.cc

index bcea79694a95660239c223036d66e00966d849ae..00357ee9e30ac81f0d4699f133d57a67cd781064 100644 (file)
@@ -72,8 +72,10 @@ which are as follows:
 :command:`compact-range <prefix> <start> <end>`
     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
 ============
index 3556d3483c06980fd2086ff2675092c07a448425..a6bd0066422790db2b422319812e2df665c1517d 100644 (file)
@@ -16,6 +16,6 @@
     compact
     compact-prefix <prefix>
     compact-range <prefix> <start> <end>
-    repair
+    destructive-repair  (use only as last resort! may corrupt healthy data)
   
   [1]
index 079023cd99e251c51b93ce5b98e67765d20e0d3e..140a5087ffb973bb4df246dfd1f77033983297db 100644 (file)
@@ -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 <prefix>\n"
     << "  compact-range <prefix> <start> <end>\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") {