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

Allow inclusion of unloaded segments in stats #39512

Merged
merged 4 commits into from
Mar 5, 2019

Conversation

s1monw
Copy link
Contributor

@s1monw s1monw commented Feb 28, 2019

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 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.
@s1monw s1monw added >enhancement :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. v8.0.0 v7.2.0 labels Feb 28, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

Copy link
Member

@dnhatn dnhatn left a 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);
Copy link
Member

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());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space between parameters.

Copy link
Contributor

@ywelsch ywelsch left a 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)

@s1monw
Copy link
Contributor Author

s1monw commented Mar 5, 2019

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.

@s1monw s1monw merged commit 73d4516 into elastic:master Mar 5, 2019
s1monw added a commit that referenced this pull request Mar 5, 2019
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.
s1monw added a commit that referenced this pull request Mar 5, 2019
s1monw added a commit that referenced this pull request Mar 5, 2019
s1monw added a commit to s1monw/elasticsearch that referenced this pull request Mar 5, 2019
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/
s1monw added a commit that referenced this pull request Mar 20, 2019
…39698)

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 #39512
s1monw added a commit that referenced this pull request Mar 20, 2019
…39698)

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 #39512
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >enhancement v7.2.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants