You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "William Do (JIRA)" <ji...@apache.org> on 2017/05/06 16:31:04 UTC

[jira] [Comment Edited] (IGNITE-5119) Provide more descriptive errors when calling affinityRun or affinityCall

    [ https://issues.apache.org/jira/browse/IGNITE-5119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15999468#comment-15999468 ] 

William Do edited comment on IGNITE-5119 at 5/6/17 4:30 PM:
------------------------------------------------------------

The exception is thrown from {{GridAffinityProcessor.partition0}} after null check on return of {{affinityCache}}.

There is a similar method {{CacheAffinityProxy.cache}} which makes the same call to {{affinityCache}} but returns a more descriptive message. 

{code:java}
private AffinityInfo cache() throws IgniteCheckedException {
    AffinityInfo aff = affinityCache(cacheName, ctx.discovery().topologyVersionEx());

    if (aff == null)
        throw new IgniteException("Failed to find cache (cache was not started " +
            "yet or cache was already stopped): " + cacheName);

    return aff;
}
{code}

I propose using a similar message for this patch: 
{noformat}
Failed to get cache affinity (cache was not started yet or cache was already stopped): cacheName
{noformat}


was (Author: williamdo):
The exception is thrown from {{GridAffinityProcessor.partition0}} after null check on return of {{affinityCache}}.

There is a similar method {{CacheAffinityProxy.cache}} which makes the same call to {{affinityCache}} but returns a more descriptive message. 

{code:java}
private AffinityInfo cache() throws IgniteCheckedException {
    AffinityInfo aff = affinityCache(cacheName, ctx.discovery().topologyVersionEx());

    if (aff == null)
        throw new IgniteException("Failed to find cache (cache was not started " +
            "yet or cache was already stopped): " + cacheName);

    return aff;
}
{code}

I propose re-using the same message for this patch.

> Provide more descriptive errors when calling affinityRun or affinityCall
> ------------------------------------------------------------------------
>
>                 Key: IGNITE-5119
>                 URL: https://issues.apache.org/jira/browse/IGNITE-5119
>             Project: Ignite
>          Issue Type: Improvement
>    Affects Versions: 1.9
>            Reporter: William Do
>            Assignee: William Do
>            Priority: Minor
>
> When calling compute affinityRun or affinityCall using a cache name that doesn't exist, an exception is thrown with the message: _Failed to get cache affinity_.
> {noformat}
> Exception in thread "main" class org.apache.ignite.IgniteException: Failed to get cache affinity.
> 	at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:946)
> 	at org.apache.ignite.internal.IgniteComputeImpl.affinityCall(IgniteComputeImpl.java:201)
> 	at com.ultimaspin.ignite.AffinityRunExample.main(AffinityRunExample.java:28)
> Caused by: class org.apache.ignite.IgniteCheckedException: Failed to get cache affinity.
> 	at org.apache.ignite.internal.processors.affinity.GridAffinityProcessor.partition0(GridAffinityProcessor.java:192)
> 	at org.apache.ignite.internal.processors.affinity.GridAffinityProcessor.partition(GridAffinityProcessor.java:175)
> 	at org.apache.ignite.internal.processors.affinity.GridAffinityProcessor.partition(GridAffinityProcessor.java:155)
> 	at org.apache.ignite.internal.IgniteComputeImpl.affinityCall(IgniteComputeImpl.java:191)
> 	... 1 more
> {noformat}
> It would be nice if the message could be more descriptive as to why it was unable to determine the affinity (in this case because the cache doesn't exist).



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)