vldpyatkov commented on a change in pull request #678:
URL: https://github.com/apache/ignite-3/pull/678#discussion_r811379740



##########
File path: 
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -708,50 +797,50 @@ public Table createTable(String name, 
Consumer<TableChange> tableInitChange) {
                     }
 
                     change.create(name, (ch) -> {
-                                tableInitChange.accept(ch);
-
-                                ((ExtendedTableChange) ch)
-                                        // Affinity assignments calculation.
-                                        
.changeAssignments(ByteUtils.toBytes(AffinityUtils.calculateAssignments(
-                                                baselineMgr.nodes(),
-                                                ch.partitions(),
-                                                ch.replicas())))
-                                        // Table schema preparation.
-                                        .changeSchemas(schemasCh -> 
schemasCh.create(
-                                                
String.valueOf(INITIAL_SCHEMA_VERSION),
-                                                schemaCh -> {
-                                                    SchemaDescriptor 
schemaDesc;
-
-                                                    //TODO IGNITE-15747 Remove 
try-catch and force configuration
-                                                    // validation here to 
ensure a valid configuration passed to
-                                                    // 
prepareSchemaDescriptor() method.
-                                                    try {
-                                                        schemaDesc = 
SchemaUtils.prepareSchemaDescriptor(
-                                                                
((ExtendedTableView) ch).schemas().size(),
-                                                                ch);
-                                                    } catch 
(IllegalArgumentException ex) {
-                                                        throw new 
ConfigurationValidationException(ex.getMessage());
-                                                    }
-
-                                                    
schemaCh.changeSchema(SchemaSerializerImpl.INSTANCE.serialize(schemaDesc));
-                                                }
-                                        ));
-                            }
-                    );
-                }).whenComplete((res, t) -> {
-                    if (t != null) {
-                        Throwable ex = getRootCause(t);
+                        tableInitChange.accept(ch);
+
+                        var extConfCh = ((ExtendedTableChange) ch);
+
+                        tableCreateFuts.put(extConfCh.id(), tblFut);
+
+                        // Affinity assignments calculation.
+                        
extConfCh.changeAssignments(ByteUtils.toBytes(AffinityUtils.calculateAssignments(
+                                        baselineMgr.nodes(),
+                                        ch.partitions(),
+                                        ch.replicas())))
+                                // Table schema preparation.
+                                .changeSchemas(schemasCh -> schemasCh.create(
+                                        String.valueOf(INITIAL_SCHEMA_VERSION),
+                                        schemaCh -> {
+                                            SchemaDescriptor schemaDesc;
+
+                                            //TODO IGNITE-15747 Remove 
try-catch and force configuration
+                                            // validation here to ensure a 
valid configuration passed to
+                                            // prepareSchemaDescriptor() 
method.
+                                            try {
+                                                schemaDesc = 
SchemaUtils.prepareSchemaDescriptor(
+                                                        ((ExtendedTableView) 
ch).schemas().size(),
+                                                        ch);
+                                            } catch (IllegalArgumentException 
ex) {
+                                                throw new 
ConfigurationValidationException(ex.getMessage());
+                                            }
 
-                        if (ex instanceof TableAlreadyExistsException) {
-                            tblFut.completeExceptionally(ex);
-                        } else {
-                            LOG.error(IgniteStringFormatter.format("Table 
wasn't created [name={}]", name), ex);
+                                            
schemaCh.changeSchema(SchemaSerializerImpl.INSTANCE.serialize(schemaDesc));
+                                        }
+                                ));
+                    });
+                }).exceptionally(t -> {
+                    Throwable ex = getRootCause(t);
 
-                            tblFut.completeExceptionally(ex);
-                        }
+                    if (ex instanceof TableAlreadyExistsException) {
+                        tblFut.completeExceptionally(ex);
                     } else {
-                        tblFut.complete(tables.get(name));
+                        LOG.error(IgniteStringFormatter.format("Table wasn't 
created [name={}]", name), ex);
+
+                        tblFut.completeExceptionally(ex);

Review comment:
       You right, fixed.




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