Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ public final class HddsConfigKeys {
public static final String
HDDS_SCM_WAIT_TIME_AFTER_SAFE_MODE_EXIT_DEFAULT = "5m";

public static final String HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK =
"hdds.scm.safemode.pipeline-availability.check";
public static final boolean
HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK_DEFAULT = true;

public static final String HDDS_SCM_SAFEMODE_PIPELINE_CREATION =
"hdds.scm.safemode.pipeline.creation";
public static final boolean
Expand Down
9 changes: 0 additions & 9 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1659,15 +1659,6 @@
</description>
</property>

<property>
<name>hdds.scm.safemode.pipeline-availability.check</name>
<value>true</value>
<tag>HDDS,SCM,OPERATION</tag>
<description>
Boolean value to enable pipeline availability check during SCM safe mode.
</description>
</property>

<property>
<name>hdds.scm.safemode.healthy.pipeline.pct</name>
<value>0.10</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
import org.apache.hadoop.hdds.HddsConfigKeys;
import org.apache.hadoop.hdds.client.RatisReplicationConfig;
import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
Expand Down Expand Up @@ -52,7 +51,6 @@ public class PipelineReportHandler implements
private final PipelineManager pipelineManager;
private final SafeModeManager scmSafeModeManager;
private final SCMContext scmContext;
private final boolean pipelineAvailabilityCheck;
private final SCMPipelineMetrics metrics;

public PipelineReportHandler(SafeModeManager scmSafeModeManager,
Expand All @@ -64,9 +62,6 @@ public PipelineReportHandler(SafeModeManager scmSafeModeManager,
this.pipelineManager = pipelineManager;
this.scmContext = scmContext;
this.metrics = SCMPipelineMetrics.create();
this.pipelineAvailabilityCheck = conf.getBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK_DEFAULT);
}

@Override
Expand Down Expand Up @@ -140,7 +135,7 @@ protected void processPipelineReport(PipelineReport report,
}
}
if (pipeline.isHealthy()) {
if (pipelineAvailabilityCheck && scmSafeModeManager.getInSafeMode()) {
if (scmSafeModeManager.getInSafeMode()) {
publisher.fireEvent(SCMEvents.OPEN_PIPELINE, pipeline);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public class SafeModeMetrics {
private @Metric MutableCounterLong
currentContainersWithECDataReplicaReportedCount;

// When hdds.scm.safemode.pipeline-availability.check is set then only
// below metrics will have some values, otherwise they will be zero.
// Pipeline metrics for safemode
private @Metric MutableGaugeLong numHealthyPipelinesThreshold;
private @Metric MutableCounterLong currentHealthyPipelinesCount;
private @Metric MutableGaugeLong
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.util.ArrayList;
import java.util.List;
import org.apache.hadoop.hdds.HddsConfigKeys;
import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.scm.container.ContainerManager;
import org.apache.hadoop.hdds.scm.ha.SCMContext;
Expand Down Expand Up @@ -79,13 +78,8 @@ private void loadRules() {

preCheckRules.add(datanodeRule);

// TODO: Move isRuleEnabled check to the Rule implementation. (HDDS-11799)
if (config.getBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK_DEFAULT)
&& pipelineManager != null) {

safeModeRules.add(new HealthyPipelineSafeModeRule(eventQueue, pipelineManager,
if (pipelineManager != null) {
safeModeRules.add(new HealthyPipelineSafeModeRule(eventQueue, pipelineManager,
safeModeManager, config, scmContext));
safeModeRules.add(new OneReplicaPipelineSafeModeRule(eventQueue, pipelineManager,
safeModeManager, config));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ public void testHealthyPipelineSafeModeRuleWithNoPipelines()
when(containerManager.getContainers()).thenReturn(containers);
config.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempFile.getPath());
// enable pipeline check
config.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
config.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);
SCMMetadataStore scmMetadataStore = new SCMMetadataStoreImpl(config);
Expand Down Expand Up @@ -128,8 +126,6 @@ public void testHealthyPipelineSafeModeRuleWithPipelines() throws Exception {
when(containerManager.getContainers()).thenReturn(containers);
config.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempFile.getPath());
// enable pipeline check
config.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
config.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);

Expand Down Expand Up @@ -224,8 +220,6 @@ public void testHealthyPipelineSafeModeRuleWithMixedPipelines()
when(containerManager.getContainers()).thenReturn(containers);
config.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempFile.getPath());
// enable pipeline check
config.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
config.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ public class TestOneReplicaPipelineSafeModeRule {
private void setup(int nodes, int pipelineFactorThreeCount,
int pipelineFactorOneCount) throws Exception {
OzoneConfiguration ozoneConfiguration = new OzoneConfiguration();
ozoneConfiguration.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
ozoneConfiguration.set(HddsConfigKeys.OZONE_METADATA_DIRS,
tempDir.toString());
ozoneConfiguration.setBoolean(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ public void testSafeModeExitRule() throws Exception {
private OzoneConfiguration createConf(double healthyPercent,
double oneReplicaPercent) {
OzoneConfiguration conf = new OzoneConfiguration(config);
conf.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
true);
conf.setDouble(HddsConfigKeys.
HDDS_SCM_SAFEMODE_HEALTHY_PIPELINE_THRESHOLD_PCT, healthyPercent);
conf.setDouble(HddsConfigKeys.
Expand Down Expand Up @@ -667,67 +664,56 @@ private void testECContainerThreshold(List<ContainerInfo> dnContainers,
public void testSafeModePipelineExitRule() throws Exception {
containers = new ArrayList<>();
containers.addAll(HddsTestUtils.getContainerInfo(25 * 4));
try {
MockNodeManager nodeManager = new MockNodeManager(true, 3);
// enable pipeline check
config.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);

PipelineManagerImpl pipelineManager =
PipelineManagerImpl.newPipelineManager(
config,
SCMHAManagerStub.getInstance(true),
nodeManager,
scmMetadataStore.getPipelineTable(),
queue,
scmContext,
serviceManager,
Clock.system(ZoneOffset.UTC));

PipelineProvider<RatisReplicationConfig> mockRatisProvider =
new MockRatisPipelineProvider(nodeManager,
pipelineManager.getStateManager(), config);
pipelineManager.setPipelineProvider(HddsProtos.ReplicationType.RATIS,
mockRatisProvider);
MockNodeManager nodeManager = new MockNodeManager(true, 3);
PipelineManagerImpl pipelineManager =
PipelineManagerImpl.newPipelineManager(
config,
SCMHAManagerStub.getInstance(true),
nodeManager,
scmMetadataStore.getPipelineTable(),
queue,
scmContext,
serviceManager,
Clock.system(ZoneOffset.UTC));

Pipeline pipeline = pipelineManager.createPipeline(
RatisReplicationConfig.getInstance(
ReplicationFactor.THREE));
PipelineProvider<RatisReplicationConfig> mockRatisProvider =
new MockRatisPipelineProvider(nodeManager,
pipelineManager.getStateManager(), config);
pipelineManager.setPipelineProvider(HddsProtos.ReplicationType.RATIS,
mockRatisProvider);

pipeline = pipelineManager.getPipeline(pipeline.getId());
MockRatisPipelineProvider.markPipelineHealthy(pipeline);
ContainerManager containerManager = mock(ContainerManager.class);
when(containerManager.getContainers()).thenReturn(containers);
Pipeline pipeline = pipelineManager.createPipeline(
RatisReplicationConfig.getInstance(
ReplicationFactor.THREE));

pipeline = pipelineManager.getPipeline(pipeline.getId());
MockRatisPipelineProvider.markPipelineHealthy(pipeline);
ContainerManager containerManager = mock(ContainerManager.class);
when(containerManager.getContainers()).thenReturn(containers);

scmSafeModeManager = new SCMSafeModeManager(
scmSafeModeManager = new SCMSafeModeManager(
config, containerManager, pipelineManager, nodeManager, queue,
serviceManager, scmContext);

SCMDatanodeProtocolServer.NodeRegistrationContainerReport nodeRegistrationContainerReport =
HddsTestUtils.createNodeRegistrationContainerReport(containers);
queue.fireEvent(SCMEvents.NODE_REGISTRATION_CONT_REPORT, nodeRegistrationContainerReport);
queue.fireEvent(SCMEvents.CONTAINER_REGISTRATION_REPORT, nodeRegistrationContainerReport);
SCMDatanodeProtocolServer.NodeRegistrationContainerReport nodeRegistrationContainerReport =
HddsTestUtils.createNodeRegistrationContainerReport(containers);
queue.fireEvent(SCMEvents.NODE_REGISTRATION_CONT_REPORT, nodeRegistrationContainerReport);
queue.fireEvent(SCMEvents.CONTAINER_REGISTRATION_REPORT, nodeRegistrationContainerReport);


assertTrue(scmSafeModeManager.getInSafeMode());
assertTrue(scmSafeModeManager.getInSafeMode());

firePipelineEvent(pipelineManager, pipeline);
firePipelineEvent(pipelineManager, pipeline);

GenericTestUtils.waitFor(() -> !scmSafeModeManager.getInSafeMode(),
100, 1000 * 10);
pipelineManager.close();
} finally {
config.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
false);
}
GenericTestUtils.waitFor(() -> !scmSafeModeManager.getInSafeMode(),
100, 1000 * 10);
pipelineManager.close();
}

@Test
public void testPipelinesNotCreatedUntilPreCheckPasses() throws Exception {
int numOfDns = 5;
// enable pipeline check
config.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
config.setInt(HddsConfigKeys.HDDS_SCM_SAFEMODE_MIN_DATANODE, numOfDns);
config.setBoolean(HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION,
true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.hadoop.hdds.HddsConfigKeys;
import org.apache.hadoop.hdds.client.ReplicationFactor;
import org.apache.hadoop.hdds.client.ReplicationType;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
Expand Down Expand Up @@ -63,8 +62,6 @@ public class TestSCMPipelineBytesWrittenMetrics {
@BeforeEach
public void setup() throws Exception {
conf = new OzoneConfiguration();
conf.set(HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
Boolean.TRUE.toString());
conf.setBoolean(OZONE_SCM_PIPELINE_AUTO_CREATE_FACTOR_ONE, false);
conf.setInt(OZONE_DATANODE_PIPELINE_LIMIT, 1);
conf.setTimeDuration(HDDS_PIPELINE_REPORT_INTERVAL, 10, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ public void setup(int numDatanodes) throws Exception {
conf = new OzoneConfiguration();
conf.setTimeDuration(OZONE_SCM_HEARTBEAT_PROCESS_INTERVAL,
100, TimeUnit.MILLISECONDS);
conf.setBoolean(
HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
true);
conf.set(HddsConfigKeys.HDDS_SCM_WAIT_TIME_AFTER_SAFE_MODE_EXIT, "10s");
conf.set(ScmConfigKeys.OZONE_SCM_PIPELINE_CREATION_INTERVAL, "10s");
conf.setInt(OZONE_DATANODE_PIPELINE_LIMIT, 1);
Expand Down