Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-11243. SCM SafeModeRule Support EC. #7008

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -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()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the CONTAINER_REPORT is completed, we send the message to CONTAINER_REGISTRATION_REPORT to ensure that the container count is accurate.

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
Loading