rpuch commented on code in PR #4072:
URL: https://github.com/apache/ignite-3/pull/4072#discussion_r1675640969


##########
modules/index/src/main/java/org/apache/ignite/internal/index/ChangeIndexStatusTask.java:
##########
@@ -333,8 +335,26 @@ private <T> CompletableFuture<T> 
inBusyLocks(Supplier<CompletableFuture<T>> supp
 
         try {
             return supplier.get();
+        } catch (Throwable t) {
+            return failedFuture(t);
         } finally {
             leaveBusy();
         }
     }
+
+    private MetaIndexStatusChange statusChange() {
+        IndexMeta indexMeta = indexMetaStorage.indexMeta(indexDescriptor.id());
+
+        if (indexMeta == null) {
+            // Index was destroyed under a low watermark, well, we need to 
build it.
+            throw new IndexTaskStoppingException();
+        }
+
+        MetaIndexStatusChange statusChange = 
indexMeta.statusChangeNullable(MetaIndexStatus.convert(indexDescriptor.status()));
+
+        assert statusChange != null : IgniteStringFormatter.format("Missing 
index status change: [indexId={}, catalogStatus={}]",

Review Comment:
   This is not a hot code, so we can check for null properly at each invocation 
and not use assertion for this.
   
   It's much better to see a `null` right away than deal with an NPE later on.



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