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

Fix entry cache size update logic so it won't go negative. #10225

Merged
merged 2 commits into from
Apr 15, 2021

Conversation

MarvinCai
Copy link
Contributor

Fixes #10016

Motivation

Metrics pulsar_ml_cache_used_size can to negative sometime.

Modifications

Only place where we could subtract more from the cache size then we add to it is when an EntryCache is cleared, the returned value is not the size of entries removed but the size of cache before clear(). Update the behavior here to return the size of entries removed.

Verifying this change

Added unit test.

@merlimat merlimat added the type/bug The PR fixed a bug or issue reported a bug label Apr 14, 2021
@merlimat merlimat added this to the 2.8.0 milestone Apr 14, 2021
@merlimat merlimat merged commit 7e83406 into apache:master Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pulsar_ml_cache_used_size Prometheus metric is negative (Pulsar 2.6.1)
3 participants