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.x] Switch to AtomicLong for "IngestCurrent" metric to prevent negative values #52834

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.7.0 labels Feb 26, 2020
@elasticmachine
Copy link
Collaborator

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

@danhermann danhermann merged commit 3ffd346 into elastic:7.x Feb 26, 2020
@danhermann danhermann deleted the backport_52581_negative_ingest_stats branch February 26, 2020 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport >bug :Data Management/Stats Statistics tracking and retrieval APIs v7.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants