amaliujia commented on code in PR #12075:
URL: https://github.com/apache/ozone/pull/12075#discussion_r4624178275
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java:
##########
@@ -893,6 +935,11 @@ public Collection<RaftPeer> getRaftPeers(RaftGroupId
groupId) throws IOException
return server.getDivision(groupId).getGroup().getPeers();
}
+ /** @return the {@link ReplicationType} of the given group. */
+ public ReplicationType getReplicationType(RaftGroupId groupId) throws
IOException {
+ return ((ContainerStateMachine)
server.getDivision(groupId).getStateMachine()).getReplicationType();
Review Comment:
We have this `addingGroups.put(groupId, type);`, so do we need to go to the
ContainerStateMachine to fetch the type? It looks like we can get the type
directly by `addingGroups.get(groupId)`.
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java:
##########
@@ -237,7 +245,14 @@ private int determinePort(String key, int defaultValue) {
}
private ContainerStateMachine getStateMachine(RaftGroupId gid) {
- return new ContainerStateMachine(datanodeService, gid, dispatcher,
containerController,
+ ReplicationType type = addingGroups.get(gid);
+ if (type == null) {
+ // The type is unknown when the group is reloaded on restart or added by
a peer.
+ // TODO HDDS-17845: support restart for CHAINED.
+ LOG.info("{}: ReplicationType is unknown, use {}", gid,
ReplicationType.RATIS);
Review Comment:
I know we defer handing of the DN restart, but is this LOG.info because to
noisy now after DN restarts? Because per my understanding, the DN restart will
lose the replication type from the ContainerSM as that was not persisted.
Then
1. Maybe lower the level of this log?
2. Probably we add a persisted metadata for RaftGroup then the replication
type is consistent with the RaftGroup and managed by Ratis. This can be
deferred (and likely need the Ratis change).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]