sanpwc commented on code in PR #795:
URL: https://github.com/apache/ignite-3/pull/795#discussion_r879784047
##########
modules/cluster-management/src/main/java/org/apache/ignite/internal/cluster/management/raft/CmgRaftGroupListener.java:
##########
@@ -73,15 +81,42 @@ public void onWrite(Iterator<CommandClosure<WriteCommand>>
iterator) {
if (command instanceof WriteStateCommand) {
storage.putClusterState(((WriteStateCommand)
command).clusterState());
+
+ clo.result(null);
} else if (command instanceof JoinRequestCommand) {
- // TODO: perform validation
https://issues.apache.org/jira/browse/IGNITE-16717
+ Serializable response =
validationTokenManager.validateNode((JoinRequestCommand) command);
+
+ clo.result(response);
} else if (command instanceof JoinReadyCommand) {
- storage.putLogicalTopologyNode(((JoinReadyCommand)
command).node());
+ Serializable response =
validationTokenManager.completeValidation((JoinReadyCommand) command);
+
+ // Non-null response means that the node has not passed the
validation step.
+ if (response == null) {
+ addNodeToLogicalTopology((JoinReadyCommand) command);
+ }
+
+ clo.result(response);
} else if (command instanceof NodesLeaveCommand) {
- storage.removeLogicalTopologyNodes(((NodesLeaveCommand)
command).nodes());
+ removeNodesFromLogicalTopology((NodesLeaveCommand) command);
+
+ clo.result(null);
}
+ }
+ }
+
+ private void addNodeToLogicalTopology(JoinReadyCommand command) {
+ storage.putLogicalTopologyNode(command.node());
+
+ log.info("Node {} has been added to the logical topology",
command.node().name());
Review Comment:
> why would it be beneficial in this case, for example?
You are right, in this particular case there's no sense in `if
(LOG.isInfoEnabled())`
> Again, why?
Because we either should use LOG or log, but not both. Currently LOG is
preferable option, probably because it's static.
--
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]