tephra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TEPHRA-194) Transaction client should not retry startShort() if an invalid timeout is given
Date Thu, 20 Oct 2016 22:55:58 GMT

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

ASF GitHub Bot commented on TEPHRA-194:
---------------------------------------

Github user anew commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/18#discussion_r84392263
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/distributed/TransactionServiceThriftClient.java
---
    @@ -112,7 +113,20 @@ public Transaction startShort() throws TException {
     
       public Transaction startShort(int timeout) throws TException {
         try {
    -      return TransactionConverterUtils.unwrap(client.startShortTimeout(timeout));
    +      return TransactionConverterUtils.unwrap(client.startShortWithTimeout(timeout));
    +    } catch (TGenericException e) {
    +      isValid.set(false);
    +      // currently, we only expect IllegalArgumentException here, if the timeout is invalid
    +      IllegalArgumentException actual;
    +      try {
    +        actual = (IllegalArgumentException)
    +          Class.forName(e.getOriginalExceptionClass())
    +            .getConstructor(String.class)
    +            .newInstance(e.getMessage());
    +      } catch (Throwable t) {
    --- End diff --
    
    Because we do not expect anything else than IllegalArgumentException? For now, I will
change the code to be more readable and expect exactly that.


> Transaction client should not retry startShort() if an invalid timeout is given 
> --------------------------------------------------------------------------------
>
>                 Key: TEPHRA-194
>                 URL: https://issues.apache.org/jira/browse/TEPHRA-194
>             Project: Tephra
>          Issue Type: Bug
>          Components: client
>    Affects Versions: 0.9.0-incubating, 0.10.0-incubating
>            Reporter: Andreas Neumann
>            Assignee: Andreas Neumann
>             Fix For: 0.10.0-incubating
>
>
> Currently, if an invalid timeout (negative, or too long) is given, the Tx manager throws
an IllegalArgumentException. The thrift client will catch that and apply the retry strategy.
However, in this case, retry is pointless, and if the strategy is, for example, exponential
backoff, if introduces unneccessary load and latency. 
> The service should instead throw a meaningful exception for that, so that the client
knows not to retry. 



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

Mime
View raw message