You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gobblin.apache.org by wl...@apache.org on 2022/10/13 22:48:08 UTC

[gobblin] branch master updated: Ignore AlreadyExistsException in hive writer (#3579)

This is an automated email from the ASF dual-hosted git repository.

wlo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gobblin.git


The following commit(s) were added to refs/heads/master by this push:
     new a3880d6d2 Ignore AlreadyExistsException in hive writer (#3579)
a3880d6d2 is described below

commit a3880d6d28e75d98b3ff6c1960b8329c029f367b
Author: Jack Moseley <jm...@linkedin.com>
AuthorDate: Thu Oct 13 15:48:03 2022 -0700

    Ignore AlreadyExistsException in hive writer (#3579)
---
 .../org/apache/gobblin/hive/writer/HiveMetadataWriter.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/writer/HiveMetadataWriter.java b/gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/writer/HiveMetadataWriter.java
index 730210159..5a825478b 100644
--- a/gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/writer/HiveMetadataWriter.java
+++ b/gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/writer/HiveMetadataWriter.java
@@ -19,6 +19,7 @@ package org.apache.gobblin.hive.writer;
 
 import com.google.common.base.Joiner;
 import com.google.common.base.Optional;
+import com.google.common.base.Throwables;
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.collect.Lists;
@@ -62,6 +63,7 @@ import org.apache.gobblin.util.AvroUtils;
 import org.apache.gobblin.util.ClustersNames;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.hive.metastore.api.AlreadyExistsException;
 import org.apache.hadoop.hive.serde2.avro.AvroSerdeUtils;
 
 
@@ -147,8 +149,12 @@ public class HiveMetadataWriter implements MetadataWriter {
           // Since TimeoutException should always be a transient issue, throw RuntimeException which will fail/retry container
           throw new RuntimeException("Timeout waiting for result of registration for table " + tableKey, e);
         } catch (InterruptedException | ExecutionException e) {
-          Set<String> partitions = executionMap.keySet().stream().flatMap(List::stream).collect(Collectors.toSet());
-          throw new HiveMetadataWriterWithPartitionInfoException(partitions, Collections.emptySet(), e);
+          if (Throwables.getRootCause(e) instanceof AlreadyExistsException) {
+            log.warn("Caught AlreadyExistsException for db {}, table {}, ignoring", dbName, tableName);
+          } else {
+            Set<String> partitions = executionMap.keySet().stream().flatMap(List::stream).collect(Collectors.toSet());
+            throw new HiveMetadataWriterWithPartitionInfoException(partitions, Collections.emptySet(), e);
+          }
         }
         Cache<List<String>, HiveSpec> cache = specMaps.get(tableKey);
         if (cache != null) {