Skip to content

Commit

Permalink
HDDS-11243. SCM SafeModeRule Support EC. (apache#7008)
Browse files Browse the repository at this point in the history
  • Loading branch information
slfan1989 authored Nov 26, 2024
1 parent 6871547 commit a99ab27
Show file tree
Hide file tree
Showing 15 changed files with 461 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ public String configFormat() {
+ "/" + data + "-" + parity + "-" + chunkKB();
}

@Override
public int getMinimumNodes() {
return data;
}

private String chunkKB() {
return ecChunkSize / 1024 + "k";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,9 @@ public String toString() {
public String configFormat() {
return toString();
}

@Override
public int getMinimumNodes() {
return 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,6 @@ static ReplicationConfig parseWithoutFallback(ReplicationType type,

String configFormat();

/** Minimum number of nodes, below this data loss happens. */
int getMinimumNodes();
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,9 @@ public String toString() {
public String configFormat() {
return toString();
}

@Override
public int getMinimumNodes() {
return replicationFactor.getNumber();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
.StorageContainerDatanodeProtocolProtos.ContainerReportsProto;
import org.apache.hadoop.hdds.scm.ScmConfig;
import org.apache.hadoop.hdds.scm.container.report.ContainerReportValidator;
import org.apache.hadoop.hdds.scm.events.SCMEvents;
import org.apache.hadoop.hdds.scm.ha.SCMContext;
import org.apache.hadoop.hdds.scm.node.NodeManager;
import org.apache.hadoop.hdds.scm.node.states.NodeNotFoundException;
import org.apache.hadoop.hdds.scm.server.SCMDatanodeHeartbeatDispatcher
.ContainerReportFromDatanode;
import org.apache.hadoop.hdds.scm.server.SCMDatanodeProtocolServer;
import org.apache.hadoop.hdds.server.events.EventHandler;
import org.apache.hadoop.hdds.server.events.EventPublisher;
import org.apache.hadoop.ozone.common.statemachine.InvalidStateTransitionException;
Expand Down Expand Up @@ -199,6 +201,11 @@ public void onMessage(final ContainerReportFromDatanode reportFromDatanode,
// list
processMissingReplicas(datanodeDetails, expectedContainersInDatanode);
containerManager.notifyContainerReportProcessing(true, true);
if (reportFromDatanode.isRegister()) {
publisher.fireEvent(SCMEvents.CONTAINER_REGISTRATION_REPORT,
new SCMDatanodeProtocolServer.NodeRegistrationContainerReport(datanodeDetails,
reportFromDatanode.getReport()));
}
}
} catch (NodeNotFoundException ex) {
containerManager.notifyContainerReportProcessing(true, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ public final class SCMEvents {
NodeRegistrationContainerReport.class,
"Node_Registration_Container_Report");

/**
* Event generated on DataNode Registration Container Report.
*/
public static final TypedEvent<NodeRegistrationContainerReport>
CONTAINER_REGISTRATION_REPORT = new TypedEvent<>(
NodeRegistrationContainerReport.class, "Container_Registration_Report");

/**
* ContainerReports are sent out by Datanodes. This report is received by
* SCMDatanodeHeartbeatDispatcher and Container_Report Event is generated.
Expand Down
Loading

0 comments on commit a99ab27

Please sign in to comment.