-
Notifications
You must be signed in to change notification settings - Fork 25k
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 handling indices stats request when all shards are missing #20464
Conversation
primaryFound = true; | ||
} | ||
} | ||
return primaryFound ? primaryStats : new CommonStats(CommonStatsFlags.ALL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the all flags? it seems arbitrary?
If I understand correctly the problem is that it may be the case that an index exists but it doesn't have any shard causing stats elements to be missing. I agree it would be nice to return empty stats objects rather than null, but I think we should honor the initial flags rather than blindly supply all stats. also can we have tests? |
I don't see anything specific to cat indices among these changes, I think they modify indices stats api, hence also cat indices that uses it. Can we update the title/description/labels of the PR to reflect what apis it changes? |
One more thing: I wonder if this issue is specific to the tribe node, or can also happen with any node, or maybe just client nodes? |
ee137b1
to
96c8616
Compare
Currently, when an index exists in the cluster state but has no shards for reporting stats, the missing stats object cause a `NullPointerException` when requesting the indices stats. In this commit missing stats object for an index are initialized as empty stats instead of null, honoring the stats flags set in the stats request. The commit fixes the issue for all APIs that use the indices stats API namely `_cat/indices`, `_cat/shards` and `_stats`. closes elastic#20298
96c8616
to
51d7010
Compare
Thanks @bleskes for clarifying the problem statement, I was investigating this issue with tribe node, hence was too specific in my description. Now we honor the request stats flags instead of supplying all the stats by carrying over the request stats flag to the stats response.
Added this condition in
Thanks @javanna for pointing it out, I updated these accordingly.
After some digging, this issue can happen on any node, when indices are removed/closed after the indices have been resolved for the stats request and before executing the stats request on the node. |
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
@areek is thing still being worked on? |
I'm closing this PR since I do not think @areek is interested in bringing it up to date with master. If that is incorrect, please reopen. |
This is still a bug that needs to be fixed - I'll mark it as adoptme |
2.4.4 will still appear, we use "_cat / indices" as node health monitoring,Not only tribe node, but also data node will appear |
@clintongormley I'm going to close this again, as we already have an issue to track this (#20298) and anyone who wants address this will still need to open a new PR. |
Currently, when an index exists in the cluster state but has no shards for reporting stats,
the missing stats object cause a
NullPointerException
when requesting the indices stats.In this commit missing stats object for an index are initialized as empty stats instead
of null, honoring the stats flags set in the stats request. The commit fixes the issue for all
APIs that use the indices stats API namely
_cat/indices
,_cat/shards
and_stats
.closes #20298