[
https://issues.apache.org/jira/browse/IGNITE-1374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14734363#comment-14734363
]
Enrico Olivelli commented on IGNITE-1374:
-----------------------------------------
I will try to reproduce, maybe I did an error doing copy&paste.
Working code (with PeerClassLoadingEnabled=false, and the KeyPrefixPredicate
class deployed on all the nodes):
{code}
ScanQuery<String, Object> scan = new ScanQuery<>(new
KeyPrefixPredicate(prefix));
Set<String> keys = new HashSet<>();
try (QueryCursor<Cache.Entry<String, Object>> cursor =
getCache().query(scan)) {
for (Cache.Entry<String, Object> entry : cursor) {
String key = entry.getKey();
if (key.startsWith(prefix)) { // inutile
String remaining = key.substring(prefixlenght);
keys.add(remaining);
}
}
return keys;
}
public class KeyPrefixPredicate implements IgniteBiPredicate<String, Object>,
Serializable {
private static final long serialVersionUID = 1;
private final String prefix;
public KeyPrefixPredicate(String prefix) {
this.prefix = prefix;
}
@Override
public boolean apply(String e1, Object e2) {
return e1 != null && e1.startsWith(prefix);
}
}
{code}
Code with the error (PeerClassLoadingEnabled=true, using lambda expression):
{code}
String prefix = "myprefix...";
ScanQuery<String, Object> scan = new ScanQuery<>((key, value) -> {
return key.startsWith(prefix);
});
Set<String> keys = new HashSet<>();
try (QueryCursor<Cache.Entry<String, Object>> cursor =
getCache().query(scan)) {
for (Cache.Entry<String, Object> entry : cursor) {
String key = entry.getKey();
if (key.startsWith(prefix)) { // redundant
String remaining = key.substring(prefixlenght);
keys.add(remaining);
}
}
return keys;
}
{code}
The error is not throw on the thead which execute the example but is printed on
on system log (maybe System.err or System.out, not in a "logger"), maybe it
could be a system wiade UncatchedExceptionHandler
> Error org.apache.ignite.IgniteCheckedException: Failed to send response to
> node. Unsupported direct type during a cache iteration
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: IGNITE-1374
> URL: https://issues.apache.org/jira/browse/IGNITE-1374
> Project: Ignite
> Issue Type: Bug
> Components: cache
> Reporter: Enrico Olivelli
> Assignee: Anton Vinogradov
> Priority: Blocker
> Labels: user-request
>
> Using ignite 1.3.0-incubating I get this error while issuing an iteration on
> a cache
> {code}
> Set<String> keys = new HashSet<>();
> for (Iterator<Cache.Entry<String, Object>> it = cache.iterator();
> it.hasNext();) {
> String key = it.next().getKey();
> if (key.startsWith(prefix)) {
> keys.add(remaining);
> }
> }
> {code}
> This is the error
> {code}
> GRAVE: Failed to process message
> [senderId=a9548f63-2ac4-4600-a593-dfcdca71aa38, messageType=class
> o.a.i.i.processors.cache.query.GridCacheQueryResponse]
> class org.apache.ignite.IgniteCheckedException: Failed to send response to
> node. Unsupported direct type [message=GridCacheQueryResponse
> [finished=false, reqId=934, err=null, fields=false, metadata=null]]
> at
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.processFailedMessage(GridCacheIoManager.java:507)
> at
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:232)
> at
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$700(GridCacheIoManager.java:48)
> at
> org.apache.ignite.internal.processors.cache.GridCacheIoManager$OrderedMessageListener.onMessage(GridCacheIoManager.java:1018)
> at
> org.apache.ignite.internal.managers.communication.GridIoManager$GridCommunicationMessageSet.unwind(GridIoManager.java:2086)
> at
> org.apache.ignite.internal.managers.communication.GridIoManager.unwindMessageSet(GridIoManager.java:942)
> at
> org.apache.ignite.internal.managers.communication.GridIoManager.access$1700(GridIoManager.java:59)
> at
> org.apache.ignite.internal.managers.communication.GridIoManager$6.run(GridIoManager.java:911)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)