Repository navigation
IGNITE-29227 Fix lost continuous query events with an unregistered transformer result class on an ATOMIC cache - #13769
Conversation
…esult class on an ATOMIC cache
… in the async callback pool
90116a5 to
043fd72
Compare
…t and send in the async callback pool
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
5 open issues
notifyRemoteListener(...)is now executed asynchronously but receives the originalevtobject… · New This override does not callsuper.afterTest(). If the base class performs essential cleanup… · NewbeforeTestsStarted()typically callssuper.beforeTestsStarted()before starting grids so the… · New The test currently validates only the number of events and that each is aPersonId. To better… · New Use generics when instantiatingCacheConfigurationto avoid raw types and unchecked warnings… · New
What changed in this PR
Fixes an issue where ContinuousQueryWithTransformer on an ATOMIC cache could lose/hold remote transformed events when the transformer result class is unregistered on the primary node.
Changes:
- Add a regression test covering unregistered transformer result classes on
ATOMICcaches. - Refactor remote listener notification to convert transformer results and send notifications asynchronously (striped by partition) for
ATOMICcaches. - Register the new test in
IgniteCacheQuerySelfTestSuite6.
| File | Description |
|---|---|
| modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite6.java | Adds the new regression test to the indexing query test suite. |
| modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousWithTransformerUnregisteredClassTest.java | Introduces a regression test that reproduces and validates the fix for lost remote transformed events. |
| modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java | Splits remote notification to run cache-object conversion + send in the async callback pool for ATOMIC caches. |
Review effort: Lite
| @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { | ||
| IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); | ||
|
|
||
| CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); |
| log.debug("Failed to send event notification to node, node left cluster " + | ||
| "[node=" + nodeId + ", err=" + ex + ']'); | ||
| } | ||
| catch (IgniteCheckedException ex) { |
There was a problem hiding this comment.
runtime error currently will be silently ignored, can you catch Exception here ?
| * @param trans Transformer. | ||
| * @param transVal Transformer result. | ||
| * @param evt Event to transform. | ||
| * @return Entry contains only transformed data if transformer exists. Unchanged event if transformer is not set. |
There was a problem hiding this comment.
| * @return Entry contains only transformed data if transformer exists. Unchanged event if transformer is not set. | |
| * @return Entry contains only transformed data if transformer exists. |
| // calls this listener under the topology lock, where registration is not allowed, so the conversion and | ||
| // sending are done in the async callback pool, ordered by partition. | ||
| if (trans != null && cctx.atomic() && !asyncCb) { | ||
| ctx.pools().asyncCallbackPool().execute( |
There was a problem hiding this comment.
Seems you can use a pool only if exception is raized : 99.99% are going into old path also cctx.atomic() && !asyncCb will become redundant:
smth like:
try {
entry = transformToEntry(transVal, evt);
}
catch (UnregisteredClassException | UnregisteredBinaryTypeException ex) {
ctx.pools().asyncCallbackPool().execute(() ->
notifyRemoteListener(cctx, evt, transVal), evt.partitionId());
}
…sult class is unregistered
| try { | ||
| entry = transformToEntry(transVal, evt); | ||
| } | ||
| catch (UnregisteredClassException | UnregisteredBinaryTypeException ex) { |
|
@rezataroosheh thanks ! Seems we need additional tcbot viza and I will merge it. |
|
@zstan, thanks for the review and the suggestions! I've started the pipeline to get the TC Bot visa, and I'll add it to the ticket when it's done. |
Possible compatibility issues. Please, check rolling upgrade casesThis PR modifies protected classes (with Order annotation). Affected files:
|


JIRA: https://issues.apache.org/jira/browse/IGNITE-29227
What
A
ContinuousQueryWithTransformeron anATOMICcache now delivers the events of a partition whose primary is another node when the class of the transformer result is not yet registered on that node. Before this fix, the listener got none of these events, and later events of the same partition were held as well.Why
On the primary node, an
ATOMICupdate notifies the continuous query while it holds the topology read lock. For a listener on another node,CacheContinuousQueryHandler#transformToEntryconverts the transformer result to a cache object. Registering a new class is not allowed under the topology lock, so the conversion throwsUnregisteredClassExceptionpart-way through the notification.GridDhtAtomicCachethen registers the class and retries the update with the next update counter. The event for the first counter is never sent, soCacheContinuousQueryPartitionRecoveryon the listener node holds the partition's later events, waiting for it. It was reported on the dev list.The fix keeps the existing path and uses the async callback pool only when the class is not registered:
P2PClassLoadingFailureHandlingTest).UnregisteredClassExceptionorUnregisteredBinaryTypeException, the conversion and sending (the newnotifyRemoteListener) are retried in the async callback pool, striped by partition. This runs outside the topology lock, so the class can be registered there.CacheContinuousQueryEventBufferandCacheContinuousQueryPartitionRecoveryorder them by update counter.For a listener on another node, a runtime error while converting or sending is now logged instead of reaching the update thread. Listeners on the primary node keep their current behavior.
Workaround for current versions: a remote filter annotated with
@IgniteAsyncCallbackthat accepts all events. With it, the test below passes without the fix.Related: IGNITE-29226 (same reporter, remote transformed events on a keep-binary cache), PR #13770.
Tests
CacheContinuousWithTransformerUnregisteredClassTest#testUnregisteredResultClassOnAtomicCache, with two server nodes and anATOMICcache with one backup. The query runs on the first node, and a key whose primary is the second node is put 3 times with the values 1, 2, and 3. The transformer returnsPerson, a class that is not registered yet, built from the value. The test checks that all 3 events arrive asPerson, in order. It fails without the fix (Received: []).P2PClassLoadingFailureHandlingTestpasses unchanged.The Contribution Checklist
The description explains WHAT and WHY was made instead of HOW.
The following pattern must be used:
IGNITE-XXXX Change summarywhereXXXX- number of JIRA issue.(see the Maintainers list)
the
green visaattached to the JIRA ticket (see tabPR Checkat TC.Bot - Instance 1 or TC.Bot - Instance 2)Notes
If you need any help, please email dev@ignite.apache.org or ask any advice on https://the-asf.slack.com #ignite channel.