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

[7.6] Switch to AtomicLong for "IngestCurrent" metric to prevent negative values #52761

Merged

Conversation

danhermann
Copy link
Contributor

For monotonically-increasing metrics, the tradeoff of LongAdder's lower contention for non-atomic value reads tends not to cause problems. The "IngestCurrent" metric is more of a flag-type metric that should hover between zero and a small positive number with frequent increment and decrement operations. In that case, LongAdder's non-atomic reads can result in negative values being returned due to out-of-order application of the increment and decrement operations. Those negative values both confuse users and fail during serialization. For that specific metric, AtomicLong's guarantees are necessary.

Backport of #52581

@danhermann danhermann added :Data Management/Stats Statistics tracking and retrieval APIs backport v7.6.1 labels Feb 25, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Stats)

@danhermann danhermann merged commit 3c1d2b3 into elastic:7.6 Feb 25, 2020
@danhermann danhermann deleted the backport_52581_negative_stats_values branch February 25, 2020 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport :Data Management/Stats Statistics tracking and retrieval APIs v7.6.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants