JAkutenshi commented on code in PR #6430: URL: https://github.com/apache/ignite-3/pull/6430#discussion_r2297404824
########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/ClusterWideStorageProfileValidator.java: ########## @@ -53,33 +51,38 @@ public CompletableFuture<Void> validate(Collection<String> storageProfiles) { ); if (missedStorageProfileNames.isEmpty()) { - return; + return CompletableFuture.completedFuture(null); } - try { - missedStorageProfileNames = logicalTopologyService.logicalTopologyOnLeader() + return 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); - } - - if (!missedStorageProfileNames.isEmpty()) { - throw new SqlException(STMT_VALIDATION_ERR, format( - "Some storage profiles don't exist [missedProfileNames={}].", - missedStorageProfileNames - )); - } - - return completedFuture(null); + )).handle((missedProfileNames, e) -> { + if (e != null) { + String msg = format( + "Storage profiles {} doesn't exist in local topology snapshot with profiles [{}], " Review Comment: Fixed, thank you! ########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/ClusterWideStorageProfileValidator.java: ########## @@ -53,33 +51,38 @@ public CompletableFuture<Void> validate(Collection<String> storageProfiles) { ); if (missedStorageProfileNames.isEmpty()) { - return; + return CompletableFuture.completedFuture(null); } - try { - missedStorageProfileNames = logicalTopologyService.logicalTopologyOnLeader() + return 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); - } - - if (!missedStorageProfileNames.isEmpty()) { - throw new SqlException(STMT_VALIDATION_ERR, format( - "Some storage profiles don't exist [missedProfileNames={}].", - missedStorageProfileNames - )); - } - - return completedFuture(null); + )).handle((missedProfileNames, e) -> { + if (e != null) { + String msg = format( + "Storage profiles {} doesn't exist in local topology snapshot with profiles [{}], " + + "and distributed refresh failed.", + missedStorageProfileNames, + localLogicalTopologySnapshot + .nodes() + .stream() + .map(LogicalNode::storageProfiles) + .collect(Collectors.toSet()) Review Comment: Done. -- 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