JAkutenshi commented on code in PR #4545:
URL: https://github.com/apache/ignite-3/pull/4545#discussion_r1801074573
##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/impl/MetaStorageManagerImpl.java:
##########
@@ -462,28 +464,30 @@ private CompletableFuture<? extends RaftGroupService>
startRaftNode(
}
);
- serviceFuture
- .thenAccept(service -> service.subscribeLeader(new
MetaStorageLeaderElectionListener(
- busyLock,
- clusterService,
- logicalTopologyService,
- metaStorageSvcFut,
- learnerManager,
- clusterTime,
- // We use the "deployWatchesFuture" to guarantee that
the Configuration Manager will be started
- // when the underlying code tries to read Meta Storage
configuration. This is a consequence of having a circular
- // dependency between these two components.
- deployWatchesFuture.thenApply(v ->
localMetaStorageConfiguration),
- electionListeners,
- this::peersChangeStateExists
- )))
- .whenComplete((v, e) -> {
+ LeaderElectionListener leaderElectionListener = new
MetaStorageLeaderElectionListener(
+ busyLock,
+ clusterService,
+ logicalTopologyService,
+ metaStorageSvcFut,
+ learnerManager,
+ clusterTime,
+ // We use the "deployWatchesFuture" to guarantee that the
Configuration Manager will be started
+ // when the underlying code tries to read Meta Storage
configuration. This is a consequence of having a circular
+ // dependency between these two components.
+ deployWatchesFuture.thenApply(v ->
localMetaStorageConfiguration),
+ electionListeners,
+ this::peersChangeStateExists
+ );
+
+ return completedFuture(service)
Review Comment:
Ha, I remember this place and I did at like you do first. But then there are
tonns of tests that doesn't mock `subscribeLeader` that leads to `null` instead
of any future objects ([failed build
example](https://ci.ignite.apache.org/buildConfiguration/ApacheIgnite3xGradle_Test_RunAllTests/8542386?expandBuildDeploymentsSection=false&hideTestsFromDependencies=false&hideProblemsFromDependencies=false&expandCode+Inspection=true&expandBuildChangesSection=true&expandBuildProblemsSection=true)).
So, if there will be a future as the result in any case, I decided to left
future wrapping over the service there. May be the better way is to place mocks
in all of these cases.. if it is, so I'd better to do a follow up ticket.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]