Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
780bfe8
IGNITE-26748 Add commands for control.sh
chesnokoff Nov 4, 2025
3431693
IGNITE-26748 Small fixes
chesnokoff Nov 5, 2025
9b50aef
IGNITE-26748 Update javadoc
chesnokoff Nov 5, 2025
6a59cf1
IGNITE-26748 Remove useless class
chesnokoff Nov 5, 2025
eb71e24
IGNITE-26748 Add more asserts
chesnokoff Nov 5, 2025
9139c32
IGNITE-26748 Add doc
chesnokoff Nov 5, 2025
7732599
IGNITE-26748 Extract RU args
chesnokoff Nov 5, 2025
c1b20b1
IGNITE-26699 Add RollingUpgradeTaskResult
chesnokoff Nov 5, 2025
9d7732e
IGNITE-26699 Update target-version flag
chesnokoff Nov 5, 2025
08e7249
IGNITE-26748 Add experimental flag
chesnokoff Nov 5, 2025
ef3d269
IGNITE-26748 Fix style
chesnokoff Nov 5, 2025
47fd796
IGNITE-26748 Fix test
chesnokoff Nov 5, 2025
f91df3c
IGNITE-26748 Update exception to catch
chesnokoff Nov 6, 2025
010e244
IGNITE-26748 Update tests
chesnokoff Nov 6, 2025
ddf4b39
IGNITE-26748 Update nodes method
chesnokoff Nov 6, 2025
a8d30a2
IGNITE-26748 Split Enable and Disable tasks
chesnokoff Nov 6, 2025
dff10f5
IGNITE-26748 Add warning about same versions of nodes
chesnokoff Nov 6, 2025
9246c33
IGNITE-26748 Replace IgnitePair with two fields
chesnokoff Nov 6, 2025
d17a44e
IGNITE-26748 Fix help logs
chesnokoff Nov 6, 2025
94a396f
IGNITE-26748 Add more info about enable command
chesnokoff Nov 6, 2025
8f9c98a
IGNITE-26748 Make targetVersion positional
chesnokoff Nov 6, 2025
68c9f01
IGNITE-26748 Replace Throwable error with String errMsg
chesnokoff Nov 6, 2025
4afe3ab
IGNITE-26748 Remove target version flag from test
chesnokoff Nov 6, 2025
9443bc6
IGNITE-26748 Remove enabled field from result
chesnokoff Nov 6, 2025
db5e9a8
IGNITE-26748 Fix style
chesnokoff Nov 6, 2025
27762a2
IGNITE-26748 Fix style
chesnokoff Nov 6, 2025
40841dd
IGNITE-26748 Fix style
chesnokoff Nov 6, 2025
1ebca3d
Revert "IGNITE-26748 Add more info about enable command"
chesnokoff Nov 6, 2025
1db2c0f
IGNITE-26748 Add confirmationPrompt
chesnokoff Nov 6, 2025
ded0809
IGNITE-26748 Fix output
chesnokoff Nov 6, 2025
d7ce36b
IGNITE-26748 Add autoConf
chesnokoff Nov 6, 2025
2b488a7
IGNITE-26748 Fix descriptions
chesnokoff Nov 6, 2025
eac64bc
IGNITE-26748 Add more info for disable result
chesnokoff Nov 6, 2025
069262e
IGNITE-26748 Fix tests
chesnokoff Nov 6, 2025
a5e2562
IGNITE-26748 Update prompt
chesnokoff Nov 6, 2025
9c68bc4
IGNITE-26748 Fix checkParseAutoConfirmationFlag
chesnokoff Nov 6, 2025
c41d4dc
IGNITE-26748 Add details about target version
chesnokoff Nov 7, 2025
12d78c1
IGNITE-26748 Add details about target version (examples)
chesnokoff Nov 7, 2025
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 @@ -76,6 +76,7 @@
import org.apache.ignite.internal.management.metric.MetricCommand;
import org.apache.ignite.internal.management.performancestatistics.PerformanceStatisticsCommand;
import org.apache.ignite.internal.management.property.PropertyCommand;
import org.apache.ignite.internal.management.rollingupgrade.RollingUpgradeCommand;
import org.apache.ignite.internal.management.snapshot.SnapshotCommand;
import org.apache.ignite.internal.management.snapshot.SnapshotRestoreCommand;
import org.apache.ignite.internal.management.tx.TxCommand;
Expand Down Expand Up @@ -1391,6 +1392,7 @@ private boolean requireArgs(Class<?> cmd) {
cmd == MetaCommand.class ||
cmd == WarmUpCommand.class ||
cmd == PropertyCommand.class ||
cmd == RollingUpgradeCommand.class ||
cmd == SystemViewCommand.class ||
cmd == MetricCommand.class ||
cmd == DefragmentationCommand.class ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.ignite.util.IdleVerifyDumpTest;
import org.apache.ignite.util.MetricCommandTest;
import org.apache.ignite.util.PerformanceStatisticsCommandTest;
import org.apache.ignite.util.RollingUpgradeCommandTest;
import org.apache.ignite.util.SystemViewCommandTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
Expand All @@ -63,6 +64,7 @@
GridCommandHandlerConsistencySensitiveTest.class,
GridCommandHandlerConsistencyRepairCorrectnessAtomicTest.class,

RollingUpgradeCommandTest.class,
SystemViewCommandTest.class,
MetricCommandTest.class,
PerformanceStatisticsCommandTest.class,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* 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.util;

import org.apache.ignite.internal.management.rollingupgrade.RollingUpgradeCommand;
import org.apache.ignite.internal.util.lang.IgnitePair;
import org.apache.ignite.lang.IgniteProductVersion;
import org.junit.Test;

import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_BUILD_VER;
import static org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_OK;

/** Tests {@link RollingUpgradeCommand} command. */
public class RollingUpgradeCommandTest extends GridCommandHandlerClusterByClassAbstractTest {
/** */
public static final String ENABLE = "enable";

/** */
public static final String DISABLE = "disable";

/** */
public static final String ROLLING_UPGRADE = "--rolling-upgrade";

/** */
@Test
public void testCommands() {
int res = execute(ROLLING_UPGRADE, DISABLE);

assertEquals(EXIT_CODE_OK, res);
assertEquals("Rolling upgrade disabled", lastOperationResult);

IgniteProductVersion curVer = IgniteProductVersion.fromString(crd.localNode().attribute(ATTR_BUILD_VER));

String targetVerStr = curVer.major() + "." + (curVer.minor() + 1) + ".0";

res = execute(ROLLING_UPGRADE, ENABLE, targetVerStr);
assertEquals(EXIT_CODE_OK, res);

assertTrue(crd.context().rollingUpgrade().enabled());

IgniteProductVersion targetVer = IgniteProductVersion.fromString(targetVerStr);

IgnitePair<IgniteProductVersion> versions = crd.context().rollingUpgrade().versions();

assertNotNull(versions);

assertEquals(curVer, versions.get1());
assertEquals(targetVer, versions.get2());

assertEquals(
"Rolling upgrade enabled [currentVersion=" + curVer + ", targetVersion=" + targetVer + ']',
lastOperationResult
);

res = execute(ROLLING_UPGRADE, DISABLE);

assertEquals(EXIT_CODE_OK, res);
assertEquals("Rolling upgrade disabled", lastOperationResult);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.ignite.internal.management.performancestatistics.PerformanceStatisticsCommand;
import org.apache.ignite.internal.management.persistence.PersistenceCommand;
import org.apache.ignite.internal.management.property.PropertyCommand;
import org.apache.ignite.internal.management.rollingupgrade.RollingUpgradeCommand;
import org.apache.ignite.internal.management.snapshot.SnapshotCommand;
import org.apache.ignite.internal.management.tracing.TracingConfigurationCommand;
import org.apache.ignite.internal.management.tx.TxCommand;
Expand Down Expand Up @@ -67,6 +68,7 @@ public IgniteCommandRegistry() {
new TracingConfigurationCommand(),
new WarmUpCommand(),
new PropertyCommand(),
new RollingUpgradeCommand(),
new SystemViewCommand(),
new MetricCommand(),
new PersistenceCommand(),
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's move all nested classes to separate files

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cas use NoArg instead?

/** */
private static final long serialVersionUID = 0;

/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
// No-op.
}

/** {@inheritDoc} */
@Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
// No-op.
}
}

/** Rolling upgrade enable command argument. */
public static class RollingUpgradeEnableCommandArg extends RollingUpgradeCommandArg {
/** */
private static final long serialVersionUID = 0;

/** Target version. */
@Argument(description = "Target Ignite version", example = "2.18.0")
@Positional
private String targetVersion;

/** */
public String targetVersion() {
return targetVersion;
}

/** */
public void targetVersion(String targetVersion) {
this.targetVersion = targetVersion;
}

/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
U.writeString(out, targetVersion);
}

/** {@inheritDoc} */
@Override protected void readExternalData(ObjectInput in) throws IOException, ClassNotFoundException {
targetVersion = U.readString(in);
}
}

/** Rolling upgrade disable command argument. */
public static class RollingUpgradeDisableCommandArg extends RollingUpgradeCommandArg {
/** */
private static final long serialVersionUID = 0;
}
}
Original file line number Diff line number Diff line change
@@ -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";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's mention that all nodes in cluster must be the same version.

}

/** {@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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

}
}
Original file line number Diff line number Diff line change
@@ -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.RollingUpgradeEnableCommandArg;

import static org.apache.ignite.internal.management.api.CommandUtils.coordinatorOrNull;
import static org.apache.ignite.internal.management.rollingupgrade.RollingUpgradeCommand.RollingUpgradeCommandArg;

/** Command to enable rolling upgrade. */
public class RollingUpgradeEnableCommand implements ComputeCommand<RollingUpgradeCommandArg, String> {
/** {@inheritDoc} */
@Override public String description() {
return "Enable rolling upgrade";
}

/** {@inheritDoc} */
@Override public Class<RollingUpgradeEnableCommandArg> argClass() {
return RollingUpgradeEnableCommandArg.class;
}

/** {@inheritDoc} */
@Override public Class<RollingUpgradeTask> taskClass() {
return RollingUpgradeTask.class;
}

/** {@inheritDoc} */
@Override public Collection<ClusterNode> nodes(Collection<ClusterNode> nodes, RollingUpgradeCommandArg arg) {
return coordinatorOrNull(nodes);
}
}
Loading