EdShangGG commented on a change in pull request #6330: IGNITE-11592 NPE in case 
of continuing tx and cache stop operation
URL: https://github.com/apache/ignite/pull/6330#discussion_r285575941
 
 

 ##########
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
 ##########
 @@ -3232,10 +3234,61 @@ public void onExchangeDone(
                 ((GridServiceProcessor)ctx.service()).updateUtilityCache();
         }
 
+        rollbackCoveredTx(exchActions);
+
         if (err == null)
             processCacheStopRequestOnExchangeDone(exchActions);
     }
 
+    /**
+     * Rollback tx covered by stopped caches.
+     *
+     * @param exchActions Change requests.
+     */
+    private void rollbackCoveredTx(ExchangeActions exchActions) {
+        Set<Integer> cachesToStop;
+
+        if (!exchActions.cacheGroupsToStop().isEmpty() || 
!exchActions.cacheStopRequests().isEmpty()) {
+            cachesToStop = new HashSet<>();
+
+            for (ExchangeActions.CacheGroupActionData act : 
exchActions.cacheGroupsToStop()) {
+                @Nullable CacheGroupContext grpCtx = 
context().cache().cacheGroup(act.descriptor().groupId());
+
+                if (grpCtx != null && grpCtx.sharedGroup())
+                    cachesToStop.addAll(grpCtx.cacheIds());
+            }
+
+            for (ExchangeActions.CacheActionData act : 
exchActions.cacheStopRequests())
+                cachesToStop.add(act.descriptor().cacheId());
+
+            if (!cachesToStop.isEmpty()) {
+                IgniteTxManager tm = context().tm();
+
+                Collection<IgniteInternalTx> active = tm.activeTransactions();
 
 Review comment:
   I believe that this code should be in tx manager itself. 
   Why GridCacheProcessor should know about the internals of TxManager?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to