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

Vladislav Pyatkov commented on IGNITE-22335:
--------------------------------------------

Merged 78a976b1129ab2039b1f1bc1e006a932a93cc293

> Add assertion in async TxCleanupMessageResponse handler
> -------------------------------------------------------
>
>                 Key: IGNITE-22335
>                 URL: https://issues.apache.org/jira/browse/IGNITE-22335
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Vladislav Pyatkov
>            Assignee:  Kirill Sizov
>            Priority: Major
>              Labels: ignite-3
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> h3. Motivation
> This code seems like we might send TxCleanupMessageResponse with nullabe 
> correlationId and result, but it is not really possible.
> {code:java}
> txMessageSender.messagingService().addMessageHandler(TxMessageGroup.class, 
> (msg, sender, correlationId) -> {
>             if (msg instanceof TxCleanupMessageResponse && correlationId == 
> null) {
>                 CleanupReplicatedInfo result = ((TxCleanupMessageResponse) 
> msg).result();
>                 if (result != null) {
>                     onCleanupReplicated(result);
>                 }
>                 if (msg instanceof TxCleanupMessageErrorResponse) {
>                     TxCleanupMessageErrorResponse response = 
> (TxCleanupMessageErrorResponse) msg;
>                     LOG.warn("Exception happened during transaction cleanup 
> [txId={}].", response.throwable(), response.txId());
>                 }
>             }
>         });
> {code}
> h3. Definition of done
> It just a possible siple improvment (but even better to change the responce 
> inheratence structure, as the TxCleanupMessageErrorResponse does not inherit 
> from TxCleanupMessageResponse):
> {code:java}
> txMessageSender.messagingService().addMessageHandler(TxMessageGroup.class, 
> (msg, sender, correlationId) -> {
>             if (msg instanceof TxCleanupMessageResponse && correlationId == 
> null) {
>                 CleanupReplicatedInfo result = ((TxCleanupMessageResponse) 
> msg).result();
>                 if (msg instanceof TxCleanupMessageErrorResponse) {
>                     TxCleanupMessageErrorResponse response = 
> (TxCleanupMessageErrorResponse) msg;
>                     LOG.warn("Exception happened during transaction cleanup 
> [txId={}].", response.throwable(), response.txId());
>                 }
>                 assert result != null : "Result for the cleanup response 
> cannot be null.";
>                 onCleanupReplicated(result);
>             }
>         });
> {code}



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

Reply via email to