New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ISPN-14406 Synchronize the partial reindex with refresh and flush #10536
Conversation
indexUpdater.refresh(classSet); | ||
|
||
if (!updates.isEmpty()) { | ||
CompletableFuture.allOf(updates.toArray(new CompletableFuture[0])).join(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use org.infinispan.commons.util.concurrent.CompletableFutures.sequence(updates)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I'm fixing it
Thanks @tristantarrant pushed the fix. Let me know if there is anything else we can improve here. |
@@ -77,18 +81,25 @@ public Void apply(EmbeddedCacheManager embeddedCacheManager) { | |||
postIndex(indexUpdater, progressState, notifier); | |||
} else { | |||
DataConversion keyDataConversion = cache.getKeyDataConversion(); | |||
Set<Class<?>> classSet = new HashSet<>(); | |||
Set<Class<?>> classSet = new HashSet<>(keys.size()); | |||
List<CompletableFuture<Object>> updates = new ArrayList<>(keys.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to ping pong back and forth. The preferred way of doing this is with https://github.com/infinispan/infinispan/blob/main/core/src/main/java/org/infinispan/util/concurrent/CompletionStages.java#L44
This way you don't need to create another collection and the stages are as minimal as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I don't know the utility very well, I tried to see other usages and tried to use it here.
Thank for the idea @wburns. Tried to applied the change here. Let me know if we can do better... |
Merged, thanks |
can you backport to 14.0.x please _ |
sure! |
|
https://issues.redhat.com/browse/ISPN-14406