-
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
Allow inclusion of unloaded segments in stats #39512
Conversation
Today we have no chance to fetch actual segment stats for segments that are currently unloaded. This is relevant in the case of frozen indices. This allows to monitor how much memory a frozen index would use if it was unfrozen.
Pinging @elastic/es-distributed |
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.
LGTM. I left two super minor nits.
this.stats = new SegmentsStats(); | ||
for (LeafReaderContext ctx : reader.getContext().leaves()) { | ||
SegmentReader segmentReader = Lucene.segmentReader(ctx.reader()); | ||
fillSegmentStats(segmentReader, true, stats); |
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.
nit: indentation
@@ -207,7 +207,7 @@ public CommonStats(IndicesQueryCache indicesQueryCache, IndexShard indexShard, C | |||
completion = indexShard.completionStats(flags.completionDataFields()); | |||
break; | |||
case Segments: | |||
segments = indexShard.segmentStats(flags.includeSegmentFileSizes()); | |||
segments = indexShard.segmentStats(flags.includeSegmentFileSizes(),flags.includeUnloadedSegments()); |
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.
nit: space between parameters.
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.
LGTM. This is such useful information that I'm wondering whether we should have it for closed replicated indices as well (by opening the index very shortly to compute the stats when creating the NoOpEngine)
sounds good to me. I will open a second PR for this. |
Today we have no chance to fetch actual segment stats for segments that are currently unloaded. This is relevant in the case of frozen indices. This allows to monitor how much memory a frozen index would use if it was unfrozen.
Today we don't return segments stats for closed indices which makes it hard to tell how much memory such an index would require. With this change we return the statistics if requested by setting `include_unloaded_segments` to true on the rest request. Relates to elastic#39512/
Today we have no chance to fetch actual segment stats for segments that
are currently unloaded. This is relevant in the case of frozen indices.
This allows to monitor how much memory a frozen index would use if it was
unfrozen.