lowka commented on code in PR #6430:
URL: https://github.com/apache/ignite-3/pull/6430#discussion_r2281733008


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/ClusterWideStorageProfileValidator.java:
##########
@@ -47,6 +51,26 @@ public void validate(Collection<String> storageProfiles) {
                 localLogicalTopologySnapshot
         );
 
+        if (missedStorageProfileNames.isEmpty()) {
+            return;
+        }
+
+        try {
+            missedStorageProfileNames = 
logicalTopologyService.logicalTopologyOnLeader()
+                    .thenApply(topologySnapshot -> 
findStorageProfileNotPresentedInLogicalTopologySnapshot(
+                            storageProfiles,
+                            topologySnapshot
+                    )).get(10, TimeUnit.SECONDS);
+        } catch (InterruptedException | ExecutionException | TimeoutException 
e) {
+            String msg = format(
+                    "Storage profile {} doesn't exist in local topology 
snapshot with profiles [{}], and distributed refresh failed.",
+                    missedStorageProfileNames,
+                    
localLogicalTopologySnapshot.nodes().stream().map(LogicalNode::storageProfiles).collect(Collectors.toSet())
+            );
+
+            throw new SqlException(STMT_VALIDATION_ERR, msg, e);

Review Comment:
   Let's replace this code with INTERNAL_ERR code, because is this not a 
validation error.
   



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/ClusterWideStorageProfileValidator.java:
##########
@@ -47,6 +51,26 @@ public void validate(Collection<String> storageProfiles) {
                 localLogicalTopologySnapshot
         );
 
+        if (missedStorageProfileNames.isEmpty()) {
+            return;
+        }
+
+        try {
+            missedStorageProfileNames = 
logicalTopologyService.logicalTopologyOnLeader()
+                    .thenApply(topologySnapshot -> 
findStorageProfileNotPresentedInLogicalTopologySnapshot(
+                            storageProfiles,
+                            topologySnapshot
+                    )).get(10, TimeUnit.SECONDS);

Review Comment:
   We should avoid blocking here, so let's modify this method to return a 
`CompletableFuture<Void>` .
   Then `DdlCommandConvert convert` should be updated to return a 
CompletableFuture<Command> as well. 
   



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to