Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-20553 Add await self in local logical topology logic to node startup procedure #3220

Merged
merged 10 commits into from
Feb 23, 2024

Conversation

sanpwc
Copy link
Contributor

@sanpwc sanpwc commented Feb 15, 2024

https://issues.apache.org/jira/browse/IGNITE-20553

  • Await self in logical topology logic added withih node start.
  • Fix missing update of a CMG raft client peersAndLearners after rebalance.

…-20553

# Conflicts:
#	modules/placement-driver/src/integrationTest/java/org/apache/ignite/internal/placementdriver/ActiveActorTest.java
@sanpwc sanpwc closed this Feb 23, 2024
@sanpwc sanpwc deleted the ignite-20553 branch February 23, 2024 07:39
@sanpwc sanpwc restored the ignite-20553 branch February 23, 2024 07:43
@sanpwc sanpwc reopened this Feb 23, 2024
@sanpwc sanpwc changed the title IGNITE-21553 Add await self in local logical topology logic to node startup procedure IGNITE-20553 Add await self in local logical topology logic to node startup procedure Feb 23, 2024
/**
* Retrieves the current logical topology snapshot stored in the local storage.
*/
LogicalTopologySnapshot getLogicalTopology();
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to reflect it in the name of the method that the topology is returned based on the local view of the node? Like localLogicalTopology().

Also, get prefix does not match the style of logicalTopologyOnLeader(): they should both have get prefix, or none of them should have it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agee. I've used the mehod naming from internals, but you proposal looks reasonable.

LogicalTopologyEventListener awaitSelfListener = new LogicalTopologyEventListener() {
@Override
public void onNodeJoined(LogicalNode joinedNode, LogicalTopologySnapshot newTopology) {
if (newTopology.nodes().stream().map(LogicalNode::id).collect(Collectors.toSet()).contains(id())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If toSet is imported statically, this will read nicely in plain English: 'collect to set'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

@@ -990,6 +994,37 @@ public CompletableFuture<Ignite> start(Path configPath) {

return cmgMgr.onJoinReady();
}, startupExecutor)
.thenComposeAsync(ignored -> {
CompletableFuture<Void> awaitSelfInLogicalTopologyFuture = new CompletableFuture<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to extract this as a method? The method in which this code is defined is already huge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, make sense.


@Override
public void onTopologyLeap(LogicalTopologySnapshot newTopology) {
if (newTopology.nodes().stream().map(LogicalNode::id).collect(Collectors.toSet()).contains(id())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like there are 3 duplicates of this code, it it possible to extract them to methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't think that it's really needed, taking into considiration that everething inside thenCompose will be extracted I'd rather left inner duplication as is. However if you will intend I'll also add a private helper for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, will add inner method.

@sanpwc sanpwc merged commit df69853 into apache:main Feb 23, 2024
1 check passed
@sanpwc sanpwc deleted the ignite-20553 branch February 23, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants