Skip to content

Commit 7db5e52

Browse files
Rishikesh1159austintlee
authored andcommitted
Revert Enabling Segment Replication Backpressure setting by default (opensearch-project#7292)
* Revert "[Segment Replication] Enable Segment Replication Backpressure setting by default. (opensearch-project#7183)" This reverts commit a953178. * Add null checks. Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> * add testWithDocumentReplicationEnabledIndex(). Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> --------- Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
1 parent 70b9089 commit 7db5e52

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

server/src/internalClusterTest/java/org/opensearch/index/SegmentReplicationPressureIT.java

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS;
3939
import static org.opensearch.index.SegmentReplicationPressureService.MAX_INDEXING_CHECKPOINTS;
4040
import static org.opensearch.index.SegmentReplicationPressureService.MAX_REPLICATION_TIME_SETTING;
41+
import static org.opensearch.index.SegmentReplicationPressureService.SEGMENT_REPLICATION_INDEXING_PRESSURE_ENABLED;
4142
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
4243
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertHitCount;
4344

@@ -50,6 +51,7 @@ public class SegmentReplicationPressureIT extends SegmentReplicationBaseIT {
5051
protected Settings nodeSettings(int nodeOrdinal) {
5152
return Settings.builder()
5253
.put(super.nodeSettings(nodeOrdinal))
54+
.put(SEGMENT_REPLICATION_INDEXING_PRESSURE_ENABLED.getKey(), true)
5355
.put(MAX_REPLICATION_TIME_SETTING.getKey(), TimeValue.timeValueSeconds(1))
5456
.put(MAX_INDEXING_CHECKPOINTS.getKey(), MAX_CHECKPOINTS_BEHIND)
5557
.build();

server/src/main/java/org/opensearch/index/SegmentReplicationPressureService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class SegmentReplicationPressureService implements Closeable {
5252
*/
5353
public static final Setting<Boolean> SEGMENT_REPLICATION_INDEXING_PRESSURE_ENABLED = Setting.boolSetting(
5454
"segrep.pressure.enabled",
55-
true,
55+
false,
5656
Setting.Property.Dynamic,
5757
Setting.Property.NodeScope
5858
);

server/src/test/java/org/opensearch/index/SegmentReplicationPressureServiceTests.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@
4141
import static org.mockito.Mockito.verify;
4242
import static org.mockito.Mockito.times;
4343
import static org.opensearch.index.SegmentReplicationPressureService.MAX_REPLICATION_TIME_SETTING;
44+
import static org.opensearch.index.SegmentReplicationPressureService.SEGMENT_REPLICATION_INDEXING_PRESSURE_ENABLED;
4445

4546
public class SegmentReplicationPressureServiceTests extends OpenSearchIndexLevelReplicationTestCase {
4647

4748
private static ShardStateAction shardStateAction = Mockito.mock(ShardStateAction.class);
4849
private static final Settings settings = Settings.builder()
4950
.put(IndexMetadata.SETTING_REPLICATION_TYPE, ReplicationType.SEGMENT)
51+
.put(SEGMENT_REPLICATION_INDEXING_PRESSURE_ENABLED.getKey(), true)
5052
.put(MAX_REPLICATION_TIME_SETTING.getKey(), TimeValue.timeValueSeconds(5))
5153
.build();
5254

@@ -97,7 +99,10 @@ public void testIsSegrepLimitBreached() throws Exception {
9799
}
98100

99101
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();
101106

102107
try (ReplicationGroup shards = createGroup(1, settings, new NRTReplicationEngineFactory())) {
103108
shards.startAll();
@@ -121,7 +126,10 @@ public void testIsSegrepLimitBreached_onlyCheckpointLimitBreached() throws Excep
121126
}
122127

123128
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();
125133

126134
try (ReplicationGroup shards = createGroup(1, settings, new NRTReplicationEngineFactory())) {
127135
shards.startAll();
@@ -186,6 +194,7 @@ public void testIsSegrepLimitBreached_underStaleNodeLimit() throws Exception {
186194
public void testFailStaleReplicaTask() throws Exception {
187195
final Settings settings = Settings.builder()
188196
.put(IndexMetadata.SETTING_REPLICATION_TYPE, ReplicationType.SEGMENT)
197+
.put(SEGMENT_REPLICATION_INDEXING_PRESSURE_ENABLED.getKey(), true)
189198
.put(MAX_REPLICATION_TIME_SETTING.getKey(), TimeValue.timeValueMillis(10))
190199
.build();
191200

0 commit comments

Comments
 (0)