Skip to content

Commit f4f2793

Browse files
author
Ankit Saurabh
authored
HADOOP-18351. Reduce excess logging of errors during S3A prefetching reads (#5274)
Contributed by Ankit Saurabh
1 parent 4cbe19f commit f4f2793

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/impl/prefetch/CachingBlockManager.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,12 @@ public void cancelPrefetches() {
302302

303303
private void read(BufferData data) throws IOException {
304304
synchronized (data) {
305-
readBlock(data, false, BufferData.State.BLANK);
305+
try {
306+
readBlock(data, false, BufferData.State.BLANK);
307+
} catch (IOException e) {
308+
LOG.error("error reading block {}", data.getBlockNumber(), e);
309+
throw e;
310+
}
306311
}
307312
}
308313

@@ -362,9 +367,6 @@ private void readBlock(BufferData data, boolean isPrefetch, BufferData.State...
362367
buffer.flip();
363368
data.setReady(expectedState);
364369
} catch (Exception e) {
365-
String message = String.format("error during readBlock(%s)", data.getBlockNumber());
366-
LOG.error(message, e);
367-
368370
if (isPrefetch && tracker != null) {
369371
tracker.failed();
370372
}
@@ -406,7 +408,8 @@ public Void get() {
406408
try {
407409
blockManager.prefetch(data, taskQueuedStartTime);
408410
} catch (Exception e) {
409-
LOG.error("error during prefetch", e);
411+
LOG.info("error prefetching block {}. {}", data.getBlockNumber(), e.getMessage());
412+
LOG.debug("error prefetching block {}", data.getBlockNumber(), e);
410413
}
411414
return null;
412415
}
@@ -493,7 +496,8 @@ private void addToCacheAndRelease(BufferData data, Future<Void> blockFuture,
493496
return;
494497
}
495498
} catch (Exception e) {
496-
LOG.error("error waiting on blockFuture: {}", data, e);
499+
LOG.info("error waiting on blockFuture: {}. {}", data, e.getMessage());
500+
LOG.debug("error waiting on blockFuture: {}", data, e);
497501
data.setDone();
498502
return;
499503
}
@@ -523,8 +527,8 @@ private void addToCacheAndRelease(BufferData data, Future<Void> blockFuture,
523527
data.setDone();
524528
} catch (Exception e) {
525529
numCachingErrors.incrementAndGet();
526-
String message = String.format("error adding block to cache after wait: %s", data);
527-
LOG.error(message, e);
530+
LOG.info("error adding block to cache after wait: {}. {}", data, e.getMessage());
531+
LOG.debug("error adding block to cache after wait: {}", data, e);
528532
data.setDone();
529533
}
530534

0 commit comments

Comments
 (0)