[
https://issues.apache.org/jira/browse/IGNITE-29226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Reza Taroosheh updated IGNITE-29226:
------------------------------------
Description:
A {{ContinuousQueryWithTransformer}} registered on {{cache.withKeepBinary()}}
gives its local listener the transformer's result class only for keys whose
primary is the listener's node. Events transformed on another node arrive as
{{BinaryObject}}, so one listener gets a mix of both, and a listener that reads
its events as the result class throws {{ClassCastException}}. Without
{{withKeepBinary()}}, every event arrives as the result class.
Steps:
# Start two server nodes with a {{PARTITIONED}} cache.
# On node 0, register a {{ContinuousQueryWithTransformer}} on
{{cache.withKeepBinary()}}, with a remote transformer that returns an object of
a user class (e.g., {{PersonId}}, built from the event's key or value).
# Put one key whose primary is node 0 and one whose primary is node 1.
Actual: the listener gets a {{PersonId}} for the first key and a
{{BinaryObjectImpl}} for the second.
Expected: a {{PersonId}} for both. Keep-binary mode controls how the
transformer receives the cache's keys and values; it should not change the
transformer's result type.
Reproduced on 2.17.0 and 2.18.0 (reported on the dev list:
https://lists.apache.org/thread/hrr9s73y6v0f853qdt63rb6dh1hjhn3t), and on
master by a new test.
The existing keep-binary tests in
{{CacheContinuousWithTransformerReplicatedSelfTest}} don't catch it: they run
on a single server node and transform to a {{String}}.
*Compatibility note: local-only queries with a transformer* ({{setLocal(true)}})
The transformer result is now converted the same way as for an event from
another node:
* With {{withKeepBinary()}}, a custom class result arrives as {{BinaryObject}}.
Before: the object itself.
* Without keep-binary, an array result arrives as {{Object[]}} (for example for
{{Integer[]}}). Primitive, {{String}}, {{UUID}}, {{BigDecimal}} and date/time
arrays are not affected. Before: the original array.
* Without keep-binary, a {{BinaryObject}} of a type that has no Java class
arrives as {{null}}, and "Failed to transform entry" is logged. Before: the
{{BinaryObject}}.
Normal queries already deliver remote events this way; local events now match
them.
was:
A {{ContinuousQueryWithTransformer}} registered on {{cache.withKeepBinary()}}
gives its local listener the transformer's result class only for keys whose
primary is the listener's node. Events transformed on another node arrive as
{{BinaryObject}}, so one listener gets a mix of both, and a listener that reads
its events as the result class throws {{ClassCastException}}. Without
{{withKeepBinary()}}, every event arrives as the result class.
Steps:
# Start two server nodes with a {{PARTITIONED}} cache.
# On node 0, register a {{ContinuousQueryWithTransformer}} on
{{cache.withKeepBinary()}}, with a remote transformer that returns an object of
a user class (e.g., {{PersonId}}, built from the event's key or value).
# Put one key whose primary is node 0 and one whose primary is node 1.
Actual: the listener gets a {{PersonId}} for the first key and a
{{BinaryObjectImpl}} for the second.
Expected: a {{PersonId}} for both. Keep-binary mode controls how the
transformer receives the cache's keys and values; it should not change the
transformer's result type.
Reproduced on 2.17.0 and 2.18.0 (reported on the dev list:
https://lists.apache.org/thread/hrr9s73y6v0f853qdt63rb6dh1hjhn3t), and on
master by a new test.
The existing keep-binary tests in
{{CacheContinuousWithTransformerReplicatedSelfTest}} don't catch it: they run
on a single server node and transform to a {{String}}.
Compatibility: the fix changes the type a listener receives for remote events
on a keep-binary cache. Code that handles {{BinaryObject}} there would get the
result class instead.
> ContinuousQueryWithTransformer on a keep-binary cache delivers a remote
> node's transformed events as BinaryObject
> -----------------------------------------------------------------------------------------------------------------
>
> Key: IGNITE-29226
> URL: https://issues.apache.org/jira/browse/IGNITE-29226
> Project: Ignite
> Issue Type: Bug
> Reporter: Reza Taroosheh
> Assignee: Reza Taroosheh
> Priority: Major
> Fix For: 2.20
>
> Time Spent: 5h 10m
> Remaining Estimate: 0h
>
> A {{ContinuousQueryWithTransformer}} registered on {{cache.withKeepBinary()}}
> gives its local listener the transformer's result class only for keys whose
> primary is the listener's node. Events transformed on another node arrive as
> {{BinaryObject}}, so one listener gets a mix of both, and a listener that
> reads its events as the result class throws {{ClassCastException}}. Without
> {{withKeepBinary()}}, every event arrives as the result class.
> Steps:
> # Start two server nodes with a {{PARTITIONED}} cache.
> # On node 0, register a {{ContinuousQueryWithTransformer}} on
> {{cache.withKeepBinary()}}, with a remote transformer that returns an object
> of a user class (e.g., {{PersonId}}, built from the event's key or value).
> # Put one key whose primary is node 0 and one whose primary is node 1.
> Actual: the listener gets a {{PersonId}} for the first key and a
> {{BinaryObjectImpl}} for the second.
> Expected: a {{PersonId}} for both. Keep-binary mode controls how the
> transformer receives the cache's keys and values; it should not change the
> transformer's result type.
> Reproduced on 2.17.0 and 2.18.0 (reported on the dev list:
> https://lists.apache.org/thread/hrr9s73y6v0f853qdt63rb6dh1hjhn3t), and on
> master by a new test.
> The existing keep-binary tests in
> {{CacheContinuousWithTransformerReplicatedSelfTest}} don't catch it: they run
> on a single server node and transform to a {{String}}.
> *Compatibility note: local-only queries with a transformer*
> ({{setLocal(true)}})
> The transformer result is now converted the same way as for an event from
> another node:
> * With {{withKeepBinary()}}, a custom class result arrives as
> {{BinaryObject}}. Before: the object itself.
> * Without keep-binary, an array result arrives as {{Object[]}} (for example
> for {{Integer[]}}). Primitive, {{String}}, {{UUID}}, {{BigDecimal}} and
> date/time arrays are not affected. Before: the original array.
> * Without keep-binary, a {{BinaryObject}} of a type that has no Java class
> arrives as {{null}}, and "Failed to transform entry" is logged. Before: the
> {{BinaryObject}}.
> Normal queries already deliver remote events this way; local events now match
> them.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)