Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAK-10771 - Add disk cache size stats and issue warning if evicted segment has zero length #1427

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

ahanikel
Copy link
Contributor

The persistent disk cache computes its size internally by adding/subtracting the size of added/purged segments. We would like to be able to see if that computation is correct, by having both the computed size and the effective size on disk in the metrics.

The background for this is that in a few rare instances, the disk cache evicted too many items (down to almost zero) instead of the expected 65% of its max size.

Also we want to make sure that no evictions happen on items that have a length of zero. We're not sure if that happens or not, so the change is to refuse eviction in that case and log a warning instead.

return;
}
long cacheSizeAfter = cacheSize.addAndGet(-length);
diskCacheIOMonitor.updateCacheSize(cacheSizeAfter, directory.length());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.oracle.com/javase/8/docs/api/java/io/File.html#length--

API docs says that File.length returns unspecified value for directories.

cacheSize.addAndGet(-segment.length());
long length = segment.length();
if (length == 0) {
if (logger.isDebugEnabled()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why both debug and warn are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants