You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vladislav Pyatkov (Jira)" <ji...@apache.org> on 2024/05/27 10:47:00 UTC

[jira] [Created] (IGNITE-22335) Add assertion in async TxCleanupMessageResponse handler

Vladislav Pyatkov created IGNITE-22335:
------------------------------------------

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


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}



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