[ https://issues.apache.org/jira/browse/IGNITE-23541?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julia Bakulina resolved IGNITE-23541. ------------------------------------- Resolution: Won't Fix > Extend description of IgniteTxManager#checkEmptyTransactions() > -------------------------------------------------------------- > > Key: IGNITE-23541 > URL: https://issues.apache.org/jira/browse/IGNITE-23541 > Project: Ignite > Issue Type: Task > Reporter: Julia Bakulina > Assignee: Julia Bakulina > Priority: Minor > Labels: ise > Time Spent: 10m > Remaining Estimate: 0h > > It will be useful to add the info to the docs that the checks below are not > equivalent and for some cases the 2nd check should be chosen. > {code:java} > 1) IgniteTxManager#checkEmptyTransactions() > 2) ctx.grid().transactions().tx() != null;{code} > The reason is that GridCacheMvccManager#pendingExplicit contains the mapping > of Thread ID to value using IgniteTxManager#checkEmptyTransactions. > [https://github.com/apache/ignite/blob/afe24bed52ba4071b1b7d846947c325e4e4e518b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java#L912] > _________________ > If to replace 2) with 1) in GridCacheAdapter#clear() as it was in > IGNITE-23110 there will be failed tests in GridCacheAbstractFullApiSelfTest > for testClear() althrough IgniteCache#clear() is not thrown within > transaction. The 1st condition is false while the 2nd is true. > {code:java} > 1) userTx() != null > 2) cctx.lockedTopologyVersion(null) != null{code} > {code:java} > /** {@inheritDoc} */ > @Override public void clear() throws IgniteCheckedException { > if (ctx.transactional()) { > ctx.tm().checkEmptyTransactions(() -> > format(String.format(NON_TRANSACTIONAL_IGNITE_CACHE_CLEAR_IN_TX_ERROR_MESSAGE))); > } > clear((Set<? extends K>)null); > } > {code} > {code:java} > public void checkEmptyTransactions(@NotNull IgniteOutClosure<String> > errMsgConstructor) { > if (userTx() != null || cctx.lockedTopologyVersion(null) != null) > throw new IgniteException(errMsgConstructor.apply()); > }{code} -- This message was sent by Atlassian Jira (v8.20.10#820010)