Manno15 commented on a change in pull request #2181:
URL: https://github.com/apache/accumulo/pull/2181#discussion_r665422163



##########
File path: 
server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java
##########
@@ -123,36 +122,17 @@ public void execute(String[] args) throws Exception {
       Set<Integer> tabletIds = new HashSet<>();
 
       for (String file : opts.files) {
-
         Path path = new Path(file);
-        LogFileKey key = new LogFileKey();
-        LogFileValue value = new LogFileValue();
-
-        if (fs.getFileStatus(path).isFile()) {
-          // read log entries from a simple hdfs file
-          try (final FSDataInputStream fsinput = fs.open(path);
-              DataInputStream input = DfsLogger.getDecryptingStream(fsinput, 
siteConfig)) {
-            while (true) {
-              try {
-                key.readFields(input);
-                value.readFields(input);
-              } catch (EOFException ex) {
-                break;
-              }
-              printLogEvent(key, value, row, rowMatcher, ke, tabletIds, 
opts.maxMutations);
-            }
-          } catch (LogHeaderIncompleteException e) {
-            log.warn("Could not read header for {} . Ignoring...", path);
-            continue;
-          }
-        } else {
-          // read the log entries sorted in a map file
-          try (RecoveryLogReader input = new RecoveryLogReader(fs, path)) {
-            while (input.hasNext()) {
-              Entry<LogFileKey,LogFileValue> entry = input.next();
-              printLogEvent(entry.getKey(), entry.getValue(), row, rowMatcher, 
ke, tabletIds,
-                  opts.maxMutations);
-            }
+        if (!fs.getFileStatus(path).isDirectory()) {
+          log.error("No directory was given. Please pass in a recovery 
directory");
+          continue;
+        }
+        // read the log entries sorted in a RFile
+        try (var rli = new RecoveryLogsIterator(context, 
Collections.singletonList(path), true)) {
+          while (rli.hasNext()) {
+            Entry<LogFileKey,LogFileValue> entry = rli.next();
+            printLogEvent(entry.getKey(), entry.getValue(), row, rowMatcher, 
ke, tabletIds,
+                opts.maxMutations);

Review comment:
       My latest commit adds an extra error message if it detects a file but 
the file ends with .rf. Otherwise, yes, it will error out if it gets past that 
but doesn't contain the finished file.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to