This is an automated email from the ASF dual-hosted git repository.
sanpwc pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 67396d56fa6 IGNITE-27017 Prevent a node from starting in
non-colocation mode (#6971)
67396d56fa6 is described below
commit 67396d56fa689c797a9ad669c2199d9671e94681
Author: Alexander Lapin <[email protected]>
AuthorDate: Tue Nov 18 15:08:58 2025 +0200
IGNITE-27017 Prevent a node from starting in non-colocation mode (#6971)
---
.../java/org/apache/ignite/lang/ErrorGroups.java | 3 +
.../src/testFixtures/resources/igniteVersions.json | 3 -
.../replicator/ItColocationStatusHandlingTest.java | 115 +++---
modules/platforms/cpp/ignite/common/error_codes.h | 1 +
modules/platforms/cpp/ignite/odbc/common_types.cpp | 1 +
.../platforms/dotnet/Apache.Ignite/ErrorCodes.g.cs | 3 +
.../ItDisasterRecoveryColocationDisabledTest.java | 125 -------
.../app/ItEnabledColocationHomogeneityTest.java | 2 +
.../ignite/internal/app/NodePropertiesImpl.java | 19 +-
.../internal/app/NodePropertiesImplTest.java | 39 +-
.../planner/TpcdsColocatedQueryPlannerTest.java | 49 ---
.../sql/engine/planner/TpcdsQueryPlannerTest.java | 12 +-
...ItInternalTableReadWriteScanColocationTest.java | 32 --
.../ItInternalTableReadWriteScanTest.java | 15 +-
.../partition/ItPartitionDestructionTest.java | 147 +-------
.../disaster/ItDisasterRecoveryManagerTest.java | 399 ---------------------
.../internal/tx/TxManagerColocationTest.java | 32 --
.../apache/ignite/internal/tx/TxManagerTest.java | 26 +-
.../ReadWriteTransactionImplColocationTest.java | 32 --
.../tx/impl/ReadWriteTransactionImplTest.java | 25 +-
20 files changed, 147 insertions(+), 933 deletions(-)
diff --git a/modules/api/src/main/java/org/apache/ignite/lang/ErrorGroups.java
b/modules/api/src/main/java/org/apache/ignite/lang/ErrorGroups.java
index a5e81310aa4..7f91c34cff8 100755
--- a/modules/api/src/main/java/org/apache/ignite/lang/ErrorGroups.java
+++ b/modules/api/src/main/java/org/apache/ignite/lang/ErrorGroups.java
@@ -202,6 +202,9 @@ public class ErrorGroups {
**/
public static final int NULLABLE_VALUE_ERR =
COMMON_ERR_GROUP.registerErrorCode((short) 9);
+ /** This error code indicates that a node is attempting to start over
an unsupported table based replication mode. */
+ public static final int UNSUPPORTED_TABLE_BASED_REPLICATION_ERR =
COMMON_ERR_GROUP.registerErrorCode((short) 10);
+
/**
* This error code represents an internal error caused by faulty logic
or coding in the Ignite codebase. In general, this error code
* should be considered as a non-recoverable error
diff --git
a/modules/compatibility-tests/src/testFixtures/resources/igniteVersions.json
b/modules/compatibility-tests/src/testFixtures/resources/igniteVersions.json
index da56b3dc040..a824b7e085a 100644
--- a/modules/compatibility-tests/src/testFixtures/resources/igniteVersions.json
+++ b/modules/compatibility-tests/src/testFixtures/resources/igniteVersions.json
@@ -16,9 +16,6 @@
"ignite.storage.profiles.default.size": 268435456
},
"versions": [
- {
- "version": "3.0.0"
- },
{
"version": "3.1.0"
}
diff --git
a/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItColocationStatusHandlingTest.java
b/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItColocationStatusHandlingTest.java
index 3401264e7d3..119ceea07da 100644
---
a/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItColocationStatusHandlingTest.java
+++
b/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItColocationStatusHandlingTest.java
@@ -19,19 +19,17 @@ package org.apache.ignite.internal.partition.replicator;
import static org.apache.ignite.internal.TestWrappers.unwrapIgniteImpl;
import static
org.apache.ignite.internal.lang.IgniteSystemProperties.COLOCATION_FEATURE_FLAG;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
+import static
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrowsWithCause;
import java.nio.file.Path;
-import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.app.NodePropertiesImpl;
import org.apache.ignite.internal.configuration.IgnitePaths;
import org.apache.ignite.internal.vault.VaultService;
import org.apache.ignite.internal.vault.persistence.PersistentVaultService;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.ValueSource;
+import org.apache.ignite.lang.IgniteException;
+import org.junit.jupiter.api.Test;
class ItColocationStatusHandlingTest extends ClusterPerTestIntegrationTest {
@Override
@@ -39,16 +37,61 @@ class ItColocationStatusHandlingTest extends
ClusterPerTestIntegrationTest {
return 0;
}
- @ParameterizedTest
- @ValueSource(booleans = {true, false})
- void freshNodeTakesStatusFromSystemProperty(boolean
colocationStatusFromSystemProps) {
-
runWithColocationProperty(String.valueOf(colocationStatusFromSystemProps), ()
-> {
- cluster.startAndInit(1);
-
- assertColocationStatusOnNodeIs(colocationStatusFromSystemProps);
+ @Test
+ void freshNodeStartWithColocationDisabledFailsWithUnableToStart() {
+ runWithColocationProperty("false", () -> {
+ assertThrowsWithCause(
+ () -> cluster.startAndInit(1),
+ IgniteException.class,
+ "Table based replication is no longer supported, consider
restarting the node in zone based replication mode.");
});
}
+ @Test
+ void usedNodeStartWithColocationDisabledInVaultFailsWithUnableToStart() {
+ cluster.startAndInit(1);
+
+ Path workDir = unwrappedNode().workDir();
+
+ cluster.stopNode(0);
+
+ setPersistedColocationDisabledStatus(workDir);
+
+ assertThrowsWithCause(
+ () -> cluster.startNode(0),
+ IgniteException.class,
+ "Table based replication is no longer supported."
+ + " Downgrade back to 3.1 and copy your data to a
cluster of desired version.");
+ }
+
+ @Test
+ void usedNodeStartWithoutStatusInVaultFailsWithUnableToStart() {
+ cluster.startAndInit(1);
+
+ Path workDir = unwrappedNode().workDir();
+
+ cluster.stopNode(0);
+
+ removePersistedColocationStatus(workDir);
+
+ assertThrowsWithCause(
+ () -> cluster.startNode(0),
+ IgniteException.class,
+ "Table based replication is no longer supported."
+ + " Downgrade back to 3.1 and copy your data to a
cluster of desired version.");
+ }
+
+ private static void removePersistedColocationStatus(Path workDir) {
+ VaultService vaultService = new
PersistentVaultService(IgnitePaths.vaultPath(workDir));
+
+ try {
+ vaultService.start();
+ vaultService.remove(NodePropertiesImpl.ZONE_BASED_REPLICATION_KEY);
+ } finally {
+ vaultService.close();
+ }
+ }
+
private static void runWithColocationProperty(String propertyValue,
Runnable action) {
String oldValue = System.getProperty(COLOCATION_FEATURE_FLAG);
System.setProperty(COLOCATION_FEATURE_FLAG, propertyValue);
@@ -64,60 +107,16 @@ class ItColocationStatusHandlingTest extends
ClusterPerTestIntegrationTest {
}
}
- private void assertColocationStatusOnNodeIs(boolean enableColocation) {
- IgniteImpl ignite = unwrappedNode();
-
- assertThat(ignite.nodeProperties().colocationEnabled(),
is(enableColocation));
- }
-
private IgniteImpl unwrappedNode() {
return unwrapIgniteImpl(cluster.node(0));
}
- @ParameterizedTest
- @ValueSource(booleans = {true, false})
- void usedNodeTakesStatusFromVaultIfSaved(boolean originalColocationStatus)
{
- runWithColocationProperty(String.valueOf(originalColocationStatus), ()
-> {
- cluster.startAndInit(1);
- cluster.stopNode(0);
- });
-
- boolean oppositeColocationStatus = !originalColocationStatus;
- runWithColocationProperty(String.valueOf(oppositeColocationStatus), ()
-> {
- cluster.startNode(0);
-
- assertColocationStatusOnNodeIs(originalColocationStatus);
- });
- }
-
- @ParameterizedTest
- @ValueSource(booleans = {true, false})
- void usedNodeWithoutStatusInVaultConsidersColocationDisabled(boolean
colocationStatusFromSystemProps) {
- AtomicReference<Path> workDirRef = new AtomicReference<>();
-
- runWithColocationProperty(String.valueOf(false), () -> {
- cluster.startAndInit(1);
-
- workDirRef.set(unwrappedNode().workDir());
-
- cluster.stopNode(0);
- });
-
- removePersistedColocationStatus(workDirRef.get());
-
-
runWithColocationProperty(String.valueOf(colocationStatusFromSystemProps), ()
-> {
- cluster.startNode(0);
-
- assertColocationStatusOnNodeIs(false);
- });
- }
-
- private static void removePersistedColocationStatus(Path workDir) {
+ private static void setPersistedColocationDisabledStatus(Path workDir) {
VaultService vaultService = new
PersistentVaultService(IgnitePaths.vaultPath(workDir));
try {
vaultService.start();
- vaultService.remove(NodePropertiesImpl.ZONE_BASED_REPLICATION_KEY);
+ vaultService.put(NodePropertiesImpl.ZONE_BASED_REPLICATION_KEY,
new byte[]{(byte) 0});
} finally {
vaultService.close();
}
diff --git a/modules/platforms/cpp/ignite/common/error_codes.h
b/modules/platforms/cpp/ignite/common/error_codes.h
index 2b30ba3bd46..235610b0e30 100644
--- a/modules/platforms/cpp/ignite/common/error_codes.h
+++ b/modules/platforms/cpp/ignite/common/error_codes.h
@@ -73,6 +73,7 @@ enum class code : underlying_t {
RESOURCE_CLOSING = 0x10007,
USER_OBJECT_SERIALIZATION = 0x10008,
NULLABLE_VALUE = 0x10009,
+ UNSUPPORTED_TABLE_BASED_REPLICATION = 0x1000a,
INTERNAL = 0x1ffff,
// Table group. Group code: 2
diff --git a/modules/platforms/cpp/ignite/odbc/common_types.cpp
b/modules/platforms/cpp/ignite/odbc/common_types.cpp
index 097d3d2ef1a..cf1a18da73e 100644
--- a/modules/platforms/cpp/ignite/odbc/common_types.cpp
+++ b/modules/platforms/cpp/ignite/odbc/common_types.cpp
@@ -123,6 +123,7 @@ sql_state error_code_to_sql_state(error::code code) {
case error::code::NODE_LEFT:
case error::code::INTERNAL:
case error::code::NULLABLE_VALUE:
+ case error::code::UNSUPPORTED_TABLE_BASED_REPLICATION:
return sql_state::SHY000_GENERAL_ERROR;
// Table group. Group code: 2
diff --git a/modules/platforms/dotnet/Apache.Ignite/ErrorCodes.g.cs
b/modules/platforms/dotnet/Apache.Ignite/ErrorCodes.g.cs
index e19a16aa008..218a20ddcb3 100644
--- a/modules/platforms/dotnet/Apache.Ignite/ErrorCodes.g.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/ErrorCodes.g.cs
@@ -131,6 +131,9 @@ namespace Apache.Ignite
/// <summary> NullableValue error. </summary>
public const int NullableValue = (GroupCode << 16) | (9 & 0xFFFF);
+ /// <summary> UnsupportedTableBasedReplication error. </summary>
+ public const int UnsupportedTableBasedReplication = (GroupCode <<
16) | (10 & 0xFFFF);
+
/// <summary> Internal error. </summary>
public const int Internal = (GroupCode << 16) | (65535 & 0xFFFF);
}
diff --git
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/recovery/ItDisasterRecoveryColocationDisabledTest.java
b/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/recovery/ItDisasterRecoveryColocationDisabledTest.java
deleted file mode 100644
index 263896d5e4b..00000000000
---
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/recovery/ItDisasterRecoveryColocationDisabledTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.rest.recovery;
-
-import static java.util.Collections.emptySet;
-import static
org.apache.ignite.internal.TestDefaultProfilesNames.DEFAULT_AIPERSIST_PROFILE_NAME;
-import static
org.apache.ignite.internal.lang.IgniteSystemProperties.COLOCATION_FEATURE_FLAG;
-import static
org.apache.ignite.internal.rest.constants.HttpCode.INTERNAL_SERVER_ERROR;
-import static
org.apache.ignite.internal.rest.recovery.ItDisasterRecoveryControllerRestartPartitionsTest.RESTART_ZONE_PARTITIONS_ENDPOINT;
-import static
org.apache.ignite.internal.rest.recovery.ItDisasterRecoveryControllerRestartPartitionsWithCleanupTest.RESTART_ZONE_PARTITIONS_WITH_CLEANUP_ENDPOINT;
-import static
org.apache.ignite.internal.rest.recovery.ItDisasterRecoveryControllerTest.RESET_ZONE_PARTITIONS_ENDPOINT;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.is;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-import io.micronaut.http.HttpRequest;
-import io.micronaut.http.MutableHttpRequest;
-import io.micronaut.http.client.HttpClient;
-import io.micronaut.http.client.annotation.Client;
-import io.micronaut.http.client.exceptions.HttpClientResponseException;
-import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
-import jakarta.inject.Inject;
-import org.apache.ignite.internal.ClusterConfiguration;
-import org.apache.ignite.internal.ClusterPerClassIntegrationTest;
-import org.apache.ignite.internal.rest.api.recovery.ResetZonePartitionsRequest;
-import
org.apache.ignite.internal.rest.api.recovery.RestartZonePartitionsRequest;
-import org.apache.ignite.internal.testframework.WithSystemProperty;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-/**
- * Test that zone partitions endpoints return unsupported error when
colocation is disabled.
- */
-@MicronautTest
-// TODO: Remove this class when colocation is enabled.
https://issues.apache.org/jira/browse/IGNITE-22522
-@WithSystemProperty(key = COLOCATION_FEATURE_FLAG, value = "false")
-public class ItDisasterRecoveryColocationDisabledTest extends
ClusterPerClassIntegrationTest {
- private static final String NODE_URL = "http://localhost:" +
ClusterConfiguration.DEFAULT_BASE_HTTP_PORT;
-
- private static final String FIRST_ZONE = "first_ZONE";
-
- @Inject
- @Client(NODE_URL + "/management/v1/recovery/")
- HttpClient client;
-
- @BeforeAll
- public void setUp() {
- sql(String.format("CREATE ZONE \"%s\" storage profiles ['%s']",
FIRST_ZONE, DEFAULT_AIPERSIST_PROFILE_NAME));
- }
-
- @Test
- public void testResetPartitions() {
- MutableHttpRequest<?> post =
HttpRequest.POST(RESET_ZONE_PARTITIONS_ENDPOINT,
- new ResetZonePartitionsRequest(FIRST_ZONE, emptySet()));
-
- HttpClientResponseException e =
assertThrows(HttpClientResponseException.class,
- () -> client.toBlocking().exchange(post));
-
- assertThat(e.getResponse().code(), is(INTERNAL_SERVER_ERROR.code()));
-
- assertThat(e.getMessage(), containsString("This method is unsupported
when colocation is disabled."));
- }
-
- @Test
- public void testRestartPartitions() {
- MutableHttpRequest<?> post =
HttpRequest.POST(RESTART_ZONE_PARTITIONS_ENDPOINT,
- new RestartZonePartitionsRequest(emptySet(), FIRST_ZONE,
emptySet()));
-
- HttpClientResponseException e =
assertThrows(HttpClientResponseException.class,
- () -> client.toBlocking().exchange(post));
-
- assertThat(e.getResponse().code(), is(INTERNAL_SERVER_ERROR.code()));
-
- assertThat(e.getMessage(), containsString("This method is unsupported
when colocation is disabled."));
- }
-
- @Test
- public void testRestartPartitionsWithCleanup() {
- MutableHttpRequest<?> post =
HttpRequest.POST(RESTART_ZONE_PARTITIONS_WITH_CLEANUP_ENDPOINT,
- new RestartZonePartitionsRequest(emptySet(), FIRST_ZONE,
emptySet()));
-
- HttpClientResponseException e =
assertThrows(HttpClientResponseException.class,
- () -> client.toBlocking().exchange(post));
-
- assertThat(e.getResponse().code(), is(INTERNAL_SERVER_ERROR.code()));
-
- assertThat(e.getMessage(), containsString("This method is unsupported
when colocation is disabled."));
- }
-
- @Test
- public void testGetLocalPartitions() {
- HttpClientResponseException e =
assertThrows(HttpClientResponseException.class,
- () -> client.toBlocking().exchange("zone/state/local/"));
-
- assertThat(e.getResponse().code(), is(INTERNAL_SERVER_ERROR.code()));
-
- assertThat(e.getMessage(), containsString("This method is unsupported
when colocation is disabled."));
- }
-
- @Test
- public void testGetGlobalPartitions() {
- HttpClientResponseException e =
assertThrows(HttpClientResponseException.class,
- () -> client.toBlocking().exchange("zone/state/global/"));
-
- assertThat(e.getResponse().code(), is(INTERNAL_SERVER_ERROR.code()));
-
- assertThat(e.getMessage(), containsString("This method is unsupported
when colocation is disabled."));
- }
-}
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItEnabledColocationHomogeneityTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItEnabledColocationHomogeneityTest.java
index af9dcbd8782..0bf035c4fc0 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItEnabledColocationHomogeneityTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItEnabledColocationHomogeneityTest.java
@@ -25,6 +25,7 @@ import
org.apache.ignite.internal.cluster.management.InvalidNodeConfigurationExc
import org.apache.ignite.internal.lang.IgniteStringFormatter;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
@@ -32,6 +33,7 @@ import org.junit.jupiter.params.provider.ValueSource;
* Tests to check enabled colocation homogeneity within node join validation.
*/
@SuppressWarnings("ThrowableNotThrown")
+@Disabled("https://issues.apache.org/jira/browse/IGNITE-27071")
public class ItEnabledColocationHomogeneityTest extends BaseIgniteRestartTest {
private String commonColocationFeatureFlag;
diff --git
a/modules/runner/src/main/java/org/apache/ignite/internal/app/NodePropertiesImpl.java
b/modules/runner/src/main/java/org/apache/ignite/internal/app/NodePropertiesImpl.java
index 713ead6d2e5..b58ab68ff1a 100644
---
a/modules/runner/src/main/java/org/apache/ignite/internal/app/NodePropertiesImpl.java
+++
b/modules/runner/src/main/java/org/apache/ignite/internal/app/NodePropertiesImpl.java
@@ -19,6 +19,8 @@ package org.apache.ignite.internal.app;
import static
org.apache.ignite.internal.lang.IgniteSystemProperties.COLOCATION_FEATURE_FLAG;
import static
org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture;
+import static org.apache.ignite.lang.ErrorGroups.Common.ILLEGAL_ARGUMENT_ERR;
+import static
org.apache.ignite.lang.ErrorGroups.Common.UNSUPPORTED_TABLE_BASED_REPLICATION_ERR;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
@@ -32,6 +34,7 @@ import org.apache.ignite.internal.manager.ComponentContext;
import org.apache.ignite.internal.manager.IgniteComponent;
import org.apache.ignite.internal.vault.VaultEntry;
import org.apache.ignite.internal.vault.VaultManager;
+import org.apache.ignite.lang.IgniteException;
/**
* Default implementation of {@link NodeProperties} using {@link VaultManager}
for persistence.
@@ -67,16 +70,26 @@ public class NodePropertiesImpl implements NodeProperties,
IgniteComponent, Node
VaultEntry entry = vaultManager.get(ZONE_BASED_REPLICATION_KEY);
if (entry != null) {
colocationEnabled = entry.value()[0] == 1;
-
+ if (!colocationEnabled) {
+ throw new
IgniteException(UNSUPPORTED_TABLE_BASED_REPLICATION_ERR, "Table based
replication is no longer supported."
+ + " Downgrade back to 3.1 and copy your data to a
cluster of desired version.");
+ }
logComment = "from Vault";
} else {
boolean freshNode = vaultManager.name() == null;
if (freshNode) {
colocationEnabled = IgniteSystemProperties.colocationEnabled();
+ // TODO https://issues.apache.org/jira/browse/IGNITE-22522
Remove.
+ // It's a temporary code that will be removed when !colocation
mode will be fully dropped. That's the reason why instead of
+ // introducing new error code, existing somewhat related is
used.
+ if (!colocationEnabled) {
+ throw new IgniteException(ILLEGAL_ARGUMENT_ERR, "Table
based replication is no longer supported, consider restarting"
+ + " the node in zone based replication mode.");
+ }
logComment = "from system properties on a fresh node";
} else {
- colocationEnabled = false;
- logComment = "node of an older version was run without zone
based replication";
+ throw new
IgniteException(UNSUPPORTED_TABLE_BASED_REPLICATION_ERR, "Table based
replication is no longer supported."
+ + " Downgrade back to 3.1 and copy your data to a
cluster of desired version.");
}
saveToVault(colocationEnabled);
diff --git
a/modules/runner/src/test/java/org/apache/ignite/internal/app/NodePropertiesImplTest.java
b/modules/runner/src/test/java/org/apache/ignite/internal/app/NodePropertiesImplTest.java
index 41cbf80036c..005c09b3326 100644
---
a/modules/runner/src/test/java/org/apache/ignite/internal/app/NodePropertiesImplTest.java
+++
b/modules/runner/src/test/java/org/apache/ignite/internal/app/NodePropertiesImplTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.app;
import static
org.apache.ignite.internal.app.NodePropertiesImpl.ZONE_BASED_REPLICATION_KEY;
import static
org.apache.ignite.internal.lang.IgniteSystemProperties.COLOCATION_FEATURE_FLAG;
+import static
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrowsWithCause;
import static
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
@@ -34,6 +35,7 @@ import org.apache.ignite.internal.manager.ComponentContext;
import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
import org.apache.ignite.internal.vault.VaultEntry;
import org.apache.ignite.internal.vault.VaultManager;
+import org.apache.ignite.lang.IgniteException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -66,11 +68,18 @@ class NodePropertiesImplTest extends BaseIgniteAbstractTest
{
doReturn(null).when(vaultManager).name();
runWithColocationProperty(String.valueOf(enableColocation), () -> {
- startComponent();
+ if (!enableColocation) {
+ assertThrowsWithCause(
+ () -> startComponent(),
+ IgniteException.class,
+ "Table based replication is no longer supported,
consider restarting the node in zone based replication mode.");
+ } else {
+ startComponent();
- assertThat(nodeProperties.colocationEnabled(),
is(enableColocation));
+ assertThat(nodeProperties.colocationEnabled(),
is(enableColocation));
- verifyStatusSavedToVault(enableColocation);
+ verifyStatusSavedToVault(enableColocation);
+ }
});
}
@@ -110,11 +119,19 @@ class NodePropertiesImplTest extends
BaseIgniteAbstractTest {
boolean oppositeColocationStatus = !originalColocationStatus;
runWithColocationProperty(String.valueOf(oppositeColocationStatus), ()
-> {
- startComponent();
+ if (!originalColocationStatus) {
+ assertThrowsWithCause(
+ () -> startComponent(),
+ IgniteException.class,
+ "Table based replication is no longer supported."
+ + " Downgrade back to 3.1 and copy your data
to a cluster of desired version.");
+ } else {
+ startComponent();
- assertThat(nodeProperties.colocationEnabled(),
is(originalColocationStatus));
+ assertThat(nodeProperties.colocationEnabled(),
is(originalColocationStatus));
- verifyStatusNotWrittenToVault();
+ verifyStatusNotWrittenToVault();
+ }
});
}
@@ -129,11 +146,11 @@ class NodePropertiesImplTest extends
BaseIgniteAbstractTest {
doReturn("test").when(vaultManager).name();
runWithColocationProperty(String.valueOf(colocationStatusFromSystemProps), ()
-> {
- startComponent();
-
- assertThat(nodeProperties.colocationEnabled(), is(false));
-
- verifyStatusSavedToVault(false);
+ assertThrowsWithCause(
+ () -> startComponent(),
+ IgniteException.class,
+ "Table based replication is no longer supported."
+ + " Downgrade back to 3.1 and copy your data to a
cluster of desired version.");
});
}
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/TpcdsColocatedQueryPlannerTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/TpcdsColocatedQueryPlannerTest.java
deleted file mode 100644
index 1b8fc6ce4b0..00000000000
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/TpcdsColocatedQueryPlannerTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.sql.engine.planner;
-
-import org.apache.ignite.internal.lang.IgniteSystemProperties;
-import
org.apache.ignite.internal.sql.engine.planner.AbstractTpcQueryPlannerTest.TpcSuiteInfo;
-import org.apache.ignite.internal.sql.engine.util.tpcds.TpcdsTables;
-import org.apache.ignite.internal.testframework.WithSystemProperty;
-
-/**
- * Tests ensures a planner generates optimal plan for TPC-DS queries when the
colocation feature is enabled.
- */
-@TpcSuiteInfo(
- tables = TpcdsTables.class,
- queryLoader = "getQueryString",
- planLoader = "getQueryPlan"
-)
-@WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
-public class TpcdsColocatedQueryPlannerTest extends TpcdsQueryPlannerTest {
- @SuppressWarnings("unused") // used reflectively by
AbstractTpcQueryPlannerTest
- static String getQueryString(String queryId) {
- return TpcdsQueryPlannerTest.getQueryString(queryId);
- }
-
- @SuppressWarnings("unused") // used reflectively by
AbstractTpcQueryPlannerTest
- static String getQueryPlan(String queryId) {
- return TpcdsQueryPlannerTest.getQueryPlan(queryId);
- }
-
- @SuppressWarnings("unused") // used reflectively by
AbstractTpcQueryPlannerTest
- static void updateQueryPlan(String queryId, String newPlan) {
- TpcdsQueryPlannerTest.updateQueryPlan(queryId, newPlan);
- }
-}
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/TpcdsQueryPlannerTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/TpcdsQueryPlannerTest.java
index 4b3905a4fce..05636187be7 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/TpcdsQueryPlannerTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/TpcdsQueryPlannerTest.java
@@ -17,16 +17,13 @@
package org.apache.ignite.internal.sql.engine.planner;
-import static
org.apache.ignite.internal.lang.IgniteSystemProperties.colocationEnabled;
import static
org.apache.ignite.internal.sql.engine.planner.AbstractTpcQueryPlannerTest.TpcSuiteInfo;
import it.unimi.dsi.fastutil.ints.IntSet;
import java.nio.file.Files;
import java.nio.file.Path;
-import org.apache.ignite.internal.lang.IgniteSystemProperties;
import org.apache.ignite.internal.sql.engine.util.tpcds.TpcdsHelper;
import org.apache.ignite.internal.sql.engine.util.tpcds.TpcdsTables;
-import org.apache.ignite.internal.testframework.WithSystemProperty;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junitpioneer.jupiter.params.IntRangeSource;
@@ -39,7 +36,6 @@ import org.junitpioneer.jupiter.params.IntRangeSource;
queryLoader = "getQueryString",
planLoader = "getQueryPlan"
)
-@WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
public class TpcdsQueryPlannerTest extends AbstractTpcQueryPlannerTest {
private static final IntSet UNSUPPORTED_TESTS = IntSet.of(
@@ -79,9 +75,7 @@ public class TpcdsQueryPlannerTest extends
AbstractTpcQueryPlannerTest {
var variantQueryFile =
String.format("tpcds/plan/variant_q%d.plan", numericId);
return loadFromResource(variantQueryFile);
} else {
- var queryFile = colocationEnabled()
- ? String.format("tpcds/plan/q%s_colocated.plan", numericId)
- : String.format("tpcds/plan/q%s.plan", numericId);
+ var queryFile = String.format("tpcds/plan/q%s_colocated.plan",
numericId);
return loadFromResource(queryFile);
}
@@ -113,9 +107,7 @@ public class TpcdsQueryPlannerTest extends
AbstractTpcQueryPlannerTest {
if (variant) {
planLocation =
targetDirectory.resolve(String.format("variant_q%d.plan", numericId));
} else {
- planLocation = colocationEnabled()
- ?
targetDirectory.resolve(String.format("q%s_colocated.plan", numericId))
- : targetDirectory.resolve(String.format("q%s.plan",
numericId));
+ planLocation =
targetDirectory.resolve(String.format("q%s_colocated.plan", numericId));
}
try {
diff --git
a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadWriteScanColocationTest.java
b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadWriteScanColocationTest.java
deleted file mode 100644
index 30f43e5a288..00000000000
---
a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadWriteScanColocationTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.distributed;
-
-import org.apache.ignite.internal.lang.IgniteSystemProperties;
-import org.apache.ignite.internal.replicator.ReplicationGroupId;
-import org.apache.ignite.internal.replicator.ZonePartitionId;
-import org.apache.ignite.internal.testframework.WithSystemProperty;
-
-// TODO: IGNITE-22522 - remove this class and switch
ItInternalTableReadWriteScanTest to use ZonePartitionId.
-@WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
-class ItInternalTableReadWriteScanColocationTest extends
ItInternalTableReadWriteScanTest {
- @Override
- ReplicationGroupId targetReplicationGroupId(int tableOrZoneId, int partId)
{
- return new ZonePartitionId(tableOrZoneId, partId);
- }
-}
diff --git
a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadWriteScanTest.java
b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadWriteScanTest.java
index b89455202b9..29ee38582d6 100644
---
a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadWriteScanTest.java
+++
b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableReadWriteScanTest.java
@@ -21,17 +21,15 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.concurrent.Flow.Publisher;
import org.apache.ignite.internal.hlc.HybridTimestampTracker;
-import org.apache.ignite.internal.lang.IgniteSystemProperties;
import org.apache.ignite.internal.network.InternalClusterNode;
import org.apache.ignite.internal.replicator.PartitionGroupId;
import org.apache.ignite.internal.replicator.ReplicationGroupId;
-import org.apache.ignite.internal.replicator.TablePartitionId;
+import org.apache.ignite.internal.replicator.ZonePartitionId;
import org.apache.ignite.internal.schema.BinaryRow;
import org.apache.ignite.internal.table.InternalTable;
import org.apache.ignite.internal.table.OperationContext;
import org.apache.ignite.internal.table.RollbackTxOnErrorPublisher;
import org.apache.ignite.internal.table.TxContext;
-import org.apache.ignite.internal.testframework.WithSystemProperty;
import org.apache.ignite.internal.tx.InternalTransaction;
import org.apache.ignite.internal.tx.InternalTxOptions;
import org.apache.ignite.internal.tx.PendingTxPartitionEnlistment;
@@ -41,7 +39,6 @@ import org.junit.jupiter.api.Test;
/**
* Tests for {@link InternalTable#scan(int, InternalTransaction)}.
*/
-@WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
public class ItInternalTableReadWriteScanTest extends
ItAbstractInternalTableScanTest {
/** Timestamp tracker. */
private static final HybridTimestampTracker HYBRID_TIMESTAMP_TRACKER =
HybridTimestampTracker.atomicTracker(null);
@@ -52,8 +49,7 @@ public class ItInternalTableReadWriteScanTest extends
ItAbstractInternalTableSca
return internalTbl.scan(part, null);
}
- PendingTxPartitionEnlistment enlistment =
- tx.enlistedPartition(targetReplicationGroupId(zoneId, part));
+ PendingTxPartitionEnlistment enlistment = tx.enlistedPartition(new
ZonePartitionId(zoneId, part));
InternalClusterNode primaryNode =
clusterNodeResolver.getByConsistentId(enlistment.primaryNodeConsistentId());
@@ -83,7 +79,7 @@ public class ItInternalTableReadWriteScanTest extends
ItAbstractInternalTableSca
InternalTransaction tx =
internalTbl.txManager().beginExplicitRw(HYBRID_TIMESTAMP_TRACKER,
InternalTxOptions.defaults());
int partId = ((PartitionGroupId) internalTbl.groupId()).partitionId();
- ReplicationGroupId tblPartId = targetReplicationGroupId(zoneId,
partId);
+ ReplicationGroupId tblPartId = new ZonePartitionId(zoneId, partId);
long term = 1L;
@@ -95,9 +91,4 @@ public class ItInternalTableReadWriteScanTest extends
ItAbstractInternalTableSca
return tx;
}
-
- // TODO: IGNITE-22522 - inline this after switching to ZonePartitionId.
- ReplicationGroupId targetReplicationGroupId(int tableOrZoneId, int partId)
{
- return new TablePartitionId(tableOrZoneId, partId);
- }
}
diff --git
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java
index 92f9f82d46f..cfe204cc02a 100644
---
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java
+++
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java
@@ -33,7 +33,6 @@ import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.io.FileMatchers.anExistingFile;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import it.unimi.dsi.fastutil.ints.Int2ObjectFunction;
import java.io.File;
import java.nio.ByteBuffer;
import java.nio.file.Path;
@@ -53,7 +52,6 @@ import
org.apache.ignite.internal.catalog.CatalogNotFoundException;
import org.apache.ignite.internal.catalog.descriptors.CatalogTableDescriptor;
import org.apache.ignite.internal.configuration.IgnitePaths;
import org.apache.ignite.internal.hlc.HybridTimestamp;
-import org.apache.ignite.internal.lang.IgniteSystemProperties;
import org.apache.ignite.internal.lowwatermark.LowWatermarkImpl;
import org.apache.ignite.internal.partitiondistribution.Assignment;
import org.apache.ignite.internal.partitiondistribution.TokenizedAssignments;
@@ -61,12 +59,10 @@ import org.apache.ignite.internal.raft.Peer;
import org.apache.ignite.internal.raft.RaftNodeId;
import org.apache.ignite.internal.replicator.PartitionGroupId;
import org.apache.ignite.internal.replicator.ReplicationGroupId;
-import org.apache.ignite.internal.replicator.TablePartitionId;
import org.apache.ignite.internal.replicator.ZonePartitionId;
import org.apache.ignite.internal.sql.engine.util.SqlTestUtils;
import org.apache.ignite.internal.table.TableImpl;
import org.apache.ignite.internal.testframework.SystemPropertiesExtension;
-import org.apache.ignite.internal.testframework.WithSystemProperty;
import org.apache.ignite.internal.tx.impl.TxManagerImpl;
import
org.apache.ignite.internal.tx.storage.state.rocksdb.TxStateRocksDbPartitionStorage;
import org.apache.ignite.internal.vault.VaultService;
@@ -114,25 +110,6 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
* This tests that, given that
*
* <ol>
- * <li>Cluster runs with disabled colocation</li>
- * <li>A table was created and written to</li>
- * <li>Then dropped</li>
- * <li>LWM raised highly enough to make the table eligible for
destruction</li>
- * </ol>
- *
- * <p>then the table will be destroyed.
- */
- @Test
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
- void partitionIsDestroyedOnTableDestructionWithoutColocation() throws
Exception {
- testPartitionIsDestroyedOnTableDestruction(false);
- }
-
- /**
- * This tests that, given that
- *
- * <ol>
- * <li>Cluster runs with enabled colocation</li>
* <li>A table was created and written to</li>
* <li>Then dropped</li>
* <li>LWM raised highly enough to make the table eligible for
destruction</li>
@@ -141,40 +118,26 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
* <p>then the table MV storage will be destroyed.
*/
@Test
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
- void partitionIsDestroyedOnTableDestructionWithColocation() throws
Exception {
- testPartitionIsDestroyedOnTableDestruction(true);
- }
-
- private void testPartitionIsDestroyedOnTableDestruction(boolean
colocationEnabled) throws InterruptedException {
+ void testTableMvDataIsDestroyedOnTableDestruction() throws
InterruptedException {
cluster.startAndInit(1,
ItPartitionDestructionTest::aggressiveLowWatermarkIncrease);
createZoneAndTableWith1Partition(1);
makePutInExplicitTxToTestTable();
int tableId = testTableId();
- TablePartitionId replicationGroupId = new TablePartitionId(tableId,
PARTITION_ID);
+ ZonePartitionId replicationGroupId = new
ZonePartitionId(zoneId(tableId), PARTITION_ID);
IgniteImpl ignite0 = unwrapIgniteImpl(cluster.node(0));
- if (colocationEnabled) {
- makeSurePartitionMvDataExistsOnDisk(ignite0, tableId);
- } else {
- makeSurePartitionExistsOnDisk(ignite0, tableId,
replicationGroupId);
- }
+ makeSurePartitionMvDataExistsOnDisk(ignite0, tableId);
executeUpdate("DROP TABLE " + TABLE_NAME);
- if (colocationEnabled) {
- verifyPartitionMvDataGetsRemovedFromDisk(ignite0, tableId,
replicationGroupId);
- } else {
- verifyPartitionGetsFullyRemovedFromDisk(ignite0, tableId,
replicationGroupId);
- }
+ verifyPartitionMvDataGetsRemovedFromDisk(ignite0, tableId,
replicationGroupId);
}
@Test
@Disabled("https://issues.apache.org/jira/browse/IGNITE-24345")
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
void partitionIsDestroyedOnZoneDestruction() throws Exception {
cluster.startAndInit(1,
ItPartitionDestructionTest::aggressiveLowWatermarkIncrease);
@@ -198,27 +161,6 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
* This tests that, given that
*
* <ol>
- * <li>Cluster runs with disabled colocation</li>
- * <li>A table was created and written to</li>
- * <li>Then dropped</li>
- * <li>LWM raised highly enough to make the table eligible for
destruction</li>
- * <li>But the LWM event not handled for some reason (so the table was
not destroyed yet)</li>
- * <li>The node gets restarted (but the Catalog still mentions the
table in its history)</li>
- * </ol>
- *
- * <p>then the table will be destroyed on node start.
- */
- @Test
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
- void
partitionIsDestroyedOnTableDestructionOnNodeRecoveryWithoutColocation() throws
Exception {
- testPartitionIsDestroyedOnTableDestructionOnNodeRecovery(false);
- }
-
- /**
- * This tests that, given that
- *
- * <ol>
- * <li>Cluster runs with enabled colocation</li>
* <li>A table was created and written to</li>
* <li>Then dropped</li>
* <li>LWM raised highly enough to make the table eligible for
destruction</li>
@@ -229,12 +171,7 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
* <p>then the table MV storages will be destroyed on node start.
*/
@Test
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
- void partitionIsDestroyedOnTableDestructionOnNodeRecoveryWithColocation()
throws Exception {
- testPartitionIsDestroyedOnTableDestructionOnNodeRecovery(true);
- }
-
- private void
testPartitionIsDestroyedOnTableDestructionOnNodeRecovery(boolean
colocationEnabled)
+ void testTableMvDataIsDestroyedOnTableDestructionOnNodeRecovery()
throws InterruptedException {
cluster.startAndInit(1,
ItPartitionDestructionTest::aggressiveLowWatermarkIncrease);
IgniteImpl ignite0 = unwrapIgniteImpl(cluster.node(0));
@@ -249,13 +186,9 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
flushTxStateStorageToDisk(ignite0);
int tableId = testTableId();
- TablePartitionId replicationGroupId = new TablePartitionId(tableId,
PARTITION_ID);
+ ZonePartitionId replicationGroupId = new
ZonePartitionId(zoneId(tableId), PARTITION_ID);
- if (colocationEnabled) {
- makeSurePartitionMvDataExistsOnDisk(ignite0, tableId);
- } else {
- makeSurePartitionExistsOnDisk(ignite0, tableId,
replicationGroupId);
- }
+ makeSurePartitionMvDataExistsOnDisk(ignite0, tableId);
// We don't want the dropped table to be destroyed before restart.
disallowLwmRaiseUntilRestart(ignite0);
@@ -271,16 +204,11 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
IgniteImpl restartedIgnite0 = unwrapIgniteImpl(cluster.startNode(0));
- if (colocationEnabled) {
- verifyPartitionMvDataGetsRemovedFromDisk(restartedIgnite0,
tableId, replicationGroupId);
- } else {
- verifyPartitionGetsFullyRemovedFromDisk(restartedIgnite0, tableId,
replicationGroupId);
- }
+ verifyPartitionMvDataGetsRemovedFromDisk(restartedIgnite0, tableId,
replicationGroupId);
}
@Test
@Disabled("https://issues.apache.org/jira/browse/IGNITE-24345")
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
void partitionIsDestroyedOnZoneDestructionOnNodeRecovery() throws
Exception {
cluster.startAndInit(1,
ItPartitionDestructionTest::aggressiveLowWatermarkIncrease);
IgniteImpl ignite0 = unwrapIgniteImpl(cluster.node(0));
@@ -321,28 +249,6 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
* This tests that, given that
*
* <ol>
- * <li>Cluster runs with disabled colocation</li>
- * <li>A table was created and written to</li>
- * <li>Then dropped</li>
- * <li>LWM raised highly enough to make the table eligible for
destruction</li>
- * <li>But the LWM event not handled for some reason (so the table was
not destroyed yet)</li>
- * <li>Catalog got compacted so that its history does not contain any
mentions of the table anymore</li>
- * <li>The node gets restarted</li>
- * </ol>
- *
- * <p>then the table will be destroyed on node start.
- */
- @Test
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
- void
partitionIsDestroyedOnTableDestructionOnNodeRecoveryAfterCatalogCompactedWithoutColocation()
throws Exception {
-
testPartitionIsDestroyedOnTableDestructionOnNodeRecoveryAfterCatalogCompacted(false);
- }
-
- /**
- * This tests that, given that
- *
- * <ol>
- * <li>Cluster runs with enabled colocation</li>
* <li>A table was created and written to</li>
* <li>Then dropped</li>
* <li>LWM raised highly enough to make the table eligible for
destruction</li>
@@ -354,12 +260,7 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
* <p>then the table MV storages will be destroyed on node start.
*/
@Test
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
- void
partitionIsDestroyedOnTableDestructionOnNodeRecoveryAfterCatalogCompactedWithColocation()
throws Exception {
-
testPartitionIsDestroyedOnTableDestructionOnNodeRecoveryAfterCatalogCompacted(true);
- }
-
- private void
testPartitionIsDestroyedOnTableDestructionOnNodeRecoveryAfterCatalogCompacted(boolean
colocationEnabled)
+ void
testTableMvDataIsDestroyedOnTableDestructionOnNodeRecoveryAfterCatalogCompacted()
throws InterruptedException {
// Node 1 will host the Metastorage and will do Catalog compaction.
// On node 0, we will verify that storages are destroyed on startup
when it seems that the table is not mentioned in the Catalog.
@@ -381,13 +282,9 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
flushTxStateStorageToDisk(ignite0);
int tableId = testTableId();
- TablePartitionId replicationGroupId = new TablePartitionId(tableId,
PARTITION_ID);
+ ZonePartitionId replicationGroupId = new
ZonePartitionId(zoneId(tableId), PARTITION_ID);
- if (colocationEnabled) {
- makeSurePartitionMvDataExistsOnDisk(ignite0, tableId);
- } else {
- makeSurePartitionExistsOnDisk(ignite0, tableId,
replicationGroupId);
- }
+ makeSurePartitionMvDataExistsOnDisk(ignite0, tableId);
// We don't want the dropped table to be destroyed before restart on
node 0.
disallowLwmRaiseUntilRestart(ignite0);
@@ -410,11 +307,7 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
IgniteImpl restartedIgnite0 = unwrapIgniteImpl(cluster.startNode(0));
- if (colocationEnabled) {
- verifyPartitionMvDataGetsRemovedFromDisk(restartedIgnite0,
tableId, replicationGroupId);
- } else {
- verifyPartitionGetsFullyRemovedFromDisk(restartedIgnite0, tableId,
replicationGroupId);
- }
+ verifyPartitionMvDataGetsRemovedFromDisk(restartedIgnite0, tableId,
replicationGroupId);
}
private static void raisePersistedLwm(Path workDir, HybridTimestamp
newLwm) {
@@ -634,26 +527,14 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
}
@Test
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
- void tablePartitionIsDestroyedWhenItIsEvictedFromNode() throws Exception {
- testPartitionIsDestroyedWhenItIsEvictedFromNode(tableId -> new
TablePartitionId(tableId, PARTITION_ID));
- }
-
- @Test
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
- void zonePartitionIsDestroyedWhenItIsEvictedFromNode() throws Exception {
- testPartitionIsDestroyedWhenItIsEvictedFromNode(tableId -> new
ZonePartitionId(zoneId(tableId), PARTITION_ID));
- }
-
- private void
testPartitionIsDestroyedWhenItIsEvictedFromNode(Int2ObjectFunction<PartitionGroupId>
replicationGroupIdByTableId)
- throws Exception {
+ void testPartitionIsDestroyedWhenItIsEvictedFromNode() throws Exception {
cluster.startAndInit(2);
createZoneAndTableWith1Partition(2);
makePutInExplicitTxToTestTable();
int tableId = testTableId();
- PartitionGroupId replicationGroupId =
replicationGroupIdByTableId.apply(tableId);
+ ZonePartitionId replicationGroupId = new
ZonePartitionId(zoneId(tableId), PARTITION_ID);
IgniteImpl ignite0 = unwrapIgniteImpl(cluster.node(0));
IgniteImpl ignite1 = unwrapIgniteImpl(cluster.node(1));
diff --git
a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
index d82bdc6771e..be161524fc0 100644
---
a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
+++
b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
@@ -41,7 +41,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Method;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -57,9 +56,6 @@ import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.descriptors.CatalogZoneDescriptor;
import org.apache.ignite.internal.catalog.descriptors.ConsistencyMode;
-import org.apache.ignite.internal.lang.ByteArray;
-import org.apache.ignite.internal.lang.IgniteSystemProperties;
-import org.apache.ignite.internal.metastorage.MetaStorageManager;
import
org.apache.ignite.internal.partition.replicator.network.disaster.LocalPartitionStateEnum;
import org.apache.ignite.internal.partitiondistribution.Assignment;
import org.apache.ignite.internal.partitiondistribution.Assignments;
@@ -80,9 +76,7 @@ import
org.apache.ignite.internal.table.distributed.disaster.LocalPartitionState
import
org.apache.ignite.internal.table.distributed.disaster.LocalTablePartitionState;
import
org.apache.ignite.internal.table.distributed.disaster.LocalTablePartitionStateByNode;
import
org.apache.ignite.internal.table.distributed.disaster.exceptions.DisasterRecoveryException;
-import org.apache.ignite.internal.testframework.WithSystemProperty;
import org.apache.ignite.internal.type.NativeTypes;
-import org.apache.ignite.internal.util.CompletableFutures;
import org.apache.ignite.internal.wrapper.Wrapper;
import org.apache.ignite.tx.Transaction;
import org.apache.ignite.tx.TransactionException;
@@ -142,382 +136,6 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
));
}
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
- @Test
- void testRestartTablePartitions() {
- IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
-
- insert(0, 0);
- insert(1, 1);
-
- int partitionId = 0;
-
- CompletableFuture<Void> restartPartitionsFuture =
node.disasterRecoveryManager().restartTablePartitions(
- Set.of(node.name()),
- ZONE_NAME,
- SqlCommon.DEFAULT_SCHEMA_NAME,
- TABLE_NAME,
- Set.of(partitionId)
- );
-
- assertThat(restartPartitionsFuture, willCompleteSuccessfully());
- assertThat(awaitPrimaryReplicaForNow(node, new
TablePartitionId(tableId(node), partitionId)), willCompleteSuccessfully());
-
- insert(2, 2);
- insert(3, 3);
-
- assertThat(selectAll(), hasSize(4));
- }
-
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
- @Test
- void testRestartTablePartitionsWithCleanUpFails() {
- IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
-
- insert(0, 0);
- insert(1, 1);
-
- int partitionId = 0;
-
- CompletableFuture<Void> restartPartitionsWithCleanupFuture =
node.disasterRecoveryManager().restartTablePartitionsWithCleanup(
- Set.of(node.name()),
- ZONE_NAME,
- SqlCommon.DEFAULT_SCHEMA_NAME,
- TABLE_NAME,
- Set.of(partitionId)
- );
-
- ExecutionException exception = assertThrows(
- ExecutionException.class,
- () -> restartPartitionsWithCleanupFuture.get(10_000,
MILLISECONDS)
- );
-
- assertInstanceOf(DisasterRecoveryException.class,
exception.getCause());
-
- assertThat(exception.getCause().getMessage(), is("Not enough alive
nodes to perform reset with clean up."));
- }
-
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
- @Test
- void testRestartHaTablePartitionsWithCleanUpFails() {
- IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
-
- String testZone = "TEST_ZONE";
-
- createZone(node.catalogManager(), testZone, 1, 1, null, null,
ConsistencyMode.HIGH_AVAILABILITY);
-
- String tableName = "TABLE_NAME";
-
- node.sql().executeScript(String.format(
- "CREATE TABLE %s (id INT PRIMARY KEY, valInt INT) ZONE
TEST_ZONE",
- tableName
- ));
-
- int partitionId = 0;
-
- CompletableFuture<Void> restartPartitionsWithCleanupFuture =
node.disasterRecoveryManager().restartTablePartitionsWithCleanup(
- Set.of(node.name()),
- testZone,
- SqlCommon.DEFAULT_SCHEMA_NAME,
- tableName,
- Set.of(partitionId)
- );
-
- ExecutionException exception = assertThrows(
- ExecutionException.class,
- () -> restartPartitionsWithCleanupFuture.get(10_000,
MILLISECONDS)
- );
-
- assertInstanceOf(DisasterRecoveryException.class,
exception.getCause());
-
- assertThat(exception.getCause().getMessage(), is("Not enough alive
nodes to perform reset with clean up."));
- }
-
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
- @ParameterizedTest(name = "consistencyMode={0}, primaryReplica={1},
raftLeader={2}")
- @CsvSource({
- "STRONG_CONSISTENCY, true, false",
- "STRONG_CONSISTENCY, false, true",
- "STRONG_CONSISTENCY, false, false",
- "HIGH_AVAILABILITY, true, false",
- "HIGH_AVAILABILITY, false, true",
- "HIGH_AVAILABILITY, false, false"
- })
- void testRestartTablePartitionsWithCleanUp(
- ConsistencyMode consistencyMode,
- boolean primaryReplica,
- boolean raftLeader
- ) throws Exception {
- IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
- cluster.startNode(1);
-
- String testZone = "TEST_ZONE";
-
- if (consistencyMode == ConsistencyMode.HIGH_AVAILABILITY) {
- createZone(node.catalogManager(), testZone, 1, 2, null, null,
ConsistencyMode.HIGH_AVAILABILITY);
- } else {
- cluster.startNode(2);
-
- createZone(node.catalogManager(), testZone, 1, 3);
- }
-
- Set<IgniteImpl> runningNodes =
cluster.runningNodes().map(TestWrappers::unwrapIgniteImpl).collect(Collectors.toSet());
-
- String tableName = "TABLE_NAME";
-
- node.sql().executeScript(String.format(
- "CREATE TABLE %s (id INT PRIMARY KEY, valInt INT) ZONE %s",
- tableName,
- testZone
- ));
-
- insert(0, 0, tableName);
-
- assertValueOnSpecificNodes(tableName, runningNodes, 0, 0);
-
- IgniteImpl nodeToCleanup = findNodeConformingOptions(tableName,
primaryReplica, raftLeader);
-
- AtomicBoolean stop = new AtomicBoolean();
-
- CompletableFuture<Void> msLoadFut = CompletableFuture.runAsync(() -> {
- MetaStorageManager msMng = node.metaStorageManager();
-
- var msPutFuts = new ArrayList<CompletableFuture<Void>>();
-
- int i = 0;
-
- while (!stop.get()) {
- msPutFuts.add(msMng.put(ByteArray.fromString("test_key_" +
i++), new byte[0]));
-
- if (i % 1000 == 0) {
- assertThat(CompletableFutures.allOf(msPutFuts),
willCompleteSuccessfully());
-
- msPutFuts.clear();
-
- log.info("MS entries loaded {}", i);
- }
- }
-
- assertThat(CompletableFutures.allOf(msPutFuts),
willCompleteSuccessfully());
- });
-
- CompletableFuture<Void> restartPartitionsWithCleanupFuture =
node.disasterRecoveryManager().restartTablePartitionsWithCleanup(
- Set.of(nodeToCleanup.name()),
- testZone,
- SqlCommon.DEFAULT_SCHEMA_NAME,
- tableName,
- Set.of(0)
- );
-
- assertThat(restartPartitionsWithCleanupFuture,
willCompleteSuccessfully());
-
- stop.set(true);
-
- assertThat(msLoadFut, willCompleteSuccessfully());
-
- insert(1, 1, tableName);
-
- assertValueOnSpecificNodes(tableName, runningNodes, 0, 0);
-
- assertValueOnSpecificNodes(tableName, runningNodes, 1, 1);
- }
-
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
- @ParameterizedTest(name = "consistencyMode={0}, primaryReplica={1}")
- @CsvSource({
- "STRONG_CONSISTENCY, true",
- "STRONG_CONSISTENCY, false",
- "HIGH_AVAILABILITY, true",
- "HIGH_AVAILABILITY, false",
- })
- void testRestartTablePartitionsWithCleanUpTxRollback(ConsistencyMode
consistencyMode, boolean primaryReplica) throws Exception {
- IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
-
- cluster.startNode(1);
-
- String testZone = "TEST_ZONE";
-
- if (consistencyMode == ConsistencyMode.HIGH_AVAILABILITY) {
- createZone(node.catalogManager(), testZone, 1, 2, null, null,
ConsistencyMode.HIGH_AVAILABILITY);
- } else {
- cluster.startNode(2);
-
- createZone(node.catalogManager(), testZone, 1, 3);
- }
-
- Set<IgniteImpl> runningNodes =
cluster.runningNodes().map(TestWrappers::unwrapIgniteImpl).collect(Collectors.toSet());
-
- String tableName = "TABLE_NAME";
-
- node.sql().executeScript(String.format(
- "CREATE TABLE %s (id INT PRIMARY KEY, valInt INT) ZONE %s",
- tableName,
- testZone
- ));
-
- insert(0, 0, tableName);
-
- assertValueOnSpecificNodes(tableName, runningNodes, 0, 0);
-
- IgniteImpl primaryNode = unwrapIgniteImpl(findPrimaryIgniteNode(node,
new TablePartitionId(tableId(node, tableName), 0)));
-
- IgniteImpl nodeToCleanup;
-
- if (primaryReplica) {
- nodeToCleanup = primaryNode;
- } else {
- nodeToCleanup = cluster.runningNodes()
- .filter(n -> !n.name().equals(primaryNode.name()))
- .map(TestWrappers::unwrapIgniteImpl)
- .findFirst()
- .orElseThrow(() -> new IllegalStateException("No node
found that is not a primary replica."));
- }
-
- Transaction tx = nodeToCleanup.transactions().begin();
-
- nodeToCleanup.sql().execute(tx, String.format("INSERT INTO %s VALUES
(2, 2)", tableName));
-
- CompletableFuture<Void> restartPartitionsWithCleanupFuture =
-
nodeToCleanup.disasterRecoveryManager().restartTablePartitionsWithCleanup(
- Set.of(nodeToCleanup.name()),
- testZone,
- SqlCommon.DEFAULT_SCHEMA_NAME,
- tableName,
- Set.of(0)
- );
-
- assertThat(restartPartitionsWithCleanupFuture,
willCompleteSuccessfully());
-
- if (primaryReplica) {
- // We expect here that tx will be rolled back because we have
restarted primary replica. This is ensured by the fact that we
- // use ReplicaManager.weakStopReplica(RESTART) in
restartTablePartitionsWithCleanup, and this mechanism
- // waits for replica expiration and stops lease prolongation. As a
result, the transaction will not be able to commit
- // because the primary replica has expired.
- assertThrows(TransactionException.class, tx::commit, "Primary
replica has expired, transaction will be rolled back");
- } else {
- tx.commit();
-
- assertValueOnSpecificNodes(tableName, runningNodes, 2, 2);
- }
- }
-
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
- @Test
- @Disabled("https://issues.apache.org/jira/browse/IGNITE-23633")
- void testRestartTablePartitionsWithCleanUpConcurrentRebalance() throws
Exception {
- IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
-
- cluster.startNode(1);
- cluster.startNode(2);
- cluster.startNode(3);
-
- String testZone = "TEST_ZONE";
-
- createZone(node.catalogManager(), testZone, 1, 4);
-
- Set<IgniteImpl> runningNodes =
cluster.runningNodes().map(TestWrappers::unwrapIgniteImpl).collect(Collectors.toSet());
-
- assertEquals(4, runningNodes.size(), "Expected 4 running nodes after
zone alteration");
-
- String tableName = "TABLE_NAME";
-
- node.sql().executeScript(String.format(
- "CREATE TABLE %s (id INT PRIMARY KEY, valInt INT) ZONE %s",
- tableName,
- testZone
- ));
-
- insert(0, 0, tableName);
-
- assertValueOnSpecificNodes(tableName, runningNodes, 0, 0);
-
- IgniteImpl node4 = unwrapIgniteImpl(cluster.startNode(4));
-
- runningNodes =
cluster.runningNodes().map(TestWrappers::unwrapIgniteImpl).collect(Collectors.toSet());
-
- assertEquals(5, runningNodes.size(), "Expected 5 running nodes 5th
node started");
-
- int catalogVersion = node.catalogManager().latestCatalogVersion();
-
- long timestamp = node.catalogManager().catalog(catalogVersion).time();
-
- CatalogZoneDescriptor zoneDescriptor =
node.catalogManager().catalog(catalogVersion).zone(testZone);
-
- Set<Assignment> calculatedAssignments =
calculateAssignmentForPartition(
-
runningNodes.stream().map(IgniteImpl::name).collect(Collectors.toSet()),
- 0,
- zoneDescriptor.partitions(),
- 5,
- zoneDescriptor.consensusGroupSize()
- );
-
- Assignments assignmentsPending = Assignments.of(calculatedAssignments,
timestamp);
-
- TablePartitionId replicationGroupId = new
TablePartitionId(tableId(node, tableName), 0);
-
- AtomicBoolean blocked = new AtomicBoolean(true);
-
- AtomicBoolean reached = new AtomicBoolean(false);
-
- blockMessage(cluster, (nodeName, msg) ->
- blocked.get() && stableKeySwitchMessage(msg,
replicationGroupId, assignmentsPending, reached)
- );
-
- alterZone(node.catalogManager(), testZone, 5);
-
- waitForCondition(reached::get, 10_000L);
-
- CompletableFuture<Void> restartPartitionsWithCleanupFuture =
node4.disasterRecoveryManager().restartTablePartitionsWithCleanup(
- Set.of(node4.name()),
- testZone,
- SqlCommon.DEFAULT_SCHEMA_NAME,
- tableName,
- Set.of(0)
- );
-
- assertThat(restartPartitionsWithCleanupFuture,
willCompleteSuccessfully());
-
- insert(1, 1, tableName);
-
- blocked.set(false);
-
- runningNodes =
cluster.runningNodes().map(TestWrappers::unwrapIgniteImpl).collect(Collectors.toSet());
-
- assertEquals(5, runningNodes.size(), "Expected 5 running nodes after
zone alteration");
-
- assertValueOnSpecificNodes(tableName, runningNodes, 0, 0);
-
- assertValueOnSpecificNodes(tableName, runningNodes, 1, 1);
- }
-
- private IgniteImpl findNodeConformingOptions(String tableName, boolean
primaryReplica, boolean raftLeader) throws InterruptedException {
- Ignite nodeToCleanup;
-
- IgniteImpl ignite = unwrapIgniteImpl(cluster.aliveNode());
-
- TablePartitionId replicationGroupId = new
TablePartitionId(tableId(ignite, tableName), 0);
-
- String primaryNodeName = findPrimaryNodeName(ignite,
replicationGroupId);
-
- String raftLeaderNodeName =
cluster.leaderServiceFor(replicationGroupId).getServerId().getConsistentId();
-
- if (primaryReplica) {
- nodeToCleanup = findPrimaryIgniteNode(ignite, replicationGroupId);
- } else if (raftLeader) {
- nodeToCleanup = cluster.runningNodes()
- .filter(node -> node.name().equals(raftLeaderNodeName))
- .findFirst()
- .orElseThrow(() -> new IllegalStateException("No node
found that is a raft leader for the specified options."));
- } else {
- nodeToCleanup = cluster.runningNodes()
- .filter(node -> !node.name().equals(raftLeaderNodeName) &&
!node.name().equals(primaryNodeName))
- .findFirst()
- .orElse(cluster.aliveNode());
- }
-
- return unwrapIgniteImpl(nodeToCleanup);
- }
-
private static String findPrimaryNodeName(IgniteImpl ignite,
ReplicationGroupId replicationGroupId) {
assertThat(awaitPrimaryReplicaForNow(ignite, replicationGroupId),
willCompleteSuccessfully());
@@ -536,7 +154,6 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
}
@Test
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
void testRestartZonePartitions() {
IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
@@ -560,14 +177,6 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
assertThat(selectAll(), hasSize(4));
}
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
- @Test
- @ZoneParams(nodes = 2, replicas = 1, partitions = 2)
- void testEstimatedRowsTable() throws Exception {
- validateEstimatedRows();
- }
-
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
@Test
@ZoneParams(nodes = 2, replicas = 1, partitions = 2)
void testEstimatedRowsTableZone() throws Exception {
@@ -605,7 +214,6 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
));
}
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
@Test
@ZoneParams(nodes = 2, replicas = 1, partitions = 2)
void testEstimatedRowsZone() throws Exception {
@@ -677,7 +285,6 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
}
@Test
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
@ZoneParams(nodes = 2, replicas = 2, partitions = 2)
void testLocalPartitionStateZone() throws Exception {
IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
@@ -743,7 +350,6 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
}
@Test
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
@ZoneParams(nodes = 2, replicas = 2, partitions = 2)
void testGlobalPartitionStateZone() throws Exception {
IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
@@ -852,7 +458,6 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
DisasterRecoveryTestUtil.assertValueOnSpecificNodes(tableName, nodes,
id, val, SCHEMA);
}
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
@Test
void testRestartPartitionsWithCleanUpFails() throws Exception {
IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
@@ -883,7 +488,6 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
assertThat(exception.getCause().getMessage(), is("Not enough alive
nodes to perform reset with clean up."));
}
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
@Test
void testRestartHaPartitionsWithCleanUpFails() {
IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
@@ -918,7 +522,6 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
assertThat(exception.getCause().getMessage(), is("Not enough alive
nodes to perform reset with clean up."));
}
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
@ParameterizedTest(name = "consistencyMode={0}, primaryReplica={1},
raftLeader={2}")
@CsvSource({
"STRONG_CONSISTENCY, true, false",
@@ -977,7 +580,6 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
assertValueOnSpecificNodes(tableName, runningNodes, 1, 1);
}
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
@ParameterizedTest(name = "consistencyMode={0}, primaryReplica={1}")
@CsvSource({
"STRONG_CONSISTENCY, true",
@@ -1067,7 +669,6 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
}
@Disabled("https://issues.apache.org/jira/browse/IGNITE-23633")
- @WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
@Test
void testRestartPartitionsWithCleanUpConcurrentRebalance() throws
Exception {
IgniteImpl node = unwrapIgniteImpl(cluster.aliveNode());
diff --git
a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/TxManagerColocationTest.java
b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/TxManagerColocationTest.java
deleted file mode 100644
index 0fda3d12f39..00000000000
---
a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/TxManagerColocationTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.tx;
-
-import org.apache.ignite.internal.lang.IgniteSystemProperties;
-import org.apache.ignite.internal.replicator.ReplicationGroupId;
-import org.apache.ignite.internal.replicator.ZonePartitionId;
-import org.apache.ignite.internal.testframework.WithSystemProperty;
-
-// TODO: IGNITE-22522 - remove this class and switch TxManagerTest to use
ZonePartitionId.
-@WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
-class TxManagerColocationTest extends TxManagerTest {
- @Override
- ReplicationGroupId targetReplicationGroupId(int tableOrZoneId, int partId)
{
- return new ZonePartitionId(tableOrZoneId, partId);
- }
-}
diff --git
a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/TxManagerTest.java
b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/TxManagerTest.java
index f7853879a69..ccbc5b4f477 100644
---
a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/TxManagerTest.java
+++
b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/TxManagerTest.java
@@ -74,7 +74,6 @@ import org.apache.ignite.internal.hlc.HybridTimestamp;
import org.apache.ignite.internal.hlc.HybridTimestampTracker;
import org.apache.ignite.internal.hlc.TestClockService;
import org.apache.ignite.internal.lang.IgniteInternalException;
-import org.apache.ignite.internal.lang.IgniteSystemProperties;
import org.apache.ignite.internal.lowwatermark.TestLowWatermark;
import org.apache.ignite.internal.manager.ComponentContext;
import org.apache.ignite.internal.metrics.TestMetricManager;
@@ -86,12 +85,11 @@ import
org.apache.ignite.internal.placementdriver.ReplicaMeta;
import org.apache.ignite.internal.placementdriver.TestReplicaMetaImpl;
import org.apache.ignite.internal.replicator.ReplicaService;
import org.apache.ignite.internal.replicator.ReplicationGroupId;
-import org.apache.ignite.internal.replicator.TablePartitionId;
+import org.apache.ignite.internal.replicator.ZonePartitionId;
import
org.apache.ignite.internal.replicator.exception.PrimaryReplicaMissException;
import org.apache.ignite.internal.testframework.ExecutorServiceExtension;
import org.apache.ignite.internal.testframework.IgniteAbstractTest;
import org.apache.ignite.internal.testframework.InjectExecutorService;
-import org.apache.ignite.internal.testframework.WithSystemProperty;
import org.apache.ignite.internal.tx.configuration.TransactionConfiguration;
import org.apache.ignite.internal.tx.impl.HeapLockManager;
import org.apache.ignite.internal.tx.impl.PrimaryReplicaExpiredException;
@@ -123,7 +121,6 @@ import org.mockito.verification.VerificationMode;
*/
@ExtendWith(ConfigurationExtension.class)
@ExtendWith(ExecutorServiceExtension.class)
-@WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
public class TxManagerTest extends IgniteAbstractTest {
private static final InternalClusterNode LOCAL_NODE = new ClusterNodeImpl(
randomUUID(), "local", new NetworkAddress("127.0.0.1", 2004), null
@@ -246,7 +243,7 @@ public class TxManagerTest extends IgniteAbstractTest {
InternalTransaction tx =
txManager.beginExplicitRw(hybridTimestampTracker, InternalTxOptions.defaults());
- ReplicationGroupId partitionIdForEnlistment =
targetReplicationGroupId(1, 0);
+ ReplicationGroupId partitionIdForEnlistment = new ZonePartitionId(1,
0);
tx.assignCommitPartition(partitionIdForEnlistment);
tx.enlist(partitionIdForEnlistment, 10, REMOTE_NODE.name(), 1L);
@@ -270,11 +267,6 @@ public class TxManagerTest extends IgniteAbstractTest {
.thenReturn(completedFuture(new
TransactionResult(TxState.COMMITTED, commitTimestamp)));
}
- // TODO: IGNITE-22522 - inline this after switching to ZonePartitionId.
- ReplicationGroupId targetReplicationGroupId(int tableOrZoneId, int partId)
{
- return new TablePartitionId(tableOrZoneId, partId);
- }
-
@Test
public void testId() throws Exception {
UUID txId1 = TestTransactionIds.newTransactionId();
@@ -348,7 +340,7 @@ public class TxManagerTest extends IgniteAbstractTest {
InternalTransaction tx =
txManager.beginExplicitRw(hybridTimestampTracker, InternalTxOptions.defaults());
- ReplicationGroupId replicationGroupId = targetReplicationGroupId(1, 0);
+ ReplicationGroupId replicationGroupId = new ZonePartitionId(1, 0);
tx.enlist(replicationGroupId, 10, REMOTE_NODE.name(), 1L);
tx.assignCommitPartition(replicationGroupId);
@@ -370,7 +362,7 @@ public class TxManagerTest extends IgniteAbstractTest {
InternalTransaction tx =
txManager.beginExplicitRw(hybridTimestampTracker, InternalTxOptions.defaults());
- ReplicationGroupId replicationGroupId = targetReplicationGroupId(1, 0);
+ ReplicationGroupId replicationGroupId = new ZonePartitionId(1, 0);
tx.enlist(replicationGroupId, 10, REMOTE_NODE.name(), 1L);
tx.assignCommitPartition(replicationGroupId);
@@ -399,7 +391,7 @@ public class TxManagerTest extends IgniteAbstractTest {
InternalTransaction tx =
txManager.beginExplicitRw(hybridTimestampTracker, InternalTxOptions.defaults());
- ReplicationGroupId replicationGroupId = targetReplicationGroupId(1, 0);
+ ReplicationGroupId replicationGroupId = new ZonePartitionId(1, 0);
transactionInflights.track(tx.id());
tx.enlist(replicationGroupId, 10, REMOTE_NODE.name(), 1L);
@@ -428,7 +420,7 @@ public class TxManagerTest extends IgniteAbstractTest {
InternalTransaction tx =
txManager.beginExplicitRw(hybridTimestampTracker, InternalTxOptions.defaults());
- ReplicationGroupId replicationGroupId = targetReplicationGroupId(1, 0);
+ ReplicationGroupId replicationGroupId = new ZonePartitionId(1, 0);
transactionInflights.track(tx.id());
tx.enlist(replicationGroupId, 10, REMOTE_NODE.name(), 1L);
@@ -670,11 +662,11 @@ public class TxManagerTest extends IgniteAbstractTest {
String nodeName = "SomeNode";
- ReplicationGroupId partitionIdForEnlistment1 =
targetReplicationGroupId(1, 0);
+ ReplicationGroupId partitionIdForEnlistment1 = new ZonePartitionId(1,
0);
tx.enlist(partitionIdForEnlistment1, 10, nodeName, 1L);
tx.assignCommitPartition(partitionIdForEnlistment1);
- ReplicationGroupId partitionIdForEnlistment2 =
targetReplicationGroupId(2, 0);
+ ReplicationGroupId partitionIdForEnlistment2 = new ZonePartitionId(2,
0);
tx.enlist(partitionIdForEnlistment2, 20, nodeName, 1L);
when(placementDriver.getPrimaryReplica(eq(partitionIdForEnlistment1),
any()))
@@ -835,7 +827,7 @@ public class TxManagerTest extends IgniteAbstractTest {
private InternalTransaction prepareTransaction() {
InternalTransaction tx =
txManager.beginExplicitRw(hybridTimestampTracker, InternalTxOptions.defaults());
- ReplicationGroupId replicationGroupId = targetReplicationGroupId(1, 0);
+ ReplicationGroupId replicationGroupId = new ZonePartitionId(1, 0);
tx.enlist(replicationGroupId, 10, REMOTE_NODE.name(), 1L);
tx.assignCommitPartition(replicationGroupId);
diff --git
a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImplColocationTest.java
b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImplColocationTest.java
deleted file mode 100644
index f970fd3e511..00000000000
---
a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImplColocationTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.tx.impl;
-
-import org.apache.ignite.internal.lang.IgniteSystemProperties;
-import org.apache.ignite.internal.replicator.ReplicationGroupId;
-import org.apache.ignite.internal.replicator.ZonePartitionId;
-import org.apache.ignite.internal.testframework.WithSystemProperty;
-
-// TODO: IGNITE-22522 - remove this class and switch
ReadWriteTransactionImplTest to use ZonePartitionId.
-@WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "true")
-class ReadWriteTransactionImplColocationTest extends
ReadWriteTransactionImplTest {
- @Override
- ReplicationGroupId targetReplicationGroupId(int tableOrZoneId, int partId)
{
- return new ZonePartitionId(tableOrZoneId, partId);
- }
-}
diff --git
a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImplTest.java
b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImplTest.java
index b86ff8bb5a1..5c67836f986 100644
---
a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImplTest.java
+++
b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImplTest.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.tx.impl;
import static java.util.UUID.randomUUID;
-import static
org.apache.ignite.internal.lang.IgniteSystemProperties.colocationEnabled;
import static org.apache.ignite.internal.tx.TxState.ABORTED;
import static org.apache.ignite.internal.tx.TxState.COMMITTED;
import static org.apache.ignite.internal.tx.TxState.FINISHING;
@@ -36,13 +35,11 @@ import org.apache.ignite.internal.hlc.HybridClock;
import org.apache.ignite.internal.hlc.HybridClockImpl;
import org.apache.ignite.internal.hlc.HybridTimestamp;
import org.apache.ignite.internal.hlc.HybridTimestampTracker;
-import org.apache.ignite.internal.lang.IgniteSystemProperties;
import org.apache.ignite.internal.network.ClusterNodeImpl;
import org.apache.ignite.internal.network.InternalClusterNode;
import org.apache.ignite.internal.replicator.ReplicationGroupId;
-import org.apache.ignite.internal.replicator.TablePartitionId;
+import org.apache.ignite.internal.replicator.ZonePartitionId;
import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
-import org.apache.ignite.internal.testframework.WithSystemProperty;
import org.apache.ignite.internal.tx.TxManager;
import org.apache.ignite.internal.tx.TxState;
import org.apache.ignite.internal.tx.TxStateMeta;
@@ -56,7 +53,6 @@ import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
-@WithSystemProperty(key = IgniteSystemProperties.COLOCATION_FEATURE_FLAG,
value = "false")
class ReadWriteTransactionImplTest extends BaseIgniteAbstractTest {
private static final InternalClusterNode CLUSTER_NODE = new
ClusterNodeImpl(
randomUUID(),
@@ -68,7 +64,7 @@ class ReadWriteTransactionImplTest extends
BaseIgniteAbstractTest {
private static final int ZONE_ID = 2;
/** Transaction commit partition id. */
- private final ReplicationGroupId txCommitPart =
targetReplicationGroupId(ZONE_ID, 0);
+ private final ReplicationGroupId txCommitPart = new
ZonePartitionId(ZONE_ID, 0);
@Mock
private TxManager txManager;
@@ -78,11 +74,6 @@ class ReadWriteTransactionImplTest extends
BaseIgniteAbstractTest {
/** The state is assigned to the transaction after a finalize method
(commit or rollback) is called. */
private TxState txState = null;
- // TODO: IGNITE-22522 - inline this after switching to ZonePartitionId.
- ReplicationGroupId targetReplicationGroupId(int tableOrZoneId, int partId)
{
- return new TablePartitionId(tableOrZoneId, partId);
- }
-
@Test
public void effectiveSchemaTimestampIsBeginTimestamp() {
HybridTimestamp beginTs = clock.now();
@@ -90,7 +81,7 @@ class ReadWriteTransactionImplTest extends
BaseIgniteAbstractTest {
UUID txId =
TestTransactionIds.TRANSACTION_ID_GENERATOR.transactionIdFor(beginTs);
var tx = new ReadWriteTransactionImpl(
- txManager, HybridTimestampTracker.atomicTracker(null), txId,
CLUSTER_NODE.id(), false, 10_000, colocationEnabled()
+ txManager, HybridTimestampTracker.atomicTracker(null), txId,
CLUSTER_NODE.id(), false, 10_000, true
);
assertThat(tx.schemaTimestamp(), is(beginTs));
@@ -123,13 +114,13 @@ class ReadWriteTransactionImplTest extends
BaseIgniteAbstractTest {
UUID txId =
TestTransactionIds.TRANSACTION_ID_GENERATOR.transactionIdFor(beginTs);
var tx = new ReadWriteTransactionImpl(
- txManager, HybridTimestampTracker.atomicTracker(null), txId,
CLUSTER_NODE.id(), false, 10_000, colocationEnabled()
+ txManager, HybridTimestampTracker.atomicTracker(null), txId,
CLUSTER_NODE.id(), false, 10_000, true
);
tx.assignCommitPartition(txCommitPart);
- tx.enlist(targetReplicationGroupId(ZONE_ID, 0), TABLE_ID,
CLUSTER_NODE.name(), 0L);
- tx.enlist(targetReplicationGroupId(ZONE_ID, 2), TABLE_ID,
CLUSTER_NODE.name(), 0L);
+ tx.enlist(new ZonePartitionId(ZONE_ID, 0), TABLE_ID,
CLUSTER_NODE.name(), 0L);
+ tx.enlist(new ZonePartitionId(ZONE_ID, 2), TABLE_ID,
CLUSTER_NODE.name(), 0L);
if (commit) {
if (txState == null) {
@@ -146,13 +137,13 @@ class ReadWriteTransactionImplTest extends
BaseIgniteAbstractTest {
}
TransactionException ex = assertThrows(TransactionException.class,
- () -> tx.enlist(targetReplicationGroupId(ZONE_ID, 5),
TABLE_ID, CLUSTER_NODE.name(), 0L));
+ () -> tx.enlist(new ZonePartitionId(ZONE_ID, 5), TABLE_ID,
CLUSTER_NODE.name(), 0L));
assertTrue(ex.getMessage().contains(txState.toString()));
ex = assertThrows(
TransactionException.class,
- () -> tx.enlist(targetReplicationGroupId(ZONE_ID, 0),
TABLE_ID, CLUSTER_NODE.name(), 0L)
+ () -> tx.enlist(new ZonePartitionId(ZONE_ID, 0), TABLE_ID,
CLUSTER_NODE.name(), 0L)
);
assertTrue(ex.getMessage().contains(txState.toString()));