41
41
import static org .mockito .Mockito .verify ;
42
42
import static org .mockito .Mockito .times ;
43
43
import static org .opensearch .index .SegmentReplicationPressureService .MAX_REPLICATION_TIME_SETTING ;
44
+ import static org .opensearch .index .SegmentReplicationPressureService .SEGMENT_REPLICATION_INDEXING_PRESSURE_ENABLED ;
44
45
45
46
public class SegmentReplicationPressureServiceTests extends OpenSearchIndexLevelReplicationTestCase {
46
47
47
48
private static ShardStateAction shardStateAction = Mockito .mock (ShardStateAction .class );
48
49
private static final Settings settings = Settings .builder ()
49
50
.put (IndexMetadata .SETTING_REPLICATION_TYPE , ReplicationType .SEGMENT )
51
+ .put (SEGMENT_REPLICATION_INDEXING_PRESSURE_ENABLED .getKey (), true )
50
52
.put (MAX_REPLICATION_TIME_SETTING .getKey (), TimeValue .timeValueSeconds (5 ))
51
53
.build ();
52
54
@@ -97,7 +99,10 @@ public void testIsSegrepLimitBreached() throws Exception {
97
99
}
98
100
99
101
public void testIsSegrepLimitBreached_onlyCheckpointLimitBreached () throws Exception {
100
- final Settings settings = Settings .builder ().put (IndexMetadata .SETTING_REPLICATION_TYPE , ReplicationType .SEGMENT ).build ();
102
+ final Settings settings = Settings .builder ()
103
+ .put (IndexMetadata .SETTING_REPLICATION_TYPE , ReplicationType .SEGMENT )
104
+ .put (SEGMENT_REPLICATION_INDEXING_PRESSURE_ENABLED .getKey (), true )
105
+ .build ();
101
106
102
107
try (ReplicationGroup shards = createGroup (1 , settings , new NRTReplicationEngineFactory ())) {
103
108
shards .startAll ();
@@ -121,7 +126,10 @@ public void testIsSegrepLimitBreached_onlyCheckpointLimitBreached() throws Excep
121
126
}
122
127
123
128
public void testIsSegrepLimitBreached_onlyTimeLimitBreached () throws Exception {
124
- final Settings settings = Settings .builder ().put (IndexMetadata .SETTING_REPLICATION_TYPE , ReplicationType .SEGMENT ).build ();
129
+ final Settings settings = Settings .builder ()
130
+ .put (IndexMetadata .SETTING_REPLICATION_TYPE , ReplicationType .SEGMENT )
131
+ .put (SEGMENT_REPLICATION_INDEXING_PRESSURE_ENABLED .getKey (), true )
132
+ .build ();
125
133
126
134
try (ReplicationGroup shards = createGroup (1 , settings , new NRTReplicationEngineFactory ())) {
127
135
shards .startAll ();
@@ -186,6 +194,7 @@ public void testIsSegrepLimitBreached_underStaleNodeLimit() throws Exception {
186
194
public void testFailStaleReplicaTask () throws Exception {
187
195
final Settings settings = Settings .builder ()
188
196
.put (IndexMetadata .SETTING_REPLICATION_TYPE , ReplicationType .SEGMENT )
197
+ .put (SEGMENT_REPLICATION_INDEXING_PRESSURE_ENABLED .getKey (), true )
189
198
.put (MAX_REPLICATION_TIME_SETTING .getKey (), TimeValue .timeValueMillis (10 ))
190
199
.build ();
191
200
0 commit comments