[ 
https://issues.apache.org/jira/browse/IGNITE-21644?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17824812#comment-17824812
 ] 

Alexander Lapin commented on IGNITE-21644:
------------------------------------------

@Aleksandr Belyak Test code is incoorect. putAllAsync aren’t linearized because 
second putAllAsync as method param is evaluated on method call and not within 
thenCompose. It’s possible to either rewrite thenCompose method or e.g. use 
Supplier in order to evaluate second putAll in a lazy manner. First option is 
better, having such method is error prone.

Besides lack of linearization thenCompose method doesn’t return result of 
fut.thenCompose(r -> fn); thus you actually await only first operation result. 
Please use return `fut.thenCompose() instead.`

> Deadlock prevention makes Java Async APIs (KV/RV) hard to use
> -------------------------------------------------------------
>
>                 Key: IGNITE-21644
>                 URL: https://issues.apache.org/jira/browse/IGNITE-21644
>             Project: Ignite
>          Issue Type: Bug
>          Components: persistence
>    Affects Versions: 3.0
>            Reporter: Alexander Belyak
>            Priority: Critical
>
> # Create table T1
>  # Get KeyValue view or Record View
>  # Make a batch of 100 rows and call CompletableFuture f = 
> view.putAllAsync(null , batch) or view.
> upsertAllAsync(null, batch)
>  # Make another batch and compose it with the first CompletableFuture with: 
> f.thenCompose(r -> view.putAllAsync(null, newBatch));
> Expected behavior: batch completed sucessfully.
> Actual behavior: Failed to acquire a lock due to a possible deadlock



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to