phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sama...@apache.org
Subject phoenix git commit: PHOENIX-3938 Don't throw IOException out of coprocessor hooks
Date Thu, 06 Jul 2017 20:57:54 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.11-HBase-1.2 2c22be8bb -> 81c4890fc


PHOENIX-3938 Don't throw IOException out of coprocessor hooks


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/81c4890f
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/81c4890f
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/81c4890f

Branch: refs/heads/4.11-HBase-1.2
Commit: 81c4890fc736b2a8d57289720e401b0ceb36db3d
Parents: 2c22be8
Author: Samarth Jain <samarth@apache.org>
Authored: Thu Jul 6 13:57:44 2017 -0700
Committer: Samarth Jain <samarth@apache.org>
Committed: Thu Jul 6 13:57:44 2017 -0700

----------------------------------------------------------------------
 .../coprocessor/MetaDataEndpointImpl.java       | 14 ++++--
 .../coprocessor/ServerCachingEndpointImpl.java  | 48 ++++++++++----------
 .../UngroupedAggregateRegionObserver.java       |  2 +
 3 files changed, 36 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/81c4890f/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 2f06864..eba2e9d 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -3100,8 +3100,10 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements
Coprocesso
             if (result != null) {
                 done.run(MetaDataMutationResult.toProto(result));
             }
-        } catch (IOException ioe) {
-            ProtobufUtil.setControllerException(controller, ioe);
+        } catch (Throwable e) {
+            logger.error("Add column failed: ", e);
+            ProtobufUtil.setControllerException(controller,
+                ServerUtil.createIOException("Error when adding column: ", e));
         }
     }
 
@@ -3347,8 +3349,10 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements
Coprocesso
             if (result != null) {
                 done.run(MetaDataMutationResult.toProto(result));
             }
-        } catch (IOException ioe) {
-            ProtobufUtil.setControllerException(controller, ioe);
+        } catch (Throwable e) {
+            logger.error("Drop column failed: ", e);
+            ProtobufUtil.setControllerException(controller,
+                ServerUtil.createIOException("Error when dropping column: ", e));
         }
     }
     
@@ -3728,7 +3732,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements
Coprocesso
                     GlobalCache.getInstance(this.env).getMetaDataCache();
             metaDataCache.invalidate(cacheKey);
         } catch (Throwable t) {
-            logger.error("incrementTableTimeStamp failed", t);
+            logger.error("clearTableFromCache failed", t);
             ProtobufUtil.setControllerException(controller,
                 ServerUtil.createIOException(SchemaUtil.getTableName(schemaName, tableName),
t));
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/81c4890f/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingEndpointImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingEndpointImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingEndpointImpl.java
index 98f57ad..0944fdf 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingEndpointImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ServerCachingEndpointImpl.java
@@ -36,6 +36,7 @@ import org.apache.phoenix.coprocessor.generated.ServerCachingProtos.ServerCachin
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 import org.apache.phoenix.protobuf.ProtobufUtil;
 import org.apache.phoenix.util.ByteUtil;
+import org.apache.phoenix.util.ServerUtil;
 
 import com.google.protobuf.RpcCallback;
 import com.google.protobuf.RpcController;
@@ -55,31 +56,32 @@ public class ServerCachingEndpointImpl extends ServerCachingService implements
C
 
   @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;
+          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 =
+      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);
+          ServerCacheFactory cacheFactory = serverCacheFactoryClass.newInstance();
+          tenantCache.addServerCache(new ImmutableBytesPtr(request.getCacheId().toByteArray()),
+              cachePtr, txState, cacheFactory, request.hasHasProtoBufIndexMaintainer() &&
request.getHasProtoBufIndexMaintainer());
+        } catch (Throwable e) {
+            ProtobufUtil.setControllerException(controller,
+                ServerUtil.createIOException("Error when adding cache: ", e));
+        }
+      AddServerCacheResponse.Builder responseBuilder = AddServerCacheResponse.newBuilder();
+      responseBuilder.setReturn(true);
+      AddServerCacheResponse result = responseBuilder.build();
+      done.run(result);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/phoenix/blob/81c4890f/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
index 75654c9..3696ad4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
@@ -245,6 +245,7 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
         try {
             table.batch(mutations);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             throw new RuntimeException(e);
         }
     }
@@ -1168,6 +1169,7 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
                 try {
                     lock.wait(1000);
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                 }
             }
         }


Mime
View raw message