Skip to content

IGNITE-26111 TcpDiscoverySpi uses MessageSerializer#12243

Merged
timoninmaxim merged 12 commits intoapache:masterfrom
timoninmaxim:IGNITE-26111__discovery_serialization
Nov 13, 2025
Merged

IGNITE-26111 TcpDiscoverySpi uses MessageSerializer#12243
timoninmaxim merged 12 commits intoapache:masterfrom
timoninmaxim:IGNITE-26111__discovery_serialization

Conversation

@timoninmaxim
Copy link
Copy Markdown
Member

Thank you for submitting the pull request to the Apache Ignite.

In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:

The Contribution Checklist

  • There is a single JIRA ticket related to the pull request.
  • The web-link to the pull request is attached to the JIRA ticket.
  • The JIRA ticket has the Patch Available state.
  • The pull request body describes changes that have been made.
    The description explains WHAT and WHY was made instead of HOW.
  • The pull request title is treated as the final commit message.
    The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • A reviewer has been mentioned through the JIRA comments
    (see the Maintainers list)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see TC.Bot: Check PR)

Notes

If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.

@timoninmaxim timoninmaxim force-pushed the IGNITE-26111__discovery_serialization branch 6 times, most recently from 468d8ce to edd7a32 Compare August 12, 2025 08:22
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
5 New Code Smells (required ≤ 1)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about an idea to move this spi implementation to a more general package (maybe even some utility one)?

Though I understand why this class sits somewhere in persistence package tree, it still feels weird to me to see a discovery implementation in that tree.

private static final byte[] MESSAGE_SERIALIZATION = new byte[] { 1 };

/** */
private static final ThreadLocal<MessageIoSession> locSes = new ThreadLocal<>();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach with ThreadLocal holding MessageIoSession objects looks confusing to me: it makes less obvious what this code is doing. I believe better way to express this logic is to create a client-like object which would be responsible for sending and receiving messages, allocating buffers and making connection-related checks like an SSL checks.

Could you please create a ticket and add it as a TODO here?


/** {@inheritDoc} */
@Override public void setMessageFactory(MessageFactory msgFactory) {
// Np-op.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Np-op instead of No-op. I believe you'be made this typo when thinking really hard about P vs NP problem :)

DiscoverySpi spi = getSpi();

spi.setNodeAttributes(ctx.nodeAttributes(), VER);
spi.setMessageFactory(ctx.io().messageFactory());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now it is okay I guess to reuse existing messageFactory, but for the future I would split discovery messages factory into a separate entity. I don't know why but I don't like the idea of mixing two sets of messages in one place. One reason for that is that a separate message factory should provide you with some kind of a separate namespace for messages and enables you to pick new messages' directTypes independently from communication messages without risks of mixing two types together.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will create a separate MessageFactory for discovery

@timoninmaxim timoninmaxim force-pushed the IGNITE-26111__discovery_serialization branch from edd7a32 to 3e81a15 Compare September 4, 2025 12:47
@timoninmaxim timoninmaxim force-pushed the IGNITE-26111__discovery_serialization branch from bcd3ac0 to 016f4a3 Compare November 1, 2025 20:49
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
5 New Code Smells (required ≤ 1)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@timoninmaxim timoninmaxim merged commit a1abd2c into apache:master Nov 13, 2025
8 of 9 checks passed
@timoninmaxim timoninmaxim deleted the IGNITE-26111__discovery_serialization branch November 13, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants