Skip to content

Commit

Permalink
Address comments on PR and fix compile errors.
Browse files Browse the repository at this point in the history
Signed-off-by: Rishikesh1159 <[email protected]>
  • Loading branch information
Rishikesh1159 committed Oct 18, 2023
1 parent e0aaef2 commit 5449d36
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ public SearchPipelineStats getSearchPipelineStats() {
@Nullable
public SegmentReplicationRejectionStats getSegmentReplicationRejectionStats() {
return segmentReplicationRejectionStats;
}

public RepositoriesStats getRepositoriesStats() {
return repositoriesStats;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ protected ClusterStatsNodeResponse nodeOperation(ClusterStatsNodeRequest nodeReq
false,
false,
false,
false,
false
);
List<ShardStats> shardsStats = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

package org.opensearch.index;

import org.opensearch.common.inject.Inject;
import org.opensearch.common.util.concurrent.ConcurrentCollections;
import org.opensearch.core.index.shard.ShardId;
import org.opensearch.index.shard.IndexShard;
Expand All @@ -29,7 +28,6 @@ public class SegmentReplicationStatsTracker {
private final IndicesService indicesService;
private final Map<ShardId, AtomicInteger> rejectionCount;

@Inject
public SegmentReplicationStatsTracker(IndicesService indicesService) {
this.indicesService = indicesService;
rejectionCount = ConcurrentCollections.newConcurrentMap();
Expand All @@ -38,9 +36,11 @@ public SegmentReplicationStatsTracker(IndicesService indicesService) {
public SegmentReplicationRejectionStats getRejectionStats() {
long rejectionCount = 0;
for (IndexService indexService : indicesService) {
for (IndexShard indexShard : indexService) {
if (indexShard.indexSettings().isSegRepEnabled() && indexShard.routingEntry().primary()) {
rejectionCount += getStatsForShard(indexShard).getRejectedRequestCount();
if (indexService.getIndexSettings().isSegRepEnabled()) {
for (IndexShard indexShard : indexService) {
if (indexShard.indexSettings().isSegRepEnabled() && indexShard.routingEntry().primary()) {
rejectionCount += getStatsForShard(indexShard).getRejectedRequestCount();
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions server/src/main/java/org/opensearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,7 @@ protected Node(
b.bind(MetricsRegistry.class).toInstance(metricsRegistry);
b.bind(RemoteClusterStateService.class).toProvider(() -> remoteClusterStateService);
b.bind(PersistedStateRegistry.class).toInstance(persistedStateRegistry);
b.bind(SegmentReplicationStatsTracker.class).toInstance(segmentReplicationStatsTracker);
});
injector = modules.createInjector();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public void testFillDiskUsage() {
null,
null,
null,
null,
null
),
new NodeStats(
Expand Down Expand Up @@ -220,6 +221,7 @@ public void testFillDiskUsage() {
null,
null,
null,
null,
null
),
new NodeStats(
Expand Down Expand Up @@ -248,6 +250,7 @@ public void testFillDiskUsage() {
null,
null,
null,
null,
null
)
);
Expand Down Expand Up @@ -307,6 +310,7 @@ public void testFillDiskUsageSomeInvalidValues() {
null,
null,
null,
null,
null
),
new NodeStats(
Expand Down Expand Up @@ -335,6 +339,7 @@ public void testFillDiskUsageSomeInvalidValues() {
null,
null,
null,
null,
null
),
new NodeStats(
Expand Down Expand Up @@ -363,6 +368,7 @@ public void testFillDiskUsageSomeInvalidValues() {
null,
null,
null,
null,
null
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2722,6 +2722,7 @@ public void ensureEstimatedStats() {
false,
false,
false,
false,
false
);
assertThat(
Expand Down

0 comments on commit 5449d36

Please sign in to comment.