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

Jason Lowe commented on MAPREDUCE-6761:
---------------------------------------

Thanks for updating the patch.  Looks good overall with a minor nit in the test:
{code}
    // Check that we get the acceptable client, even after
    // failure in instantiation.
    assertThat("Unexpected type of clientProtocolProvider",
        testCluster.getClient(),
        instanceOf(ClientProtocol.class));
{code}

The ServiceLoader is only going to load classes that can be cast to a 
ClientProtocol, so if the Cluster constructor doesn't fail then this too will 
never fail. In addition ClientProtocol is the return type for the 
Cluster#getClient method, so this is essentially a complicated null check since 
that's the only return value that could cause the test to fail.  It also isn't 
testing which client protocol type we received, since the mock always returns 
the same type when it isn't throwing an error.  The test would be more robust 
if the mock could return different derived classes from ClientProtocol and 
verify we received the correct one.

Fairly minor nit though, so I'm still +1 on the current patch if that isn't 
addressed.

> Regression when handling providers - invalid configuration 
> ServiceConfiguration causes Cluster initialization failure
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: MAPREDUCE-6761
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-6761
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>          Components: mrv2
>    Affects Versions: 3.0.0-alpha2
>            Reporter: Peter Vary
>            Assignee: Peter Vary
>              Labels: supportability
>         Attachments: MAPREDUCE-6761.2.patch, MAPREDUCE-6761.3.patch, 
> MAPREDUCE-6761.4.patch, MAPREDUCE-6761.patch
>
>
> When a rogue org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider 
> defines a provider that is not on classpath, then the initialization is 
> failed with the following exception:
> java.util.ServiceConfigurationError: 
> org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider: Provider 
> org.apache.hadoop.mapred.YarnClientProtocolProvider not found
>       at java.util.ServiceLoader.fail(ServiceLoader.java:239)
>       at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
>       at 
> java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)
>       at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
>       at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
>       at org.apache.hadoop.mapreduce.Cluster.initProviderList(Cluster.java:84)
>       at org.apache.hadoop.mapreduce.Cluster.initialize(Cluster.java:114)
>       at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:108)
>       at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:101)
>       at org.apache.hadoop.mapred.JobClient.init(JobClient.java:477)
>       at org.apache.hadoop.mapred.JobClient.<init>(JobClient.java:455)
> This regression is caused by MAPREDUCE-6473



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to