steveloughran commented on code in PR #5832:
URL: https://github.com/apache/hadoop/pull/5832#discussion_r1273422607


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/impl/prefetch/CachingBlockManager.java:
##########
@@ -392,16 +413,41 @@ private void readBlock(BufferData data, boolean 
isPrefetch, BufferData.State...
           ops.end(op);
         }
 
-        if (isPrefetch) {
-          prefetchingStatistics.prefetchOperationCompleted();
-          if (tracker != null) {
-            tracker.close();
-          }
+        // update the statistics
+        prefetchingStatistics.fetchOperationCompleted(isPrefetch, 
bytesFetched);
+        if (tracker != null) {
+          tracker.close();
+          LOG.debug("fetch completed: {}", tracker);
         }
       }
     }
   }
 
+  /**
+   * True if the manager has been closed.
+   */
+  private boolean isClosed() {
+    return closed.get();
+  }
+
+  /**
+   * Disable caching; updates stream statistics and logs exactly once
+   * at info
+   * @param endOp operation which measured the duration of the write.
+   */
+  private void disableCaching(final BlockOperations.End endOp) {
+    if (!cachingDisabled.getAndSet(true)) {
+      String message = String.format(
+          "Caching disabled because of slow operation (%.1f sec)", 
endOp.duration());
+      LOG_CACHING_DISABLED.info(message);
+      prefetchingStatistics.setPrefetchCachingState(false);

Review Comment:
   done in method, but not in gauge name. What if we ever allow a cache to 
memory option here?



-- 
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: common-issues-unsubscr...@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to