rpuch commented on code in PR #5407:
URL: https://github.com/apache/ignite-3/pull/5407#discussion_r1995599750


##########
modules/table/src/testFixtures/java/org/apache/ignite/distributed/ItTxTestCluster.java:
##########
@@ -275,6 +282,10 @@ public class ItTxTestCluster {
 
     protected String localNodeName;
 
+    private Map<String, Map<ZonePartitionId, ZonePartitionRaftListener>> 
zonePartitionRaftGroupListeners = new HashMap<>();
+
+    private Map<String, Map<ZonePartitionId, ZonePartitionReplicaListener>> 
zonePartitionReplicaListeners = new HashMap<>();

Review Comment:
   ```suggestion
       private final Map<String, Map<ZonePartitionId, 
ZonePartitionRaftListener>> zonePartitionRaftGroupListeners = new HashMap<>();
   
       private final Map<String, Map<ZonePartitionId, 
ZonePartitionReplicaListener>> zonePartitionReplicaListeners = new HashMap<>();
   ```



##########
modules/table/src/testFixtures/java/org/apache/ignite/distributed/ItTxTestCluster.java:
##########
@@ -836,6 +845,210 @@ private static String extractConsistentId(ClusterService 
nodeService) {
         return nodeService.topologyService().localMember().name();
     }
 
+    /**
+     * If colocation is enabled given method creates zone raft listener for 
specific zone partition if it wasn't created previously and
+     * populate it with table raft processor. If colocation is disabled given 
method will create table raft listener.

Review Comment:
   ```suggestion
        * populates it with table raft processor. If colocation is disabled 
given method will create table raft listener.
   ```



##########
modules/table/src/testFixtures/java/org/apache/ignite/distributed/ItTxTestCluster.java:
##########
@@ -275,6 +282,10 @@ public class ItTxTestCluster {
 
     protected String localNodeName;
 
+    private Map<String, Map<ZonePartitionId, ZonePartitionRaftListener>> 
zonePartitionRaftGroupListeners = new HashMap<>();
+
+    private Map<String, Map<ZonePartitionId, ZonePartitionReplicaListener>> 
zonePartitionReplicaListeners = new HashMap<>();

Review Comment:
   Are these maps always accessed from the same thread?



##########
modules/table/src/testFixtures/java/org/apache/ignite/distributed/ItTxTestCluster.java:
##########
@@ -836,6 +845,210 @@ private static String extractConsistentId(ClusterService 
nodeService) {
         return nodeService.topologyService().localMember().name();
     }
 
+    /**
+     * If colocation is enabled given method creates zone raft listener for 
specific zone partition if it wasn't created previously and
+     * populate it with table raft processor. If colocation is disabled given 
method will create table raft listener.
+     */
+    // TODO https://issues.apache.org/jira/browse/IGNITE-24798 Simplify after 
switching main towards colocation.
+    private RaftGroupListener getOrCreateAndPopulateRaftGroupListener(
+            String assignment,
+            int zoneId,
+            int partId,
+            int tableId,
+            PartitionDataStorage partitionDataStorage,
+            StorageUpdateHandler storageUpdateHandler,
+            TxStatePartitionStorage txStateStorage,
+            SafeTimeValuesTracker safeTimeTracker,
+            PendingComparableValuesTracker<Long, Void> storageIndexTracker,
+            CatalogService catalogService,
+            SchemaRegistry schemaRegistry
+    ) {
+        if (enabledColocation()) {
+            ZonePartitionId zonePartitionId = new ZonePartitionId(zoneId, 
partId);
+
+            var nodeSpecificZonePartitionRaftGroupListeners = 
zonePartitionRaftGroupListeners.computeIfAbsent(assignment,

Review Comment:
   Could you please replace `var` with explicit type here? It's very difficult 
to realize what the type is



##########
modules/replicator/src/testFixtures/java/org/apache/ignite/internal/replicator/ReplicaTestUtils.java:
##########
@@ -37,29 +39,31 @@ public final class ReplicaTestUtils {
      * Returns raft-client if exists.
      *
      * @param node Ignite node that hosts the raft-client.
-     * @param tableId Desired table's ID.
+     * @param tableOrZoneId Desired table or zone ID.
      * @param partId Desired partition's ID.
      *
      * @return Optional with raft-client if exists on the node by given 
identifiers.
      */
     @TestOnly
-    public static Optional<RaftGroupService> getRaftClient(Ignite node, int 
tableId, int partId) {
-        return getRaftClient(getReplicaManager(node), tableId, partId);
+    // TODO https://issues.apache.org/jira/browse/IGNITE-22522 tableOrZoneId 
-> zoneId
+    public static Optional<RaftGroupService> getRaftClient(Ignite node, int 
tableOrZoneId, int partId) {
+        return getRaftClient(getReplicaManager(node), tableOrZoneId, partId);
     }
 
     /**
      * Returns raft-client if exists.
      *
      * @param replicaManager Ignite node's replica manager with replica that 
should contains a raft client.
-     * @param tableId Desired table's ID.
+     * @param tableOrZoneId Desired table or zone ID.
      * @param partId Desired partition's ID.
      *
      * @return Optional with raft-client if exists on the node by given 
identifiers.
      */
     @TestOnly
-    public static Optional<RaftGroupService> getRaftClient(ReplicaManager 
replicaManager, int tableId, int partId) {
+    // TODO https://issues.apache.org/jira/browse/IGNITE-22522 tableOrZoneId 
-> zoneId
+    public static Optional<RaftGroupService> getRaftClient(ReplicaManager 
replicaManager, int tableOrZoneId, int partId) {

Review Comment:
   In an earlier change, I added `getZoneRaftClient()` leaving 
`getRaftClient()` table-oriented, so the caller would decide which method to 
call. You chose a different approach by modifying `getRaftClient()` and making 
it universal. Could you please also replace `getZoneRaftClient()` usages with 
the universal `getRaftClient()`?



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