Nikita Amelchev created IGNITE-29273:
----------------------------------------
Summary: Fix node failure on a backup commit that updates a near
cache entry during rebalancing
Key: IGNITE-29273
URL: https://issues.apache.org/jira/browse/IGNITE-29273
Project: Ignite
Issue Type: Bug
Reporter: Nikita Amelchev
Assignee: Nikita Amelchev
`GridCacheNearTxMultiNodeSelfTest#testTxCleanup` logs a critical failure caused
by `ClassCastException: GridDhtTxRemote cannot be cast to IgniteTxLocalAdapter`
([TC](https://ci2.ignite.apache.org/buildConfiguration/IgniteTests24Java8_CacheFullApi/9487917?buildTab=log&logView=flowAware&linesState=1181.1252&focusLine=3055))
and passes only because the test uses `NoOpFailureHandler`. With the default
failure handler, the node is stopped.
During rebalancing, a former backup leaves the key affinity but keeps owning
the partition until rebalancing completes, so it still commits the key updates
as a `GridDhtTxRemote`. If the node also holds a near entry for the key, for
example after its own transactional write, the commit refreshes the near entry
with the expire time and TTL of the committed entry, and
`GridCacheMapEntry#expireTime` looks up the current local transaction via
`IgniteTxManager#localTx`. The thread transaction context is the remote
transaction at that moment, and `localTx` casts it to `IgniteTxLocalAdapter`
before the `local()` check. The commit ends with
`IgniteTxHeuristicCheckedException` and a `CRITICAL_ERROR`.
`IgniteTxManager#localTx` checks `local()` before the cast, so a remote
transaction commit reads the expire time and TTL from the entry itself.
`GridCacheNearTxMultiNodeSelfTest#testTxCleanup` now checks that no critical
failure occurred. The scenario depends on the timing of the late affinity
assignment after the cluster start, so the test does not reproduce it in every
run.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)