sk0x50 commented on code in PR #5276:
URL: https://github.com/apache/ignite-3/pull/5276#discussion_r1981190875


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -169,11 +170,30 @@ public CompletableFuture<Void> stopAsync(ComponentContext 
componentContext) {
      *
      * @param causalityToken Causality token.
      * @param tableId Table ID.
-     * @return Future with multi-version table storage, completes with {@code 
null} if the table does not exist according to the passed
-     *      parameters.
+     * @return Future with multi-version table storage, completes with an 
exception if the table or storage does not exist
+     *      according to the passed parameters.
      */
-    CompletableFuture<@Nullable MvTableStorage> getMvTableStorage(long 
causalityToken, int tableId) {
-        return tableManager.tableAsync(causalityToken, 
tableId).thenApply(table -> table == null ? null : 
table.internalTable().storage());
+    CompletableFuture<MvTableStorage> getMvTableStorage(long causalityToken, 
int tableId) {
+        return tableManager
+                .tableAsync(causalityToken, tableId)
+                .thenApply(table -> {
+                    if (table == null) {
+                        throw new IgniteInternalException(

Review Comment:
   I found only one usage in `IndexBuildController`:
   ```
       private CompletableFuture<MvTableStorage> getMvTableStorageFuture(long 
causalityToken, TablePartitionId replicaId) {
           return indexManager.getMvTableStorage(causalityToken, 
replicaId.tableId())
                   .thenApply(mvTableStorage -> 
requireMvTableStorageNonNull(mvTableStorage, replicaId.tableId()));
       }
   
   ```
   
   So, I think there is no need to create an additional `CompletableFuture` via 
`thenApply`. I moved this check to the `IndexManager.getMvTableStorage`. The 
behavior is still the same.



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