Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -81,11 +81,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 @@ -1635,15 +1635,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 All @@ -30,7 +29,6 @@
import org.apache.hadoop.hdds.scm.events.SCMEvents;
import org.apache.hadoop.hdds.scm.exceptions.SCMException;
import org.apache.hadoop.hdds.scm.ha.SCMContext;
import org.apache.hadoop.hdds.scm.safemode.SafeModeManager;
import org.apache.hadoop.hdds.scm.server.SCMDatanodeHeartbeatDispatcher.PipelineReportFromDatanode;
import org.apache.hadoop.hdds.server.events.EventHandler;
import org.apache.hadoop.hdds.server.events.EventPublisher;
Expand All @@ -50,23 +48,16 @@ public class PipelineReportHandler implements
private static final Logger LOGGER = LoggerFactory.getLogger(
PipelineReportHandler.class);
private final PipelineManager pipelineManager;
private final SafeModeManager scmSafeModeManager;
private final SCMContext scmContext;
private final boolean pipelineAvailabilityCheck;
private final SCMPipelineMetrics metrics;

public PipelineReportHandler(SafeModeManager scmSafeModeManager,
PipelineManager pipelineManager,
public PipelineReportHandler(PipelineManager pipelineManager,
SCMContext scmContext,
ConfigurationSource conf) {
Preconditions.checkNotNull(pipelineManager);
this.scmSafeModeManager = 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,9 +131,7 @@ protected void processPipelineReport(PipelineReport report,
}
}
if (pipeline.isHealthy()) {
if (pipelineAvailabilityCheck && scmSafeModeManager.getInSafeMode()) {
Comment thread
aryangupta1998 marked this conversation as resolved.
publisher.fireEvent(SCMEvents.OPEN_PIPELINE, pipeline);
}
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 @@ -75,13 +74,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 @@ -461,8 +461,7 @@ private void initializeEventHandlers() {
NodeReportHandler nodeReportHandler =
new NodeReportHandler(scmNodeManager);
PipelineReportHandler pipelineReportHandler =
new PipelineReportHandler(
scmSafeModeManager, pipelineManager, scmContext, configuration);
new PipelineReportHandler(pipelineManager, scmContext, configuration);
CommandStatusReportHandler cmdStatusReportHandler =
new CommandStatusReportHandler();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,6 @@ public void testClosePipelineShouldFailOnFollower() throws Exception {
@Test
public void testPipelineReport() throws Exception {
try (PipelineManagerImpl pipelineManager = createPipelineManager(true)) {
SCMSafeModeManager scmSafeModeManager =
new SCMSafeModeManager(conf,
mock(ContainerManager.class), pipelineManager,
new EventQueue(), serviceManager, scmContext);
Pipeline pipeline = pipelineManager
.createPipeline(RatisReplicationConfig
.getInstance(ReplicationFactor.THREE));
Expand All @@ -370,8 +366,7 @@ public void testPipelineReport() throws Exception {
pipelineManager.getPipeline(pipeline.getId()).isHealthy());
// get pipeline report from each dn in the pipeline
PipelineReportHandler pipelineReportHandler =
new PipelineReportHandler(scmSafeModeManager, pipelineManager,
SCMContext.emptyContext(), conf);
new PipelineReportHandler(pipelineManager, SCMContext.emptyContext(), conf);
nodes.subList(0, 2).forEach(dn -> sendPipelineReport(dn, pipeline,
pipelineReportHandler, false));
sendPipelineReport(nodes.get(nodes.size() - 1), pipeline,
Expand Down Expand Up @@ -467,13 +462,8 @@ public void testPipelineOpenOnlyWhenLeaderReported() throws Exception {
assertEquals(Pipeline.PipelineState.ALLOCATED,
pipelineManager.getPipeline(pipeline.getId()).getPipelineState());

SCMSafeModeManager scmSafeModeManager =
new SCMSafeModeManager(new OzoneConfiguration(),
mock(ContainerManager.class), pipelineManager, new EventQueue(),
serviceManager, scmContext);
PipelineReportHandler pipelineReportHandler =
new PipelineReportHandler(scmSafeModeManager, pipelineManager,
SCMContext.emptyContext(), conf);
new PipelineReportHandler(pipelineManager, SCMContext.emptyContext(), conf);

// Report pipelines with leaders
List<DatanodeDetails> nodes = pipeline.getNodes();
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 @@ -210,9 +210,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,55 @@ 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));

scmSafeModeManager = new SCMSafeModeManager(
config, containerManager, pipelineManager, queue, serviceManager,
scmContext);
pipeline = pipelineManager.getPipeline(pipeline.getId());
MockRatisPipelineProvider.markPipelineHealthy(pipeline);
ContainerManager containerManager = mock(ContainerManager.class);
when(containerManager.getContainers()).thenReturn(containers);

SCMDatanodeProtocolServer.NodeRegistrationContainerReport nodeRegistrationContainerReport =
HddsTestUtils.createNodeRegistrationContainerReport(containers);
queue.fireEvent(SCMEvents.NODE_REGISTRATION_CONT_REPORT, nodeRegistrationContainerReport);
queue.fireEvent(SCMEvents.CONTAINER_REGISTRATION_REPORT, nodeRegistrationContainerReport);
scmSafeModeManager = new SCMSafeModeManager(
config, containerManager, pipelineManager, queue, serviceManager,
scmContext);

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

firePipelineEvent(pipelineManager, pipeline);
assertTrue(scmSafeModeManager.getInSafeMode());

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

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
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.apache.hadoop.hdds.scm.pipeline.PipelineManager;
import org.apache.hadoop.hdds.scm.pipeline.PipelineNotFoundException;
import org.apache.hadoop.hdds.scm.pipeline.PipelineReportHandler;
import org.apache.hadoop.hdds.scm.safemode.SafeModeManager;
import org.apache.hadoop.hdds.server.events.EventPublisher;
import org.apache.hadoop.ipc.RemoteException;
import org.apache.hadoop.ozone.recon.spi.StorageContainerServiceProvider;
Expand All @@ -45,12 +44,11 @@ public class ReconPipelineReportHandler extends PipelineReportHandler {

private StorageContainerServiceProvider scmServiceProvider;

public ReconPipelineReportHandler(SafeModeManager scmSafeModeManager,
PipelineManager pipelineManager,
public ReconPipelineReportHandler(PipelineManager pipelineManager,
SCMContext scmContext,
ConfigurationSource conf,
StorageContainerServiceProvider scmServiceProvider) {
super(scmSafeModeManager, pipelineManager, scmContext, conf);
super(pipelineManager, scmContext, conf);
this.scmServiceProvider = scmServiceProvider;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,7 @@ public ReconStorageContainerManagerFacade(OzoneConfiguration conf,

this.safeModeManager = safeModeManager;
ReconPipelineReportHandler pipelineReportHandler =
new ReconPipelineReportHandler(safeModeManager,
pipelineManager, scmContext, conf, scmServiceProvider);
new ReconPipelineReportHandler(pipelineManager, scmContext, conf, scmServiceProvider);

PipelineActionHandler pipelineActionHandler =
new PipelineActionHandler(pipelineManager, scmContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ public void testProcessPipelineReport()
OzoneConfiguration configuration = new OzoneConfiguration();

ReconPipelineReportHandler handler =
new ReconPipelineReportHandler(new ReconSafeModeManager(),
reconPipelineManagerMock, SCMContext.emptyContext(),
new ReconPipelineReportHandler(reconPipelineManagerMock, SCMContext.emptyContext(),
configuration, scmServiceProviderMock);

EventPublisher eventPublisherMock = mock(EventPublisher.class);
Expand Down