J-Bakuli commented on code in PR #11559:
URL: https://github.com/apache/ignite/pull/11559#discussion_r1814827480


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java:
##########
@@ -1059,6 +1059,10 @@ public List<GridCacheClearAllRunnable<K, V>> 
splitClearLocally(boolean srv, bool
 
     /** {@inheritDoc} */
     @Override public void clear() throws IgniteCheckedException {
+        if (ctx.transactional() && ctx.grid().transactions().tx() != null)

Review Comment:
   27 tests with IgniteCache.clear() fail in GridCacheAbstractFullApiSelfTest 
with 11222 tests in total. For instance, 
https://github.com/J-Bakuli/ignite/blob/03bbc2dce83cba0bdf5910532e64a2f6660fadab/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java#L3786
   
   IgniteCache.clear() is invoked not within a transaction in that tests. 
However, it is invoked within a test with if-condition. 
   <img width="709" alt="Снимок экрана 2024-10-24 в 14 49 26" 
src="https://github.com/user-attachments/assets/8ce17333-c765-47fc-bbfa-92dc48dbcfec";>
   
   As a result, the second condition is true thus the exception is thrown
   ```
       /**
        * Method checks that current thread does not have active transactions.
        * If transaction or topology lock is hold by current thread
        * exception {@link IgniteException} with given {@code 
errMsgConstructor} message will be thrown.
        *
        * @param errMsgConstructor Error message constructor.
        */
       public void checkEmptyTransactions(@NotNull IgniteOutClosure<String> 
errMsgConstructor) {
           if (userTx() != null || cctx.lockedTopologyVersion(null) != null)
               throw new IgniteException(errMsgConstructor.apply());
       }
   ```
   



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to