timoninmaxim commented on code in PR #12494:
URL: https://github.com/apache/ignite/pull/12494#discussion_r2494026698


##########
modules/core/src/main/java/org/apache/ignite/internal/management/rollingupgrade/RollingUpgradeCommand.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.management.rollingupgrade;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.management.api.Argument;
+import org.apache.ignite.internal.management.api.CommandRegistryImpl;
+import org.apache.ignite.internal.management.api.Positional;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/** Rolling upgrade commands. */
+public class RollingUpgradeCommand extends CommandRegistryImpl {
+    /** */
+    public RollingUpgradeCommand() {
+        super(
+            new RollingUpgradeEnableCommand(),
+            new RollingUpgradeDisableCommand()
+        );
+    }
+
+    /** Base rolling upgrade command argument. */
+    public static class RollingUpgradeCommandArg extends 
IgniteDataTransferObject {

Review Comment:
   Cas use NoArg instead?



##########
modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_help.output:
##########
@@ -371,6 +371,15 @@ If the file name isn't specified the output file name is: 
'<typeId>.bin':
   Set the property value:
     control.(sh|bat) --property set --name <property_name> --val 
<property_value>
 
+  Enable rolling upgrade:
+    control.(sh|bat) --rolling-upgrade enable 2.18.0
+
+    Parameters:
+      2.18.0  - Target Ignite version.

Review Comment:
   2.18.0 --> target_version?



##########
modules/core/src/main/java/org/apache/ignite/internal/management/rollingupgrade/RollingUpgradeCommand.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.management.rollingupgrade;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.management.api.Argument;
+import org.apache.ignite.internal.management.api.CommandRegistryImpl;
+import org.apache.ignite.internal.management.api.Positional;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/** Rolling upgrade commands. */
+public class RollingUpgradeCommand extends CommandRegistryImpl {
+    /** */
+    public RollingUpgradeCommand() {
+        super(
+            new RollingUpgradeEnableCommand(),
+            new RollingUpgradeDisableCommand()
+        );
+    }
+
+    /** Base rolling upgrade command argument. */
+    public static class RollingUpgradeCommandArg extends 
IgniteDataTransferObject {

Review Comment:
   Let's move all nested classes to separate files



##########
modules/core/src/main/java/org/apache/ignite/internal/management/rollingupgrade/RollingUpgradeDisableCommand.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.management.rollingupgrade;
+
+import java.util.Collection;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.management.api.ComputeCommand;
+import 
org.apache.ignite.internal.management.rollingupgrade.RollingUpgradeCommand.RollingUpgradeDisableCommandArg;
+
+import static 
org.apache.ignite.internal.management.api.CommandUtils.coordinatorOrNull;
+import static 
org.apache.ignite.internal.management.rollingupgrade.RollingUpgradeCommand.RollingUpgradeCommandArg;
+
+/** Command to disable rolling upgrade mode. */
+public class RollingUpgradeDisableCommand implements 
ComputeCommand<RollingUpgradeCommandArg, String> {
+    /** {@inheritDoc} */
+    @Override public String description() {
+        return "Disable rolling upgrade";
+    }
+
+    /** {@inheritDoc} */
+    @Override public Class<RollingUpgradeDisableCommandArg> argClass() {
+        return RollingUpgradeDisableCommandArg.class;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Class<RollingUpgradeTask> taskClass() {
+        return RollingUpgradeTask.class;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<ClusterNode> nodes(Collection<ClusterNode> 
nodes, RollingUpgradeCommandArg arg) {
+        return coordinatorOrNull(nodes);

Review Comment:
   We must send message only on coordinator. In case of null default node is 
chosen. 



##########
modules/core/src/main/java/org/apache/ignite/internal/management/rollingupgrade/RollingUpgradeTask.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.management.rollingupgrade;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import 
org.apache.ignite.internal.management.rollingupgrade.RollingUpgradeCommand.RollingUpgradeCommandArg;
+import 
org.apache.ignite.internal.management.rollingupgrade.RollingUpgradeCommand.RollingUpgradeDisableCommandArg;
+import 
org.apache.ignite.internal.management.rollingupgrade.RollingUpgradeCommand.RollingUpgradeEnableCommandArg;
+import 
org.apache.ignite.internal.processors.rollingupgrade.RollingUpgradeProcessor;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.lang.IgnitePair;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+import org.apache.ignite.lang.IgniteProductVersion;
+
+/** Task to manage rolling upgrade. */
+@GridInternal
+public class RollingUpgradeTask extends 
VisorOneNodeTask<RollingUpgradeCommandArg, String> {

Review Comment:
   String looks wrong, task should return result - boolean/Throwable/versions, 
and caller should handle task result - build a message to user, store state, etc



-- 
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]

Reply via email to