]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-kvstore-tool: rename repair -> destructive-repair 24494/head
authorSage Weil <sage@redhat.com>
Tue, 9 Oct 2018 14:13:41 +0000 (09:13 -0500)
committerSage Weil <sage@redhat.com>
Sun, 14 Oct 2018 16:41:24 +0000 (11:41 -0500)
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>
PendingReleaseNotes
doc/man/8/ceph-kvstore-tool.rst
qa/workunits/cephtool/test_kvstore_tool.sh
src/test/cli/ceph-kvstore-tool/help.t
src/tools/ceph_kvstore_tool.cc

index 1ca362d57563c803431b982b1b95b653a3b7e5ca..07fe31ada1cfab098cc570ede7db9c72474426dc 100644 (file)
 
     ceph auth caps client.bad osd 'allow rwx pool foo'
 
+* The ``ceph-kvstore-tool`` ``repair`` command has been renamed
+  ``destructive-repair`` since we have discovered it can corrupt an
+  otherwise healthy rocksdb database.  It should be used only as a last-ditch
+  attempt to recover data from an otherwise corrupted store.
 
 
 
index da53d9ce34267bf3bc2b9ae7e53fdc3da0b69a32..7ef0ab3e2b9f17b96c8e8c091bd4cdf94dc97ed0 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 b52f3b2a6726d8267de73f817a72ff31e21c9f78..b7953dd216950f617d84dee72c057155c5cbbcba 100755 (executable)
@@ -59,8 +59,8 @@ function test_ceph_kvstore_tool()
   # compact
   ceph-kvstore-tool bluestore-kv ${TEMP_DIR} compact
 
-  # repair 
-  ceph-kvstore-tool bluestore-kv ${TEMP_DIR} repair 
+  # destructive-repair 
+  ceph-kvstore-tool bluestore-kv ${TEMP_DIR} destructive-repair 
 
   current_kv_nums=`ceph-kvstore-tool  bluestore-kv ${TEMP_DIR} list 2>/dev/null | wc -l`
   test ${origin_kv_nums} -eq ${current_kv_nums}
index eab57fdb5bc3fa2150670fe193f1c0c0573a8435..0d6041a44bfd207acdaf05a0033aa63a46566f82 100644 (file)
@@ -16,5 +16,5 @@
     compact
     compact-prefix <prefix>
     compact-range <prefix> <start> <end>
-    repair
+    destructive-repair  (use only as last resort! may corrupt healthy data)
   
index 0496025291ec7d8fb5470a222deb62ffb53fc743..4198f09a5d2b57a0d1f60065d4e1485a9e1cbe16 100644 (file)
@@ -285,7 +285,7 @@ class StoreTool
     db->compact_range(prefix, start, end);
   }
 
-  int repair() {
+  int destructive_repair() {
     return db->repair(std::cout);
   }
 };
@@ -309,7 +309,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;
 }
 
@@ -355,15 +355,17 @@ int main(int argc, const char *argv[])
     return 1;
   }
 
-  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") {