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

    https://github.com/apache/trafodion/pull/1532#discussion_r193880363
  
    --- Diff: 
core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/TrxRegionEndpoint.java.tmpl
 ---
    @@ -2404,6 +2410,72 @@ CoprocessorService, Coprocessor {
         done.run(TlogDel_response);
      }
     
    +  public void setStoragePolicy(RpcController controller,
    +                                             TrafSetStoragePolicyRequest 
request,
    +                                             
RpcCallback<TrafSetStoragePolicyResponse> done) {
    +    String path = request.getPath();
    +    String policy = request.getPolicy();
    +    if (LOG.isTraceEnabled()) LOG.trace("setStoragePolicy ENTRY. path " +  
path + " policy " + policy );
    +
    +    IOException t=null;
    +    try {
    +      invokeSetStoragePolicy(fs, path, policy);
    +    }
    +    catch (IOException e) {
    +      t = e; 
    +    }
    +  
    +    
org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.Builder
 setStoragePolicyResponseBuilder =
    +      
org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.newBuilder();
    +
    +    if(t != null)
    +    {
    +      LOG.error("setStoragePolicy error : " + t.toString() );
    +      setStoragePolicyResponseBuilder.setStatus(false);
    +      setStoragePolicyResponseBuilder.setException(t.toString());
    +    }
    +    else
    +    {
    +      setStoragePolicyResponseBuilder.setStatus(true);
    +      setStoragePolicyResponseBuilder.setException("");
    +    }
    +   
    +    TrafSetStoragePolicyResponse resp = 
setStoragePolicyResponseBuilder.build();
    +
    +    done.run(resp);
    +    
    +  }
    +
    +  private static void invokeSetStoragePolicy(final FileSystem fs, final 
String pathstr,
    +      final String storagePolicy)
    +       throws IOException {
    +        Path path = new Path(pathstr);
    +        Method m = null;
    +        try {
    +            m = fs.getClass().getDeclaredMethod("setStoragePolicy",
    +            new Class<?>[] { Path.class, String.class });
    +            m.setAccessible(true);
    --- End diff --
    
    To avoid increased path length, consider issue reflection API to get the 
method Id once in static block


---

Reply via email to