Skip to content

Commit

Permalink
Remove validation for indices segments stats.
Browse files Browse the repository at this point in the history
`OpenSearch` 2.0 uses newer version of `Lucene` (9.0) which doesn't provide segments stats info.

Ref: opensearch-project/OpenSearch#2029 opensearch-project/OpenSearch#1109
See also history for `server/src/main/java/org/opensearch/index/engine/SegmentsStats.java` in `OpenSearch` repo.

Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com>
  • Loading branch information
Yury-Fridlyand committed Jun 9, 2022
1 parent fbd850d commit e481bbd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/OpenSearch.Client/CommonOptions/Stats/SegmentsStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@

namespace OpenSearch.Client
{
/// <summary>
/// OpenSearch 2.0 has Lucene upgraded up to version 9.0 which doesn't provide memory info for segments.
/// All fields except `count` might be zeroed.
/// </summary>
[DataContract]
public class SegmentsStats
{
Expand Down
14 changes: 8 additions & 6 deletions tests/Tests/Cluster/ClusterStats/ClusterStatsApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,14 @@ protected void Assert(ClusterIndicesStats indices)

indices.Segments.Should().NotBeNull();
indices.Segments.Count.Should().BeGreaterThan(0);

indices.Segments.DocValuesMemoryInBytes.Should().BeGreaterThan(0);
indices.Segments.MemoryInBytes.Should().BeGreaterThan(0);
indices.Segments.NormsMemoryInBytes.Should().BeGreaterThan(0);
indices.Segments.StoredFieldsMemoryInBytes.Should().BeGreaterThan(0);
indices.Segments.TermsMemoryInBytes.Should().BeGreaterThan(0);
if (Cluster.ClusterConfiguration.Version < "2.0.0")
{
indices.Segments.DocValuesMemoryInBytes.Should().BeGreaterThan(0);
indices.Segments.MemoryInBytes.Should().BeGreaterThan(0);
indices.Segments.NormsMemoryInBytes.Should().BeGreaterThan(0);
indices.Segments.StoredFieldsMemoryInBytes.Should().BeGreaterThan(0);
indices.Segments.TermsMemoryInBytes.Should().BeGreaterThan(0);
}

indices.Shards.Should().NotBeNull();
indices.Shards.Primaries.Should().BeGreaterThan(0);
Expand Down

0 comments on commit e481bbd

Please sign in to comment.