sanpwc commented on code in PR #4090:
URL: https://github.com/apache/ignite-3/pull/4090#discussion_r1705476530
##########
modules/table/src/testFixtures/java/org/apache/ignite/distributed/ItTxTestCluster.java:
##########
@@ -673,112 +696,72 @@ public TableViewInternal startTable(String tableName,
SchemaDescriptor schemaDes
mock(IndexMetaStorage.class)
);
- CompletableFuture<Void> partitionReadyFuture =
raftServers.get(assignment).startRaftGroupNode(
- new RaftNodeId(grpId, configuration.peer(assignment)),
- configuration,
- partitionListener,
- RaftGroupEventsListener.noopLsnr,
- topologyAwareRaftGroupServiceFactory
- ).thenAccept(
- raftSvc -> {
- PartitionReplicaListener listener =
newReplicaListener(
- mvPartStorage,
- raftSvc,
- txManagers.get(assignment),
- Runnable::run,
- partId,
- tableId,
- () -> Map.of(pkLocker.id(), pkLocker),
- pkStorage,
- Map::of,
- clockServices.get(assignment),
- safeTime,
- txStateStorage,
- transactionStateResolver,
- storageUpdateHandler,
- new
DummyValidationSchemasSource(schemaManager),
-
nodeResolver.getByConsistentId(assignment),
- new AlwaysSyncedSchemaSyncService(),
- catalogService,
- placementDriver,
- nodeResolver,
- cursorRegistries.get(assignment),
- schemaManager
- );
-
- replicaManagers.get(assignment).startReplica(
- new TablePartitionId(tableId, partId),
- storageIndexTracker,
- completedFuture(listener)
- );
- }
+ Function<RaftGroupService, ReplicaListener>
createReplicaListener = raftClient -> newReplicaListener(
+ mvPartStorage,
+ raftClient,
+ txManagers.get(assignment),
+ Runnable::run,
+ partId,
+ tableId,
+ () -> Map.of(pkLocker.id(), pkLocker),
+ pkStorage,
+ Map::of,
+ clockServices.get(assignment),
+ safeTime,
+ txStateStorage,
+ transactionStateResolver,
+ storageUpdateHandler,
+ new DummyValidationSchemasSource(schemaManager),
+ nodeResolver.getByConsistentId(assignment),
+ new AlwaysSyncedSchemaSyncService(),
+ catalogService,
+ placementDriver,
+ nodeResolver,
+ cursorRegistries.get(assignment),
+ schemaManager
);
+ CompletableFuture<Void> partitionReadyFuture =
replicaManagers.get(assignment)
+ .startReplica(
+ RaftGroupEventsListener.noopLsnr,
+ partitionListener,
+ false,
+ null,
+ createReplicaListener,
+ storageIndexTracker,
+ grpId,
+ configuration
+ )
+ .thenAccept(unused -> { });
+
partitionReadyFutures.add(partitionReadyFuture);
}
- PeersAndLearners membersConf =
PeersAndLearners.fromConsistentIds(partAssignments);
-
- if (startClient) {
- RaftGroupService service = RaftGroupServiceImpl
- .start(grpId, client, FACTORY, raftConfig,
membersConf, true, executor, commandsMarshaller)
- .get(5, TimeUnit.SECONDS);
+ // waiting for started replicas otherwise we would have NPE on
{@link Replica#replica} call below
+ allOf(partitionReadyFutures.toArray(new
CompletableFuture[0])).join();
Review Comment:
It's strange to have same line
`allOf(partitionReadyFutures.toArray(new CompletableFuture[0])).join();`
twice. 741 and 756
--
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]