sergeyuttsel commented on code in PR #1968:
URL: https://github.com/apache/ignite-3/pull/1968#discussion_r1182742346


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -1343,72 +1355,132 @@ private Set<Assignment> 
calculateAssignments(TableConfiguration tableCfg, int pa
      *         </ul>
      * @see TableAlreadyExistsException
      */
-    public CompletableFuture<Table> createTableAsync(String name, 
Consumer<TableChange> tableInitChange) {
+    public CompletableFuture<Table> createTableAsync(String name, String 
zoneName, Consumer<TableChange> tableInitChange) {
         if (!busyLock.enterBusy()) {
             throw new IgniteException(new NodeStoppingException());
         }
         try {
-            return createTableAsyncInternal(name, tableInitChange);
+            return createTableAsyncInternal(name, zoneName, tableInitChange);
         } finally {
             busyLock.leaveBusy();
         }
     }
 
-    /** See {@link #createTableAsync(String, Consumer)} for details. */
-    private CompletableFuture<Table> createTableAsyncInternal(String name, 
Consumer<TableChange> tableInitChange) {
+    /** See {@link #createTableAsync(String, String, Consumer)} for details. */
+    private CompletableFuture<Table> createTableAsyncInternal(
+            String name,
+            String zoneName,
+            Consumer<TableChange> tableInitChange
+    ) {
         CompletableFuture<Table> tblFut = new CompletableFuture<>();
+        tableAsyncInternal(name)
+                .thenAccept(tbl -> {
+                    if (tbl != null) {
+                        tblFut.completeExceptionally(new 
TableAlreadyExistsException(DEFAULT_SCHEMA_NAME, name));
+                    } else {
+                        
distributionZoneManager.zoneIdAsyncInternal(zoneName).handle((zoneId, ex) -> {

Review Comment:
   1. DistributionZoneAwaitDataNodesTest - tests for topologyVersionedDataNodes.
   2. MockedStructuresTest#testCreateTableWithDistributionZone - I added 
additional asserts for exception handling.
   3. DistributionZoneMockTest#getNonExistingZoneFromDirectProxy - a test for 
null handling.
   4. ItRebalanceDistributedTest#testOnLeaderElectedRebalanceRestart - tests 
that the distribution zone created on node0 is available on node1.
   5. All other tests for a table creation.



-- 
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]

Reply via email to