Reset metric name lookup table when another worker deletes a metric #171
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A few commits here that are easier to review individually, adding a test to reproduce #168 and fixing the issue by emtying the per-metric lookup table every time a metric is deleted by one of the other nginx workers. (cc @Ashion who reported this)
Since we already have a way to propagate metric key deletion to other workers via KeyIndex, I am piggy-backing on the same mechanism to trigger lookup table cleanup. (cc @dolik-rce who implemented the KeyIndex)
This also addresses the issue of unbounded memory growth when there is metric churn (#151), so I am removing the static lookup table size limit that was introduced as a mitigation. (cc @kingluo who reported that memory leak issue)
I will wait for a few days before merging this just in case someone has any feedback.
Fixes #168