joerghoh commented on code in PR #1427:
URL: https://github.com/apache/jackrabbit-oak/pull/1427#discussion_r1598601449
##########
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:
It probably should be this:
```suggestion
diskCacheIOMonitor.updateCacheSize(cacheSizeAfter,
segment.length());
```
--
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]