diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/thrift/ThriftHiveMetastore.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/thrift/ThriftHiveMetastore.java index 15bd2c870b01..9a825451e371 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/thrift/ThriftHiveMetastore.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/thrift/ThriftHiveMetastore.java @@ -28,7 +28,6 @@ import io.trino.plugin.hive.HiveConfig; import io.trino.plugin.hive.HivePartition; import io.trino.plugin.hive.HiveType; -import io.trino.plugin.hive.HiveViewNotSupportedException; import io.trino.plugin.hive.PartitionNotFoundException; import io.trino.plugin.hive.PartitionStatistics; import io.trino.plugin.hive.SchemaAlreadyExistsException; @@ -347,7 +346,7 @@ public Optional getTable(HiveIdentity identity, String databaseName, Stri { try { return retry() - .stopOn(NoSuchObjectException.class, HiveViewNotSupportedException.class) + .stopOn(NoSuchObjectException.class) .stopOnIllegalExceptions() .run("getTable", stats.getGetTable().wrap(() -> { Table table = getTableFromMetastore(identity, databaseName, tableName); @@ -397,7 +396,7 @@ private Map getTableColumnStatistics(HiveIdentity { try { return retry() - .stopOn(NoSuchObjectException.class, HiveViewNotSupportedException.class) + .stopOn(NoSuchObjectException.class) .stopOnIllegalExceptions() .run("getTableColumnStatistics", stats.getGetTableColumnStatistics().wrap(() -> { try (ThriftMetastoreClient client = createMetastoreClient(identity)) { @@ -492,7 +491,7 @@ private Map> getMetastorePartitionColumnStatis { try { return retry() - .stopOn(NoSuchObjectException.class, HiveViewNotSupportedException.class) + .stopOn(NoSuchObjectException.class) .stopOnIllegalExceptions() .run("getPartitionColumnStatistics", stats.getGetPartitionColumnStatistics().wrap(() -> { try (ThriftMetastoreClient client = createMetastoreClient(identity)) { diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/util/RetryDriver.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/util/RetryDriver.java index 6acee1e8642d..b0a938e75fed 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/util/RetryDriver.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/util/RetryDriver.java @@ -41,7 +41,7 @@ public class RetryDriver private final Duration maxSleepTime; private final double scaleFactor; private final Duration maxRetryTime; - private final List> allowedExceptions; + private final List> stopOnExceptions; private final Optional retryRunnable; private RetryDriver( @@ -50,7 +50,7 @@ private RetryDriver( Duration maxSleepTime, double scaleFactor, Duration maxRetryTime, - List> allowedExceptions, + List> stopOnExceptions, Optional retryRunnable) { this.maxAttempts = maxAttempts; @@ -58,7 +58,7 @@ private RetryDriver( this.maxSleepTime = maxSleepTime; this.scaleFactor = scaleFactor; this.maxRetryTime = maxRetryTime; - this.allowedExceptions = allowedExceptions; + this.stopOnExceptions = stopOnExceptions; this.retryRunnable = retryRunnable; } @@ -80,17 +80,17 @@ public static RetryDriver retry() public final RetryDriver maxAttempts(int maxAttempts) { - return new RetryDriver(maxAttempts, minSleepTime, maxSleepTime, scaleFactor, maxRetryTime, allowedExceptions, retryRunnable); + return new RetryDriver(maxAttempts, minSleepTime, maxSleepTime, scaleFactor, maxRetryTime, stopOnExceptions, retryRunnable); } public final RetryDriver exponentialBackoff(Duration minSleepTime, Duration maxSleepTime, Duration maxRetryTime, double scaleFactor) { - return new RetryDriver(maxAttempts, minSleepTime, maxSleepTime, scaleFactor, maxRetryTime, allowedExceptions, retryRunnable); + return new RetryDriver(maxAttempts, minSleepTime, maxSleepTime, scaleFactor, maxRetryTime, stopOnExceptions, retryRunnable); } public final RetryDriver onRetry(Runnable retryRunnable) { - return new RetryDriver(maxAttempts, minSleepTime, maxSleepTime, scaleFactor, maxRetryTime, allowedExceptions, Optional.ofNullable(retryRunnable)); + return new RetryDriver(maxAttempts, minSleepTime, maxSleepTime, scaleFactor, maxRetryTime, stopOnExceptions, Optional.ofNullable(retryRunnable)); } @SafeVarargs @@ -98,7 +98,7 @@ public final RetryDriver stopOn(Class... classes) { requireNonNull(classes, "classes is null"); List> exceptions = ImmutableList.>builder() - .addAll(allowedExceptions) + .addAll(stopOnExceptions) .addAll(Arrays.asList(classes)) .build(); @@ -130,7 +130,7 @@ public V run(String callableName, Callable callable) return callable.call(); } catch (Exception e) { - for (Class clazz : allowedExceptions) { + for (Class clazz : stopOnExceptions) { if (clazz.isInstance(e)) { addSuppressed(e, suppressedExceptions); throw e;