timoninmaxim commented on code in PR #12301:
URL: https://github.com/apache/ignite/pull/12301#discussion_r2324743579
##########
modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java:
##########
@@ -59,59 +68,260 @@ public class GridReleaseTypeSelfTest extends
GridCommonAbstractTest {
stopAllGrids();
}
- /**
- * @throws Exception If failed.
- */
+ /** */
+ @Test
+ public void testTwoConflictVersions() {
+ testConflictVersions("2.18.0", "2.16.0", false);
+ testConflictVersions("2.19.0", "2.17.6", false);
+ testConflictVersions("2.20.0", "2.22.2", false);
+ testConflictVersions("2.21.0", "2.23.1", false);
+ }
+
+ /** */
+ @Test
+ public void testThreeConflictVersions() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", false);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", false);
+
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", false);
+
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", false);
+ }
+
+ /** */
@Test
- public void testOsEditionDoesNotSupportRollingUpdates() throws Exception {
- nodeVer = "1.0.0";
+ public void testTwoConflictVersionsWithClient() {
+ testConflictVersions("2.18.0", "2.16.0", true);
+ testConflictVersions("2.19.0", "2.17.6", true);
+ testConflictVersions("2.20.0", "2.22.2", true);
+ testConflictVersions("2.21.0", "2.23.1", true);
+ }
- startGrid(0);
+ /** */
+ @Test
+ public void testThreeConflictVersionsWithClients() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", true);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", true);
- try {
- nodeVer = "1.0.1";
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", true);
- startGrid(1);
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", true);
+ }
+
+ /**
+ */
+ @Test
+ public void testTwoCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", false);
+ testCompatibleVersions("2.19.0", "2.20.6", false);
+ testCompatibleVersions("2.20.0", "2.20.2", false);
+ testCompatibleVersions("2.21.0", "2.21.1", false);
+ }
- fail("Exception has not been thrown.");
- }
- catch (IgniteCheckedException e) {
- StringWriter errors = new StringWriter();
+ /**
+ */
+ @Test
+ public void testThreeCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", false);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", false);
- e.printStackTrace(new PrintWriter(errors));
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", false);
- String stackTrace = errors.toString();
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", false);
- if (!stackTrace.contains("Local node and remote node have
different version numbers"))
- throw e;
- }
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", false);
}
/**
- * @throws Exception If failed.
*/
@Test
- public void testOsEditionDoesNotSupportRollingUpdatesClientMode() throws
Exception {
- nodeVer = "1.0.0";
+ public void testTwoCompatibleVersionsWithClient() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", true);
+ testCompatibleVersions("2.19.0", "2.20.6", true);
+ testCompatibleVersions("2.20.0", "2.20.2", true);
+ testCompatibleVersions("2.21.0", "2.21.1", true);
+ }
+
+ /**
+ */
+ @Test
+ public void testThreeCompatibleVersionsWithClients() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", true);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", true);
+
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", true);
+ }
+
+ /** */
+ @Test
+ public void testRollingUpgrade0() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.18.0", false);
+ IgniteEx ign2 = startGrid(2, "2.18.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign0.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(3, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign1.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(4, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign2.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(5, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+ }
+
+ /** */
+ @Test
+ public void testRollingUpgrade1() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.19.0", false);
- startGrid(0);
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
- try {
- nodeVer = "1.0.1";
+ ign0.close();
- startClientGrid(1);
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 1,
getTestTimeout()));
- fail("Exception has not been thrown.");
- }
- catch (IgniteCheckedException e) {
- StringWriter errors = new StringWriter();
+ ign0 = startGrid(2, "2.20.0", false);
- e.printStackTrace(new PrintWriter(errors));
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
- String stackTrace = errors.toString();
+ ign1.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 1,
getTestTimeout()));
+
+ startGrid(3, "2.21.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+ }
+
+ /** */
+ @Test
+ public void testCoordinatorChange() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.18.0", false);
+ IgniteEx ign2 = startGrid(2, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign0.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ assertThrowsAnyCause(null, () -> startGrid(3, "2.17.0", false),
+ IgniteSpiException.class, "Remote node rejected due to
incompatible version for cluster join.");
+
+ assertThrowsAnyCause(null, () -> startGrid(4, "2.20.0", false),
+ IgniteSpiException.class, "Remote node rejected due to
incompatible version for cluster join.");
+
+ startGrid(5, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+ }
+
+ /** */
+ private void testConflictVersions(String acceptedVer, String rejVer,
boolean withClient) {
+ ThrowableSupplier<IgniteEx, Exception> sup = () -> {
+ IgniteEx ign = startGrid(0, acceptedVer, false);
+
+ startGrid(1, rejVer, withClient);
+
+ return ign;
+ };
+
+ assertRemoteRejected(sup);
+
+ stopAllGrids();
+ }
+
+ /** */
+ private void testConflictVersions(String acceptedVer1, String
acceptedVer2, String rejVer, boolean withClients) {
+ ThrowableSupplier<IgniteEx, Exception> sup = () -> {
+ IgniteEx ign = startGrid(0, acceptedVer1, false);
+
+ startGrid(1, acceptedVer2, withClients);
+
+ startGrid(2, rejVer, withClients);
+
+ return ign;
+ };
+
+ assertRemoteRejected(sup);
+
+ stopAllGrids();
+ }
+
+ /** */
+ private void assertRemoteRejected(ThrowableSupplier<IgniteEx, Exception>
gridStart) {
+ Throwable e = assertThrows(log, gridStart::get,
IgniteCheckedException.class, null);
+
+ StringWriter errors = new StringWriter();
+
+ e.printStackTrace(new PrintWriter(errors));
+
+ String stackTrace = errors.toString();
+
+ assert stackTrace.contains("Remote node rejected due to incompatible
version for cluster join");
+ }
+
+ /** */
+ private void testCompatibleVersions(String acceptedVer1, String
acceptedVer2, boolean withClient) throws Exception {
+ startGrid(0, acceptedVer1, false);
+ startGrid(1, acceptedVer2, withClient);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ stopAllGrids();
+ }
+
+ /** */
+ private void testCompatibleVersions(
+ String acceptedVer1,
+ String acceptedVer2,
+ String acceptedVer3,
+ boolean withClients
+ ) throws Exception {
+ startGrid(0, acceptedVer1, false);
+ startGrid(1, acceptedVer2, withClients);
Review Comment:
Let's have a cluster with multiple server nodes. In this case different
client nodes can be connected to different server nodes. We should check that
all client nodes versions are participating in the check.
##########
modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java:
##########
@@ -59,59 +68,260 @@ public class GridReleaseTypeSelfTest extends
GridCommonAbstractTest {
stopAllGrids();
}
- /**
- * @throws Exception If failed.
- */
+ /** */
+ @Test
+ public void testTwoConflictVersions() {
+ testConflictVersions("2.18.0", "2.16.0", false);
+ testConflictVersions("2.19.0", "2.17.6", false);
+ testConflictVersions("2.20.0", "2.22.2", false);
+ testConflictVersions("2.21.0", "2.23.1", false);
+ }
+
+ /** */
+ @Test
+ public void testThreeConflictVersions() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", false);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", false);
+
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", false);
+
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", false);
+ }
+
+ /** */
@Test
- public void testOsEditionDoesNotSupportRollingUpdates() throws Exception {
- nodeVer = "1.0.0";
+ public void testTwoConflictVersionsWithClient() {
+ testConflictVersions("2.18.0", "2.16.0", true);
+ testConflictVersions("2.19.0", "2.17.6", true);
+ testConflictVersions("2.20.0", "2.22.2", true);
+ testConflictVersions("2.21.0", "2.23.1", true);
+ }
- startGrid(0);
+ /** */
+ @Test
+ public void testThreeConflictVersionsWithClients() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", true);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", true);
- try {
- nodeVer = "1.0.1";
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", true);
- startGrid(1);
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", true);
+ }
+
+ /**
+ */
+ @Test
+ public void testTwoCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", false);
+ testCompatibleVersions("2.19.0", "2.20.6", false);
+ testCompatibleVersions("2.20.0", "2.20.2", false);
+ testCompatibleVersions("2.21.0", "2.21.1", false);
+ }
- fail("Exception has not been thrown.");
- }
- catch (IgniteCheckedException e) {
- StringWriter errors = new StringWriter();
+ /**
+ */
+ @Test
+ public void testThreeCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", false);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", false);
- e.printStackTrace(new PrintWriter(errors));
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", false);
- String stackTrace = errors.toString();
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", false);
- if (!stackTrace.contains("Local node and remote node have
different version numbers"))
- throw e;
- }
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", false);
}
/**
- * @throws Exception If failed.
*/
@Test
- public void testOsEditionDoesNotSupportRollingUpdatesClientMode() throws
Exception {
- nodeVer = "1.0.0";
+ public void testTwoCompatibleVersionsWithClient() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", true);
+ testCompatibleVersions("2.19.0", "2.20.6", true);
+ testCompatibleVersions("2.20.0", "2.20.2", true);
+ testCompatibleVersions("2.21.0", "2.21.1", true);
+ }
+
+ /**
+ */
+ @Test
+ public void testThreeCompatibleVersionsWithClients() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", true);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", true);
+
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", true);
+ }
+
+ /** */
+ @Test
+ public void testRollingUpgrade0() throws Exception {
Review Comment:
Let's add more tests:
1. For downgrade version of cluster
2. Upgrade and then downgrade back
3. Start upgrade not from coordinator node
##########
modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java:
##########
@@ -59,59 +68,260 @@ public class GridReleaseTypeSelfTest extends
GridCommonAbstractTest {
stopAllGrids();
}
- /**
- * @throws Exception If failed.
- */
+ /** */
+ @Test
+ public void testTwoConflictVersions() {
+ testConflictVersions("2.18.0", "2.16.0", false);
+ testConflictVersions("2.19.0", "2.17.6", false);
+ testConflictVersions("2.20.0", "2.22.2", false);
+ testConflictVersions("2.21.0", "2.23.1", false);
+ }
+
+ /** */
+ @Test
+ public void testThreeConflictVersions() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", false);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", false);
+
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", false);
+
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", false);
+ }
+
+ /** */
@Test
- public void testOsEditionDoesNotSupportRollingUpdates() throws Exception {
- nodeVer = "1.0.0";
+ public void testTwoConflictVersionsWithClient() {
+ testConflictVersions("2.18.0", "2.16.0", true);
+ testConflictVersions("2.19.0", "2.17.6", true);
+ testConflictVersions("2.20.0", "2.22.2", true);
+ testConflictVersions("2.21.0", "2.23.1", true);
+ }
- startGrid(0);
+ /** */
+ @Test
+ public void testThreeConflictVersionsWithClients() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", true);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", true);
- try {
- nodeVer = "1.0.1";
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", true);
- startGrid(1);
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", true);
+ }
+
+ /**
+ */
+ @Test
+ public void testTwoCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", false);
+ testCompatibleVersions("2.19.0", "2.20.6", false);
+ testCompatibleVersions("2.20.0", "2.20.2", false);
+ testCompatibleVersions("2.21.0", "2.21.1", false);
+ }
- fail("Exception has not been thrown.");
- }
- catch (IgniteCheckedException e) {
- StringWriter errors = new StringWriter();
+ /**
+ */
+ @Test
+ public void testThreeCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", false);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", false);
- e.printStackTrace(new PrintWriter(errors));
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", false);
- String stackTrace = errors.toString();
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", false);
- if (!stackTrace.contains("Local node and remote node have
different version numbers"))
- throw e;
- }
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", false);
}
/**
- * @throws Exception If failed.
*/
@Test
- public void testOsEditionDoesNotSupportRollingUpdatesClientMode() throws
Exception {
- nodeVer = "1.0.0";
+ public void testTwoCompatibleVersionsWithClient() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", true);
+ testCompatibleVersions("2.19.0", "2.20.6", true);
+ testCompatibleVersions("2.20.0", "2.20.2", true);
+ testCompatibleVersions("2.21.0", "2.21.1", true);
+ }
+
+ /**
+ */
+ @Test
+ public void testThreeCompatibleVersionsWithClients() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", true);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", true);
+
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", true);
+ }
+
+ /** */
+ @Test
+ public void testRollingUpgrade0() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.18.0", false);
+ IgniteEx ign2 = startGrid(2, "2.18.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign0.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(3, "2.19.0", false);
Review Comment:
For RU you should reuse node ids. grid(0) is restarted with new version
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/nodevalidation/OsDiscoveryNodeValidationProcessor.java:
##########
@@ -43,31 +54,72 @@ public OsDiscoveryNodeValidationProcessor(GridKernalContext
ctx) {
@Nullable @Override public IgniteNodeValidationResult
validateNode(ClusterNode node) {
ClusterNode locNode = ctx.discovery().localNode();
- // Check version.
String locBuildVer = locNode.attribute(ATTR_BUILD_VER);
String rmtBuildVer = node.attribute(ATTR_BUILD_VER);
- if (!Objects.equals(rmtBuildVer, locBuildVer)) {
- // OS nodes don't support rolling updates.
- if (!locBuildVer.equals(rmtBuildVer)) {
- String errMsg = "Local node and remote node have different
version numbers " +
- "(node will not join, Ignite does not support rolling
updates, " +
- "so versions must be exactly the same) " +
- "[locBuildVer=" + locBuildVer + ", rmtBuildVer=" +
rmtBuildVer +
- ", locNodeAddrs=" + U.addressesAsString(locNode) +
- ", rmtNodeAddrs=" + U.addressesAsString(node) +
- ", locNodeId=" + locNode.id() + ", rmtNodeId=" + node.id()
+ ']';
-
- LT.warn(log, errMsg);
-
- // Always output in debug.
- if (log.isDebugEnabled())
- log.debug(errMsg);
-
- return new IgniteNodeValidationResult(node.id(), errMsg);
- }
+ IgniteProductVersion locVer =
IgniteProductVersion.fromString(locBuildVer);
+ IgniteProductVersion rmtVer =
IgniteProductVersion.fromString(rmtBuildVer);
+
+ if (!isRollingUpgradeEligible(locVer, rmtVer)) {
+ String errMsg = "Remote node rejected due to incompatible version
for cluster join.\n"
+ + "Remote node info:\n"
+ + " - Version : " + rmtBuildVer + "\n"
+ + " - Addresses : " + U.addressesAsString(node) + "\n"
+ + " - Node ID : " + node.id() + "\n"
+ + "Local node info:\n"
+ + " - Version : " + locBuildVer + "\n"
+ + " - Addresses : " + U.addressesAsString(locNode) + "\n"
+ + " - Node ID : " + locNode.id() + "\n"
+ + "Allowed versions for joining:\n"
+ + " - " + locVer.major() + '.' + locVer.minor() + ".X\n"
+ + " - " + locVer.major() + '.' + (locVer.minor() + 1) + ".X\n"
+ + " - " + locVer.major() + '.' + (locVer.minor() - 1) + ".X";
Review Comment:
In case cluster has 2.18 (locVer) and 2.19 versions, then we can't accept
2.17 while this log promises it.
##########
modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java:
##########
@@ -59,59 +68,260 @@ public class GridReleaseTypeSelfTest extends
GridCommonAbstractTest {
stopAllGrids();
}
- /**
- * @throws Exception If failed.
- */
+ /** */
+ @Test
+ public void testTwoConflictVersions() {
+ testConflictVersions("2.18.0", "2.16.0", false);
+ testConflictVersions("2.19.0", "2.17.6", false);
+ testConflictVersions("2.20.0", "2.22.2", false);
+ testConflictVersions("2.21.0", "2.23.1", false);
+ }
+
+ /** */
+ @Test
+ public void testThreeConflictVersions() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", false);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", false);
+
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", false);
+
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", false);
+ }
+
+ /** */
@Test
- public void testOsEditionDoesNotSupportRollingUpdates() throws Exception {
- nodeVer = "1.0.0";
+ public void testTwoConflictVersionsWithClient() {
+ testConflictVersions("2.18.0", "2.16.0", true);
+ testConflictVersions("2.19.0", "2.17.6", true);
+ testConflictVersions("2.20.0", "2.22.2", true);
+ testConflictVersions("2.21.0", "2.23.1", true);
+ }
- startGrid(0);
+ /** */
+ @Test
+ public void testThreeConflictVersionsWithClients() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", true);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", true);
- try {
- nodeVer = "1.0.1";
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", true);
- startGrid(1);
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", true);
+ }
+
+ /**
+ */
+ @Test
+ public void testTwoCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", false);
+ testCompatibleVersions("2.19.0", "2.20.6", false);
+ testCompatibleVersions("2.20.0", "2.20.2", false);
+ testCompatibleVersions("2.21.0", "2.21.1", false);
+ }
- fail("Exception has not been thrown.");
- }
- catch (IgniteCheckedException e) {
- StringWriter errors = new StringWriter();
+ /**
+ */
+ @Test
+ public void testThreeCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", false);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", false);
- e.printStackTrace(new PrintWriter(errors));
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", false);
- String stackTrace = errors.toString();
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", false);
- if (!stackTrace.contains("Local node and remote node have
different version numbers"))
- throw e;
- }
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", false);
}
/**
- * @throws Exception If failed.
*/
@Test
- public void testOsEditionDoesNotSupportRollingUpdatesClientMode() throws
Exception {
- nodeVer = "1.0.0";
+ public void testTwoCompatibleVersionsWithClient() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", true);
+ testCompatibleVersions("2.19.0", "2.20.6", true);
+ testCompatibleVersions("2.20.0", "2.20.2", true);
+ testCompatibleVersions("2.21.0", "2.21.1", true);
+ }
+
+ /**
+ */
+ @Test
+ public void testThreeCompatibleVersionsWithClients() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", true);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", true);
+
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", true);
+ }
+
+ /** */
+ @Test
+ public void testRollingUpgrade0() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.18.0", false);
+ IgniteEx ign2 = startGrid(2, "2.18.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign0.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(3, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign1.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(4, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign2.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(5, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+ }
+
+ /** */
+ @Test
+ public void testRollingUpgrade1() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.19.0", false);
- startGrid(0);
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
- try {
- nodeVer = "1.0.1";
+ ign0.close();
- startClientGrid(1);
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 1,
getTestTimeout()));
- fail("Exception has not been thrown.");
- }
- catch (IgniteCheckedException e) {
- StringWriter errors = new StringWriter();
+ ign0 = startGrid(2, "2.20.0", false);
- e.printStackTrace(new PrintWriter(errors));
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
- String stackTrace = errors.toString();
+ ign1.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 1,
getTestTimeout()));
+
+ startGrid(3, "2.21.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+ }
+
+ /** */
+ @Test
+ public void testCoordinatorChange() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.18.0", false);
+ IgniteEx ign2 = startGrid(2, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign0.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ assertThrowsAnyCause(null, () -> startGrid(3, "2.17.0", false),
+ IgniteSpiException.class, "Remote node rejected due to
incompatible version for cluster join.");
+
+ assertThrowsAnyCause(null, () -> startGrid(4, "2.20.0", false),
+ IgniteSpiException.class, "Remote node rejected due to
incompatible version for cluster join.");
+
+ startGrid(5, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+ }
+
+ /** */
+ private void testConflictVersions(String acceptedVer, String rejVer,
boolean withClient) {
+ ThrowableSupplier<IgniteEx, Exception> sup = () -> {
+ IgniteEx ign = startGrid(0, acceptedVer, false);
+
+ startGrid(1, rejVer, withClient);
+
+ return ign;
+ };
+
+ assertRemoteRejected(sup);
+
+ stopAllGrids();
+ }
+
+ /** */
+ private void testConflictVersions(String acceptedVer1, String
acceptedVer2, String rejVer, boolean withClients) {
+ ThrowableSupplier<IgniteEx, Exception> sup = () -> {
+ IgniteEx ign = startGrid(0, acceptedVer1, false);
+
+ startGrid(1, acceptedVer2, withClients);
+
+ startGrid(2, rejVer, withClients);
+
+ return ign;
+ };
+
+ assertRemoteRejected(sup);
+
+ stopAllGrids();
+ }
+
+ /** */
+ private void assertRemoteRejected(ThrowableSupplier<IgniteEx, Exception>
gridStart) {
+ Throwable e = assertThrows(log, gridStart::get,
IgniteCheckedException.class, null);
+
+ StringWriter errors = new StringWriter();
+
+ e.printStackTrace(new PrintWriter(errors));
+
+ String stackTrace = errors.toString();
+
+ assert stackTrace.contains("Remote node rejected due to incompatible
version for cluster join");
Review Comment:
Can be replaced with `X.hasCause`
--
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]