File tree 2 files changed +20
-0
lines changed
internalClusterTest/java/org/opensearch/index
main/java/org/opensearch/indices
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 5
5
6
6
package org .opensearch .index ;
7
7
8
+ import org .opensearch .action .admin .indices .replication .SegmentReplicationStatsResponse ;
8
9
import org .opensearch .action .bulk .BulkItemResponse ;
9
10
import org .opensearch .action .bulk .BulkRequest ;
10
11
import org .opensearch .action .bulk .BulkResponse ;
@@ -101,6 +102,23 @@ public void testWritesRejected() throws Exception {
101
102
totalDocs .incrementAndGet ();
102
103
});
103
104
});
105
+ // Try to index one more doc.
106
+ expectThrows (OpenSearchRejectedExecutionException .class , () -> {
107
+ indexDoc ();
108
+ totalDocs .incrementAndGet ();
109
+ refresh (INDEX_NAME );
110
+ });
111
+
112
+ // Verify the rejected doc count.
113
+ SegmentReplicationStatsResponse segmentReplicationStatsResponse = dataNodeClient ().admin ()
114
+ .indices ()
115
+ .prepareSegmentReplicationStats (INDEX_NAME )
116
+ .setDetailed (true )
117
+ .execute ()
118
+ .actionGet ();
119
+ SegmentReplicationPerGroupStats perGroupStats = segmentReplicationStatsResponse .getReplicationStats ().get (INDEX_NAME ).get (0 );
120
+
121
+ assertEquals (perGroupStats .getRejectedRequestCount (), 2L );
104
122
}
105
123
refresh (INDEX_NAME );
106
124
// wait for the replicas to catch up after block is released.
Original file line number Diff line number Diff line change 42
42
import org .opensearch .common .io .stream .NamedWriteableRegistry ;
43
43
import org .opensearch .common .io .stream .NamedWriteableRegistry .Entry ;
44
44
import org .opensearch .core .xcontent .NamedXContentRegistry ;
45
+ import org .opensearch .index .SegmentReplicationPressureService ;
45
46
import org .opensearch .index .mapper .BinaryFieldMapper ;
46
47
import org .opensearch .index .mapper .BooleanFieldMapper ;
47
48
import org .opensearch .index .mapper .CompletionFieldMapper ;
@@ -284,6 +285,7 @@ protected void configure() {
284
285
bind (RetentionLeaseBackgroundSyncAction .class ).asEagerSingleton ();
285
286
bind (RetentionLeaseSyncer .class ).asEagerSingleton ();
286
287
bind (SegmentReplicationCheckpointPublisher .class ).asEagerSingleton ();
288
+ bind (SegmentReplicationPressureService .class ).asEagerSingleton ();
287
289
}
288
290
289
291
/**
You can’t perform that action at this time.
0 commit comments