Manno15 commented on a change in pull request #2181:
URL: https://github.com/apache/accumulo/pull/2181#discussion_r664895009
##########
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:
Also, if a user specifies a single sorted WAL to read, it will error out
(the second part of your issue mentions this). I will look into adding a check
to prevent this (something like if file.endsWith(",rf"), though a more
descriptive error message could suffice.
--
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]