xtern commented on code in PR #2982:
URL: https://github.com/apache/ignite-3/pull/2982#discussion_r1445713745


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/mapping/MappingServiceImpl.java:
##########
@@ -96,12 +109,53 @@ public CompletableFuture<List<MappedFragment>> 
map(MultiStepPlan multiStepPlan)
         return initialTopologyFuture.thenComposeAsync(ignore -> 
map0(multiStepPlan), taskExecutor);
     }
 
+    /** Called when the primary replica has expired. */
+    public CompletableFuture<Boolean> 
onPrimaryReplicaExpired(PrimaryReplicaEventParameters parameters) {
+        assert parameters != null;
+        assert parameters.groupId() instanceof TablePartitionId;
+
+        int tabId = ((TablePartitionId) parameters.groupId()).tableId();
+
+        // TODO https://issues.apache.org/jira/browse/IGNITE-21201 Move 
complex computations to a different thread.
+        mappingsCache.values().removeIf(value -> 
value.tableIds.contains(tabId));
+
+        return CompletableFutures.falseCompletedFuture();
+    }
+
     private CompletableFuture<List<MappedFragment>> map0(MultiStepPlan 
multiStepPlan) {
-        List<String> nodes = topologyHolder.nodes();
-        MappingContext context = new MappingContext(localNodeName, nodes);
+        TopSnapshot topology = topologyHolder.topology();
+        MappingContext context = new MappingContext(localNodeName, 
topology.nodes());
 
         FragmentsTemplate template = getOrCreateTemplate(multiStepPlan, 
context);
 
+        MappingsCacheValue cacheValue = 
mappingsCache.compute(multiStepPlan.id(), (key, val) -> {
+            if (val == null) {
+                IntSet tableIds = new IntOpenHashSet();
+                boolean topAware = false;

Review Comment:
   Done



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