]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-monstore-tool: dump paxos transactions
authorSage Weil <sage@inktank.com>
Sun, 21 Jul 2013 14:57:23 +0000 (07:57 -0700)
committerSage Weil <sage@inktank.com>
Mon, 22 Jul 2013 21:12:51 +0000 (14:12 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/Paxos.h
src/tools/ceph-monstore-tool.cc

index cab27f289a882fd6f6050c36115d6138213a2a7d..3df238e19332ec9489d33aa2ccd9372b47d9803d 100644 (file)
@@ -1114,7 +1114,7 @@ public:
    * @param t The transaction to which we will append the operations
    * @param bl A bufferlist containing an encoded transaction
    */
-  void decode_append_transaction(MonitorDBStore::Transaction& t,
+  static void decode_append_transaction(MonitorDBStore::Transaction& t,
                                 bufferlist& bl) {
     MonitorDBStore::Transaction vt;
     bufferlist::iterator it = bl.begin();
index ae608a302f2c017ce5b7fc670c6dfd2e948976a5..f361266aff0bd58d282cb103cdabab2315551a0a 100644 (file)
@@ -31,6 +31,7 @@
 #include "global/global_init.h"
 #include "os/LevelDBStore.h"
 #include "mon/MonitorDBStore.h"
+#include "mon/Paxos.h"
 #include "common/Formatter.h"
 
 namespace po = boost::program_options;
@@ -246,6 +247,19 @@ int main(int argc, char **argv) {
       goto done;
     }
     bl.write_fd(fd);
+  } else if (cmd == "dump-paxos") {
+    for (version_t v = dstart; v <= dstop; ++v) {
+      bufferlist bl;
+      st.get("paxos", v, bl);
+      if (bl.length() == 0)
+       break;
+      cout << "\n--- " << v << " ---" << std::endl;
+      MonitorDBStore::Transaction tx;
+      Paxos::decode_append_transaction(tx, bl);
+      JSONFormatter f(true);
+      tx.dump(&f);
+      f.flush(cout);
+    }
   } else if (cmd == "dump-trace") {
     if (tfile.empty()) {
       std::cerr << "Need trace_file" << std::endl;