You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/06/06 19:34:12 UTC

[GitHub] [hive] nrg4878 commented on a change in pull request #2291: HIVE-25128: Remove Thrift Exceptions From RawStore alterCatalog

nrg4878 commented on a change in pull request #2291:
URL: https://github.com/apache/hive/pull/2291#discussion_r646175377



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaRuntimeException.java
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.metastore;
+
+import com.google.errorprone.annotations.FormatMethod;
+
+/**
+ * This is the root of all Hive Runtime Exceptions. If a client can reasonably
+ * be expected to recover from an exception, make it a checked exception. If a
+ * client cannot do anything to recover from the exception, make it an unchecked
+ * exception.
+ */
+public class HiveMetaRuntimeException extends RuntimeException {

Review comment:
       is the plan to use this class as a parent for all runtime exceptions on the HMS? I am just wondering why we have HiveMetaRuntimeException and HiveMetaDataAccessRuntimeException? Will there be other sub-types for this class?

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -656,10 +656,9 @@ public void createCatalog(Catalog cat) throws MetaException {
   }
 
   @Override
-  public void alterCatalog(String catName, Catalog cat)
-      throws MetaException, InvalidOperationException {
+  public void alterCatalog(String catName, Catalog cat) {
     if (!cat.getName().equals(catName)) {
-      throw new InvalidOperationException("You cannot change a catalog's name");
+      throw new HiveMetaRuntimeException("You cannot change a catalog's name: " + cat.getName() + " -> " + catName);

Review comment:
       Not a very enterprise-grade exception message. Should we re-word this to something like this? "Catalogs cannot be renamed"

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaDataAccessException.java
##########
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.metastore;
+
+/**
+ * Hive Exception when the metastore's underlying storage mechanism cannot be
+ * accessed.
+ */
+public class HiveMetaDataAccessException extends HiveMetaRuntimeException {

Review comment:
       nit: feels the class name feels incorrect
   1) Suggests that this would be thrown on "access" operations aka read only operations. This is being thrown on an alterCatalog() operation which is WRITE operation. Would something like HiveMetaDataException be suitable for both READ+WRITE operations? (other considerations, HiveMetaDataException, HiveAccessException or just MetaDataRuntimeException)
   2) Feels too long

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -656,10 +656,9 @@ public void createCatalog(Catalog cat) throws MetaException {
   }
 
   @Override
-  public void alterCatalog(String catName, Catalog cat)
-      throws MetaException, InvalidOperationException {
+  public void alterCatalog(String catName, Catalog cat) {
     if (!cat.getName().equals(catName)) {
-      throw new InvalidOperationException("You cannot change a catalog's name");
+      throw new HiveMetaRuntimeException("You cannot change a catalog's name: " + cat.getName() + " -> " + catName);

Review comment:
       Should we distinguish between invalid operations/input arguments that are not permitted such as above vs runtime exceptions from backend DDL/DML operations? 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org