zstan commented on a change in pull request #441:
URL: https://github.com/apache/ignite-3/pull/441#discussion_r749093754
##########
File path:
modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTablesApiTest.java
##########
@@ -116,97 +125,314 @@
/** Cluster nodes. */
private List<Ignite> clusterNodes;
-
+
/**
* Before each.
*/
@BeforeEach
void beforeEach(TestInfo testInfo) throws Exception {
String metastorageNodeName = IgniteTestUtils.testNodeName(testInfo, 0);
-
+
clusterNodes = IntStream.range(0,
nodesBootstrapCfg.size()).mapToObj(value -> {
String nodeName = IgniteTestUtils.testNodeName(testInfo,
value);
-
+
return IgnitionManager.start(
nodeName,
nodesBootstrapCfg.get(value).apply(metastorageNodeName),
workDir.resolve(nodeName));
}
).collect(Collectors.toList());
}
-
+
/**
* After each.
*/
@AfterEach
void afterEach() throws Exception {
IgniteUtils.closeAll(ItUtils.reverse(clusterNodes));
}
+
+ /**
+ * Trys to create a table which is already created.
+ *
+ * @throws Exception If failed.
+ */
+ @Test
+ public void testTableAlreadyCreated() throws Exception {
+ clusterNodes.forEach(ign ->
assertNull(ign.tables().table(TABLE_NAME)));
+
+ Ignite ignite0 = clusterNodes.get(0);
+
+ Table tbl = createTable(ignite0, SCHEMA, SHORT_TABLE_NAME);
+
+ assertThrows(TableAlreadyExistsException.class,
+ () -> createTable(ignite0, SCHEMA, SHORT_TABLE_NAME));
+
+ assertEquals(tbl, createTableIfNotExists(ignite0, SCHEMA,
SHORT_TABLE_NAME));
+ }
/**
- * Checks that if a table would be created/dropped into any cluster node,
this is visible to all other nodes.
+ * Trys to create a table which is already created from lagged node.
*
* @throws Exception If failed.
*/
@Test
- public void testCreateDropTable() throws Exception {
+ @Disabled("IGNITE-15891 Configuration use local state cache internally,
but have to look at consensus")
+ public void testTableAlreadyCreatedFromLaggedNode() throws Exception {
clusterNodes.forEach(ign ->
assertNull(ign.tables().table(TABLE_NAME)));
+ Ignite ignite0 = clusterNodes.get(0);
+
Ignite ignite1 = clusterNodes.get(1);
WatchListenerInhibitor ignite1Inhibitor =
metastorageEventsInhibitor(ignite1);
ignite1Inhibitor.startInhibit();
- Table table = createTable(clusterNodes.get(0), SCHEMA,
SHORT_TABLE_NAME);
+ createTable(ignite0, SCHEMA, SHORT_TABLE_NAME);
+
+ CompletableFuture createTblFut = CompletableFuture.runAsync(() ->
createTable(ignite1, SCHEMA, SHORT_TABLE_NAME));
+ CompletableFuture createTblIfNotExistsFut = CompletableFuture
+ .runAsync(() -> createTableIfNotExists(ignite1, SCHEMA,
SHORT_TABLE_NAME));
- IgniteUuid tblId = ((TableImpl) table).tableId();
+ for (Ignite ignite : clusterNodes) {
+ if (ignite != ignite1) {
+ assertThrows(TableAlreadyExistsException.class,
+ () -> createTable(ignite, SCHEMA, SHORT_TABLE_NAME));
+
+ assertNotNull(createTableIfNotExists(ignite, SCHEMA,
SHORT_TABLE_NAME));
+ }
+ }
+
+ Thread.sleep(10_000);
Review comment:
we need to avoid _sleep_ usage.
--
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]