Manno15 commented on a change in pull request #2181:
URL: https://github.com/apache/accumulo/pull/2181#discussion_r665359721
##########
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:
A single rfile will not work with RLI currently. It doesn't contain the
finish marker which is looked for in rli.getFiles (that seems to be the only
issue with it not working). Also, since LogReader usually deals with one
directory/file at a time since it's looped through what the user passes in, I
already am using a singleton list to read in that path. I could change the
passed in files (opts.files in LogReader) to be a List<path> but it doesn't
seem necessary.
--
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]