[ 
https://issues.apache.org/jira/browse/IGNITE-22335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladislav Pyatkov updated IGNITE-22335:
---------------------------------------
    Description: 
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}

  was:
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 dos not inhereted 
form  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}


> 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
>            Priority: Major
>              Labels: ignite-3
>
> 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