]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: output per-event errors from recover dentries 3338/head
authorJohn Spray <john.spray@redhat.com>
Mon, 19 Jan 2015 15:16:46 +0000 (15:16 +0000)
committerJohn Spray <john.spray@redhat.com>
Mon, 19 Jan 2015 15:16:46 +0000 (15:16 +0000)
src/tools/cephfs/EventOutput.cc
src/tools/cephfs/JournalScanner.h
src/tools/cephfs/JournalTool.cc

index 6af9497fd4fddbfd547063ae0e0d6d9c0263383d..342489952e20de35a52d638dc552809eb3050f55 100644 (file)
@@ -120,4 +120,14 @@ void EventOutput::summary() const
   for (std::map<std::string, int>::iterator i = type_count.begin(); i != type_count.end(); ++i) {
       std::cout << "  " << i->first << ": " << i->second << std::endl;
   }
+
+  std::cout << "Errors: " << scan.errors.size() << std::endl;
+  if (scan.errors.size()) {
+    for (JournalScanner::ErrorMap::const_iterator i = scan.errors.begin();
+         i != scan.errors.end(); ++i) {
+      std::cout << "  0x" << std::hex << i->first << std::dec
+                << ": " << i->second.r << " "
+                << i->second.description << std::endl;
+    }
+  }
 }
index 2700f2b14872ce986e7c0923befc673a523dd16b..eb0218df294d63c91f06988881265c76dda2acf7 100644 (file)
@@ -85,7 +85,17 @@ class JournalScanner
     LogEvent *log_event;
     uint32_t raw_size;  //< Size from start offset including all encoding overhead
   };
+
+  class EventError {
+    public:
+    int r;
+    std::string description;
+    EventError(int r_, const std::string &desc_)
+      : r(r_), description(desc_) {}
+  };
+
   typedef std::map<uint64_t, EventRecord> EventMap;
+  typedef std::map<uint64_t, EventError> ErrorMap;
   typedef std::pair<uint64_t, uint64_t> Range;
   bool pointer_present;
   bool pointer_valid;
@@ -101,6 +111,11 @@ class JournalScanner
   std::vector<uint64_t> events_valid;
   EventMap events;
 
+  // For events present in ::events (i.e. scanned successfully),
+  // any subsequent errors handling them (e.g. replaying)
+  ErrorMap errors;
+
+
   private:
   // Forbid copy construction because I have ptr members
   JournalScanner(const JournalScanner &rhs);
index 81bd9b55ce7984a1c776ef1a20d1e5c08c5dc26a..6118320435948c83652b001a47b3e55212ca0490 100644 (file)
@@ -368,7 +368,10 @@ int JournalTool::main_event(std::vector<const char*> &argv)
           if (r == 0) {
             r = scav_r;
           }
-          // Our goal is to read all we can, so don't stop on errors
+          // Our goal is to read all we can, so don't stop on errors, but
+          // do record them for possible later output
+          js.errors.insert(std::make_pair(i->first,
+                JournalScanner::EventError(scav_r, cpp_strerror(r))));
         }
       }
     }