You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by as...@apache.org on 2021/08/03 07:48:55 UTC
[ignite-3] branch main updated: IGNITE-15215 Unmuted
DynamicTableCreationTest. - Fixes #251.
This is an automated email from the ASF dual-hosted git repository.
ascherbakov 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 5353c4d IGNITE-15215 Unmuted DynamicTableCreationTest. - Fixes #251.
5353c4d is described below
commit 5353c4d8b72a148cc308f54fa28221e000d91230
Author: sanpwc <al...@gridgain.com>
AuthorDate: Tue Aug 3 10:47:46 2021 +0300
IGNITE-15215 Unmuted DynamicTableCreationTest. - Fixes #251.
Signed-off-by: Alexey Scherbakov <al...@gmail.com>
---
.../raft/jraft/rpc/impl/client/GetLeaderRequestProcessor.java | 7 ++++++-
.../src/main/java/org/apache/ignite/raft/jraft/util/Utils.java | 4 ++--
.../src/test/java/org/apache/ignite/raft/jraft/util/UtilsTest.java | 6 +-----
.../ignite/internal/runner/app/AbstractSchemaChangeTest.java | 3 ++-
.../ignite/internal/runner/app/DynamicTableCreationTest.java | 5 ++---
5 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/modules/raft/src/main/java/org/apache/ignite/raft/jraft/rpc/impl/client/GetLeaderRequestProcessor.java b/modules/raft/src/main/java/org/apache/ignite/raft/jraft/rpc/impl/client/GetLeaderRequestProcessor.java
index 9c025e3..4723ed7 100644
--- a/modules/raft/src/main/java/org/apache/ignite/raft/jraft/rpc/impl/client/GetLeaderRequestProcessor.java
+++ b/modules/raft/src/main/java/org/apache/ignite/raft/jraft/rpc/impl/client/GetLeaderRequestProcessor.java
@@ -48,8 +48,13 @@ public class GetLeaderRequestProcessor implements RpcProcessor<GetLeaderRequest>
Node node = rpcCtx.getNodeManager().get(request.groupId(), new PeerId(localAddr.host(), localAddr.port()));
+ // There's a race between starting a raft group and requesting a leader for it.
+ // Let's say that there are 3 ignite nodes {A,B,C} in the cluster and according to an affinity raft group
+ // with only one raft node should be created on ignite node A. However it's possible to request given
+ // raft group from another ignite node B from within {@link RaftGroupService}. So that it's possible
+ // that raftGroupService will be already created and requests a leader from a not yet existing raft group.
if (node == null) {
- rpcCtx.sendResponse(factory.raftErrorResponse().errorCode(RaftErrorCode.ILLEGAL_STATE).build());
+ rpcCtx.sendResponse(factory.raftErrorResponse().errorCode(RaftErrorCode.NO_LEADER).build());
return;
}
diff --git a/modules/raft/src/main/java/org/apache/ignite/raft/jraft/util/Utils.java b/modules/raft/src/main/java/org/apache/ignite/raft/jraft/util/Utils.java
index b4c5014..accb888 100644
--- a/modules/raft/src/main/java/org/apache/ignite/raft/jraft/util/Utils.java
+++ b/modules/raft/src/main/java/org/apache/ignite/raft/jraft/util/Utils.java
@@ -90,7 +90,7 @@ public final class Utils {
public static final boolean USE_MPSC_SINGLE_THREAD_EXECUTOR = SystemPropertyUtil.getBoolean(
"jraft.use.mpsc.single.thread.executor", true);
- private static final Pattern GROUP_ID_PATTER = Pattern.compile("^[a-zA-Z][a-zA-Z0-9\\-_]*$");
+ private static final Pattern GROUP_ID_PATTER = Pattern.compile("^[0-9a-zA-Z][a-zA-Z0-9\\-_]*$");
public static void verifyGroupId(final String groupId) {
if (StringUtils.isBlank(groupId)) {
@@ -98,7 +98,7 @@ public final class Utils {
}
if (!GROUP_ID_PATTER.matcher(groupId).matches()) {
throw new IllegalArgumentException(
- "Invalid group id, it should be started with character 'a'-'z' or 'A'-'Z',"
+ "Invalid group id, it should be started with number or character 'a'-'z' or 'A'-'Z',"
+ "and followed with numbers, english alphabet, '-' or '_'. ");
}
}
diff --git a/modules/raft/src/test/java/org/apache/ignite/raft/jraft/util/UtilsTest.java b/modules/raft/src/test/java/org/apache/ignite/raft/jraft/util/UtilsTest.java
index 07cef54..0481ed0 100644
--- a/modules/raft/src/test/java/org/apache/ignite/raft/jraft/util/UtilsTest.java
+++ b/modules/raft/src/test/java/org/apache/ignite/raft/jraft/util/UtilsTest.java
@@ -62,11 +62,6 @@ public class UtilsTest {
}
@Test
- public void tetsVerifyGroupId3() {
- assertThrows(IllegalArgumentException.class, () -> Utils.verifyGroupId("1abc"));
- }
-
- @Test
public void tetsVerifyGroupId4() {
assertThrows(IllegalArgumentException.class, () -> Utils.verifyGroupId("*test"));
}
@@ -80,6 +75,7 @@ public class UtilsTest {
Utils.verifyGroupId("test-hello");
Utils.verifyGroupId("test123");
Utils.verifyGroupId("t_hello");
+ Utils.verifyGroupId("1abc");
}
@Test
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/AbstractSchemaChangeTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/AbstractSchemaChangeTest.java
index fbe794c..3cb5ff6 100644
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/AbstractSchemaChangeTest.java
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/AbstractSchemaChangeTest.java
@@ -23,6 +23,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
+import com.google.common.collect.Lists;
import org.apache.ignite.app.Ignite;
import org.apache.ignite.app.IgnitionManager;
import org.apache.ignite.internal.schema.InvalidTypeException;
@@ -95,7 +96,7 @@ abstract class AbstractSchemaChangeTest {
*/
@AfterEach
void afterEach() throws Exception {
- IgniteUtils.closeAll(clusterNodes);
+ IgniteUtils.closeAll(Lists.reverse(clusterNodes));
}
/**
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/DynamicTableCreationTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/DynamicTableCreationTest.java
index 575db70..e81aa3b 100644
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/DynamicTableCreationTest.java
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/DynamicTableCreationTest.java
@@ -23,6 +23,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import com.google.common.collect.Lists;
import org.apache.ignite.app.Ignite;
import org.apache.ignite.app.IgnitionManager;
import org.apache.ignite.internal.schema.configuration.SchemaConfigurationConverter;
@@ -37,7 +38,6 @@ import org.apache.ignite.table.KeyValueBinaryView;
import org.apache.ignite.table.Table;
import org.apache.ignite.table.Tuple;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -48,7 +48,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Ignition interface tests.
*/
-@Disabled("https://issues.apache.org/jira/browse/IGNITE-14581")
@ExtendWith(WorkDirectoryExtension.class)
class DynamicTableCreationTest {
/** Nodes bootstrap configuration. */
@@ -94,7 +93,7 @@ class DynamicTableCreationTest {
/** */
@AfterEach
void tearDown() throws Exception {
- IgniteUtils.closeAll(clusterNodes);
+ IgniteUtils.closeAll(Lists.reverse(clusterNodes));
}
/**