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/05/13 15:07:49 UTC

[GitHub] [hive] belugabehr commented on a change in pull request #2269: HIVE-25111: Metastore Catalog Methods JDO Persistence

belugabehr commented on a change in pull request #2269:
URL: https://github.com/apache/hive/pull/2269#discussion_r631882813



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -642,112 +642,140 @@ public void rollbackTransaction() {
   @Override
   public void createCatalog(Catalog cat) throws MetaException {
     LOG.debug("Creating catalog {}", cat);
-    boolean committed = false;
+
     MCatalog mCat = catToMCat(cat);
+
+    final Transaction tx = pm.currentTransaction();
+
     try {
-      openTransaction();
+      tx.begin();
       pm.makePersistent(mCat);
-      committed = commitTransaction();
+      tx.commit();
     } finally {
-      if (!committed) {
-        rollbackTransaction();
+      if (tx.isActive()) {
+        tx.rollback();
       }
     }
   }
 
   @Override
   public void alterCatalog(String catName, Catalog cat)
-      throws MetaException, InvalidOperationException {
+      throws MetaException, InvalidOperationException, NoSuchObjectException {

Review comment:
       This should also throw NoSuchObjectException if user is attempting to alter a non-existing catalog




-- 
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