sashapolo commented on code in PR #1366:
URL: https://github.com/apache/ignite-3/pull/1366#discussion_r1033467942


##########
modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTxDistributedTestSingleNode.java:
##########
@@ -366,43 +360,36 @@ public void before() throws Exception {
      */
     protected Int2ObjectOpenHashMap<RaftGroupService> startTable(String name, 
UUID tblId)
             throws Exception {
-        List<List<ClusterNode>> assignment = 
RendezvousAffinityFunction.assignPartitions(
-                cluster.stream().map(node -> 
node.topologyService().localMember())
-                        .collect(toList()),
+        List<Set<Assignment>> assignments = AffinityUtils.calculateAssignments(
+                cluster.stream().map(node -> 
node.topologyService().localMember()).collect(toList()),
                 1,
-                replicas(),
-                false,
-                null
+                replicas()
         );
 
-        Map<ClusterNode, Function<Peer, Boolean>> isLocalPeerCheckerList = 
cluster.stream()
-                .map(ClusterService::topologyService)
-                .collect(toMap(
-                        TopologyService::localMember,
-                        ts -> peer -> 
ts.getByConsistentId(peer.consistentId()).equals(ts.localMember())
-                ));
-
         Int2ObjectOpenHashMap<RaftGroupService> clients = new 
Int2ObjectOpenHashMap<>();
 
         List<CompletableFuture<Void>> partitionReadyFutures = new 
ArrayList<>();
 
-        for (int p = 0; p < assignment.size(); p++) {
-            List<ClusterNode> partNodes = assignment.get(p);
+        for (int p = 0; p < assignments.size(); p++) {
+            Set<Assignment> partAssignments = assignments.get(p);
 
             TablePartitionId grpId = new TablePartitionId(tblId, p);
 
-            List<Peer> conf = partNodes.stream().map(n -> new Peer(n.name()))
-                    .collect(toList());
+            List<Peer> conf = partAssignments.stream().map(a -> new 
Peer(a.consistentId())).collect(toList());
+
+            for (Assignment assignment : partAssignments) {
+                String nodeName = assignment.consistentId();
 
-            for (ClusterNode node : partNodes) {
                 var testMpPartStorage = new TestMvPartitionStorage(0);
                 var txStateStorage = new TestTxStateStorage();
-                var placementDriver = new 
PlacementDriver(replicaServices.get(node));
+                var placementDriver = new 
PlacementDriver(replicaServices.get(nodeName), consistentIdToNode);
 
-                for (int part = 0; part < assignment.size(); part++) {
+                for (int part = 0; part < assignments.size(); part++) {

Review Comment:
   I've simplified the code a little bit



-- 
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]

Reply via email to