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

James Taylor commented on PHOENIX-3938:
---------------------------------------

One example that I believe is problematic is ServerCachingEndpointImpl, where 
we're wrapping in an IOException. I think this would trigger, a retry from the 
client (but I'm not 100% sure). I think we should instead use 
DoNotRetryIOException here:
{code}
  @Override
  public void addServerCache(RpcController controller, AddServerCacheRequest 
request,
      RpcCallback<AddServerCacheResponse> done) {
    ImmutableBytesPtr tenantId = null;
    if (request.hasTenantId()) {
      tenantId = new ImmutableBytesPtr(request.getTenantId().toByteArray());
    }
    TenantCache tenantCache = GlobalCache.getTenantCache(this.env, tenantId);
    ImmutableBytesWritable cachePtr =
        org.apache.phoenix.protobuf.ProtobufUtil
            .toImmutableBytesWritable(request.getCachePtr());
    byte[] txState = request.hasTxState() ? request.getTxState().toByteArray() 
: ByteUtil.EMPTY_BYTE_ARRAY;

    try {
      @SuppressWarnings("unchecked")
      Class<ServerCacheFactory> serverCacheFactoryClass =
          (Class<ServerCacheFactory>) 
Class.forName(request.getCacheFactory().getClassName());
      ServerCacheFactory cacheFactory = serverCacheFactoryClass.newInstance();
      tenantCache.addServerCache(new 
ImmutableBytesPtr(request.getCacheId().toByteArray()),
        cachePtr, txState, cacheFactory, 
request.hasHasProtoBufIndexMaintainer() && 
request.getHasProtoBufIndexMaintainer());
    } catch (Throwable e) {
      ProtobufUtil.setControllerException(controller, new IOException(e));
    }
    AddServerCacheResponse.Builder responseBuilder = 
AddServerCacheResponse.newBuilder();
    responseBuilder.setReturn(true);
    AddServerCacheResponse result = responseBuilder.build();
    done.run(result);
  }
{code}

> Don't throw IOException out of coprocessor hooks
> ------------------------------------------------
>
>                 Key: PHOENIX-3938
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3938
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: Samarth Jain
>
> We shouldn't wrap and throw exceptions as an IOException from coprocessor 
> hooks since that'll trigger the retry logic which just delays throwing the 
> exception back to the client. Instead, we should wrap in a 
> DoNotRetryIOException.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to