You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2021/07/06 20:28:56 UTC

[GitHub] [accumulo] milleruntime commented on a change in pull request #2181: Update LogReader to utilize RecoveryLogsIterator

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



##########
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:
       This looks good for reading the sorted logs but we still want the section under `if (fs.getFileStatus(path).isFile())` for reading regular write ahead logs using `DfsLogger`.




-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org