Skip to content

Commit 5733c55

Browse files
authored
HDDS-11799. Remove config hdds.scm.safemode.pipeline-availability.check (apache#8095)
1 parent c962b98 commit 5733c55

File tree

10 files changed

+39
-93
lines changed

10 files changed

+39
-93
lines changed

hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsConfigKeys.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ public final class HddsConfigKeys {
8989
public static final String
9090
HDDS_SCM_WAIT_TIME_AFTER_SAFE_MODE_EXIT_DEFAULT = "5m";
9191

92-
public static final String HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK =
93-
"hdds.scm.safemode.pipeline-availability.check";
94-
public static final boolean
95-
HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK_DEFAULT = true;
96-
9792
public static final String HDDS_SCM_SAFEMODE_PIPELINE_CREATION =
9893
"hdds.scm.safemode.pipeline.creation";
9994
public static final boolean

hadoop-hdds/common/src/main/resources/ozone-default.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,15 +1659,6 @@
16591659
</description>
16601660
</property>
16611661

1662-
<property>
1663-
<name>hdds.scm.safemode.pipeline-availability.check</name>
1664-
<value>true</value>
1665-
<tag>HDDS,SCM,OPERATION</tag>
1666-
<description>
1667-
Boolean value to enable pipeline availability check during SCM safe mode.
1668-
</description>
1669-
</property>
1670-
16711662
<property>
16721663
<name>hdds.scm.safemode.healthy.pipeline.pct</name>
16731664
<value>0.10</value>

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineReportHandler.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.google.common.base.Preconditions;
2121
import java.io.IOException;
2222
import java.util.concurrent.TimeoutException;
23-
import org.apache.hadoop.hdds.HddsConfigKeys;
2423
import org.apache.hadoop.hdds.client.RatisReplicationConfig;
2524
import org.apache.hadoop.hdds.conf.ConfigurationSource;
2625
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
@@ -52,7 +51,6 @@ public class PipelineReportHandler implements
5251
private final PipelineManager pipelineManager;
5352
private final SafeModeManager scmSafeModeManager;
5453
private final SCMContext scmContext;
55-
private final boolean pipelineAvailabilityCheck;
5654
private final SCMPipelineMetrics metrics;
5755

5856
public PipelineReportHandler(SafeModeManager scmSafeModeManager,
@@ -64,9 +62,6 @@ public PipelineReportHandler(SafeModeManager scmSafeModeManager,
6462
this.pipelineManager = pipelineManager;
6563
this.scmContext = scmContext;
6664
this.metrics = SCMPipelineMetrics.create();
67-
this.pipelineAvailabilityCheck = conf.getBoolean(
68-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
69-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK_DEFAULT);
7065
}
7166

7267
@Override
@@ -140,7 +135,7 @@ protected void processPipelineReport(PipelineReport report,
140135
}
141136
}
142137
if (pipeline.isHealthy()) {
143-
if (pipelineAvailabilityCheck && scmSafeModeManager.getInSafeMode()) {
138+
if (scmSafeModeManager.getInSafeMode()) {
144139
publisher.fireEvent(SCMEvents.OPEN_PIPELINE, pipeline);
145140
}
146141
}

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/SafeModeMetrics.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ public class SafeModeMetrics {
4242
private @Metric MutableCounterLong
4343
currentContainersWithECDataReplicaReportedCount;
4444

45-
// When hdds.scm.safemode.pipeline-availability.check is set then only
46-
// below metrics will have some values, otherwise they will be zero.
45+
// Pipeline metrics for safemode
4746
private @Metric MutableGaugeLong numHealthyPipelinesThreshold;
4847
private @Metric MutableCounterLong currentHealthyPipelinesCount;
4948
private @Metric MutableGaugeLong

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/SafeModeRuleFactory.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import java.util.ArrayList;
2121
import java.util.List;
22-
import org.apache.hadoop.hdds.HddsConfigKeys;
2322
import org.apache.hadoop.hdds.conf.ConfigurationSource;
2423
import org.apache.hadoop.hdds.scm.container.ContainerManager;
2524
import org.apache.hadoop.hdds.scm.ha.SCMContext;
@@ -79,13 +78,8 @@ private void loadRules() {
7978

8079
preCheckRules.add(datanodeRule);
8180

82-
// TODO: Move isRuleEnabled check to the Rule implementation. (HDDS-11799)
83-
if (config.getBoolean(
84-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
85-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK_DEFAULT)
86-
&& pipelineManager != null) {
87-
88-
safeModeRules.add(new HealthyPipelineSafeModeRule(eventQueue, pipelineManager,
81+
if (pipelineManager != null) {
82+
safeModeRules.add(new HealthyPipelineSafeModeRule(eventQueue, pipelineManager,
8983
safeModeManager, config, scmContext));
9084
safeModeRules.add(new OneReplicaPipelineSafeModeRule(eventQueue, pipelineManager,
9185
safeModeManager, config));

hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestHealthyPipelineSafeModeRule.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ public void testHealthyPipelineSafeModeRuleWithNoPipelines()
7474
when(containerManager.getContainers()).thenReturn(containers);
7575
config.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempFile.getPath());
7676
// enable pipeline check
77-
config.setBoolean(
78-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
7977
config.setBoolean(
8078
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);
8179
SCMMetadataStore scmMetadataStore = new SCMMetadataStoreImpl(config);
@@ -128,8 +126,6 @@ public void testHealthyPipelineSafeModeRuleWithPipelines() throws Exception {
128126
when(containerManager.getContainers()).thenReturn(containers);
129127
config.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempFile.getPath());
130128
// enable pipeline check
131-
config.setBoolean(
132-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
133129
config.setBoolean(
134130
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);
135131

@@ -224,8 +220,6 @@ public void testHealthyPipelineSafeModeRuleWithMixedPipelines()
224220
when(containerManager.getContainers()).thenReturn(containers);
225221
config.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempFile.getPath());
226222
// enable pipeline check
227-
config.setBoolean(
228-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
229223
config.setBoolean(
230224
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);
231225

hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestOneReplicaPipelineSafeModeRule.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ public class TestOneReplicaPipelineSafeModeRule {
7777
private void setup(int nodes, int pipelineFactorThreeCount,
7878
int pipelineFactorOneCount) throws Exception {
7979
OzoneConfiguration ozoneConfiguration = new OzoneConfiguration();
80-
ozoneConfiguration.setBoolean(
81-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
8280
ozoneConfiguration.set(HddsConfigKeys.OZONE_METADATA_DIRS,
8381
tempDir.toString());
8482
ozoneConfiguration.setBoolean(

hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestSCMSafeModeManager.java

Lines changed: 35 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,6 @@ public void testSafeModeExitRule() throws Exception {
208208
private OzoneConfiguration createConf(double healthyPercent,
209209
double oneReplicaPercent) {
210210
OzoneConfiguration conf = new OzoneConfiguration(config);
211-
conf.setBoolean(
212-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
213-
true);
214211
conf.setDouble(HddsConfigKeys.
215212
HDDS_SCM_SAFEMODE_HEALTHY_PIPELINE_THRESHOLD_PCT, healthyPercent);
216213
conf.setDouble(HddsConfigKeys.
@@ -667,67 +664,56 @@ private void testECContainerThreshold(List<ContainerInfo> dnContainers,
667664
public void testSafeModePipelineExitRule() throws Exception {
668665
containers = new ArrayList<>();
669666
containers.addAll(HddsTestUtils.getContainerInfo(25 * 4));
670-
try {
671-
MockNodeManager nodeManager = new MockNodeManager(true, 3);
672-
// enable pipeline check
673-
config.setBoolean(
674-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
675-
676-
PipelineManagerImpl pipelineManager =
677-
PipelineManagerImpl.newPipelineManager(
678-
config,
679-
SCMHAManagerStub.getInstance(true),
680-
nodeManager,
681-
scmMetadataStore.getPipelineTable(),
682-
queue,
683-
scmContext,
684-
serviceManager,
685-
Clock.system(ZoneOffset.UTC));
686-
687-
PipelineProvider<RatisReplicationConfig> mockRatisProvider =
688-
new MockRatisPipelineProvider(nodeManager,
689-
pipelineManager.getStateManager(), config);
690-
pipelineManager.setPipelineProvider(HddsProtos.ReplicationType.RATIS,
691-
mockRatisProvider);
667+
MockNodeManager nodeManager = new MockNodeManager(true, 3);
668+
PipelineManagerImpl pipelineManager =
669+
PipelineManagerImpl.newPipelineManager(
670+
config,
671+
SCMHAManagerStub.getInstance(true),
672+
nodeManager,
673+
scmMetadataStore.getPipelineTable(),
674+
queue,
675+
scmContext,
676+
serviceManager,
677+
Clock.system(ZoneOffset.UTC));
692678

693-
Pipeline pipeline = pipelineManager.createPipeline(
694-
RatisReplicationConfig.getInstance(
695-
ReplicationFactor.THREE));
679+
PipelineProvider<RatisReplicationConfig> mockRatisProvider =
680+
new MockRatisPipelineProvider(nodeManager,
681+
pipelineManager.getStateManager(), config);
682+
pipelineManager.setPipelineProvider(HddsProtos.ReplicationType.RATIS,
683+
mockRatisProvider);
696684

697-
pipeline = pipelineManager.getPipeline(pipeline.getId());
698-
MockRatisPipelineProvider.markPipelineHealthy(pipeline);
699-
ContainerManager containerManager = mock(ContainerManager.class);
700-
when(containerManager.getContainers()).thenReturn(containers);
685+
Pipeline pipeline = pipelineManager.createPipeline(
686+
RatisReplicationConfig.getInstance(
687+
ReplicationFactor.THREE));
688+
689+
pipeline = pipelineManager.getPipeline(pipeline.getId());
690+
MockRatisPipelineProvider.markPipelineHealthy(pipeline);
691+
ContainerManager containerManager = mock(ContainerManager.class);
692+
when(containerManager.getContainers()).thenReturn(containers);
701693

702-
scmSafeModeManager = new SCMSafeModeManager(
694+
scmSafeModeManager = new SCMSafeModeManager(
703695
config, containerManager, pipelineManager, nodeManager, queue,
704696
serviceManager, scmContext);
705697

706-
SCMDatanodeProtocolServer.NodeRegistrationContainerReport nodeRegistrationContainerReport =
707-
HddsTestUtils.createNodeRegistrationContainerReport(containers);
708-
queue.fireEvent(SCMEvents.NODE_REGISTRATION_CONT_REPORT, nodeRegistrationContainerReport);
709-
queue.fireEvent(SCMEvents.CONTAINER_REGISTRATION_REPORT, nodeRegistrationContainerReport);
698+
SCMDatanodeProtocolServer.NodeRegistrationContainerReport nodeRegistrationContainerReport =
699+
HddsTestUtils.createNodeRegistrationContainerReport(containers);
700+
queue.fireEvent(SCMEvents.NODE_REGISTRATION_CONT_REPORT, nodeRegistrationContainerReport);
701+
queue.fireEvent(SCMEvents.CONTAINER_REGISTRATION_REPORT, nodeRegistrationContainerReport);
702+
710703

711-
assertTrue(scmSafeModeManager.getInSafeMode());
704+
assertTrue(scmSafeModeManager.getInSafeMode());
712705

713-
firePipelineEvent(pipelineManager, pipeline);
706+
firePipelineEvent(pipelineManager, pipeline);
714707

715-
GenericTestUtils.waitFor(() -> !scmSafeModeManager.getInSafeMode(),
716-
100, 1000 * 10);
717-
pipelineManager.close();
718-
} finally {
719-
config.setBoolean(
720-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
721-
false);
722-
}
708+
GenericTestUtils.waitFor(() -> !scmSafeModeManager.getInSafeMode(),
709+
100, 1000 * 10);
710+
pipelineManager.close();
723711
}
724712

725713
@Test
726714
public void testPipelinesNotCreatedUntilPreCheckPasses() throws Exception {
727715
int numOfDns = 5;
728716
// enable pipeline check
729-
config.setBoolean(
730-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
731717
config.setInt(HddsConfigKeys.HDDS_SCM_SAFEMODE_MIN_DATANODE, numOfDns);
732718
config.setBoolean(HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION,
733719
true);

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestSCMPipelineBytesWrittenMetrics.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.util.UUID;
3131
import java.util.concurrent.TimeUnit;
3232
import org.apache.commons.lang3.RandomStringUtils;
33-
import org.apache.hadoop.hdds.HddsConfigKeys;
3433
import org.apache.hadoop.hdds.client.ReplicationFactor;
3534
import org.apache.hadoop.hdds.client.ReplicationType;
3635
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
@@ -63,8 +62,6 @@ public class TestSCMPipelineBytesWrittenMetrics {
6362
@BeforeEach
6463
public void setup() throws Exception {
6564
conf = new OzoneConfiguration();
66-
conf.set(HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
67-
Boolean.TRUE.toString());
6865
conf.setBoolean(OZONE_SCM_PIPELINE_AUTO_CREATE_FACTOR_ONE, false);
6966
conf.setInt(OZONE_DATANODE_PIPELINE_LIMIT, 1);
7067
conf.setTimeDuration(HDDS_PIPELINE_REPORT_INTERVAL, 10, TimeUnit.SECONDS);

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestSCMSafeModeWithPipelineRules.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ public void setup(int numDatanodes) throws Exception {
6161
conf = new OzoneConfiguration();
6262
conf.setTimeDuration(OZONE_SCM_HEARTBEAT_PROCESS_INTERVAL,
6363
100, TimeUnit.MILLISECONDS);
64-
conf.setBoolean(
65-
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
66-
true);
6764
conf.set(HddsConfigKeys.HDDS_SCM_WAIT_TIME_AFTER_SAFE_MODE_EXIT, "10s");
6865
conf.set(ScmConfigKeys.OZONE_SCM_PIPELINE_CREATION_INTERVAL, "10s");
6966
conf.setInt(OZONE_DATANODE_PIPELINE_LIMIT, 1);

0 commit comments

Comments
 (0)