smiroslav commented on code in PR #1427: URL: https://github.com/apache/jackrabbit-oak/pull/1427#discussion_r1593533371
########## oak-segment-remote/src/main/java/org/apache/jackrabbit/oak/segment/remote/persistentcache/PersistentDiskCache.java: ########## @@ -204,7 +204,17 @@ private void cleanUpInternal() { } if (cacheSize.get() > maxCacheSizeBytes * 0.66) { File segment = segmentCacheEntry.getPath().toFile(); - cacheSize.addAndGet(-segment.length()); + long length = segment.length(); + if (length == 0) { + if (logger.isDebugEnabled()) { + logger.debug("Avoiding removal of zero-sized file {}", segmentCacheEntry.getPath()); + } else { + logger.warn("Avoiding removal of zero-sized file."); + } + return; + } + long cacheSizeAfter = cacheSize.addAndGet(-length); + diskCacheIOMonitor.updateCacheSize(cacheSizeAfter, directory.length()); Review Comment: https://docs.oracle.com/javase/8/docs/api/java/io/File.html#length-- API docs says that File.length returns unspecified value for directories. -- 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: dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org