Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue where invalid iceberg table was responding back with HTTP 500. #405

Merged
merged 1 commit into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# Used in documentation and for including the Gradle plugin
spring_boot_version=2.2.5.RELEASE
spring_cloud_version=Hoxton.SR3
spring_cloud_version=Hoxton.SR7
google_guice_version=4.1.0
spock_version=1.3-groovy-2.5

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public Client build() {
(int) TimeUnit.MINUTES.toMillis(30));
}
if (logLevel == null) {
logLevel = feign.Logger.Level.NONE;
logLevel = feign.Logger.Level.BASIC;
}
if (client == null) {
client = new feign.Client.Default(null, null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.netflix.metacat.connector.hive.iceberg;

import com.google.common.base.Throwables;
import com.netflix.metacat.common.server.properties.Config;
import org.apache.hadoop.conf.Configuration;
import org.apache.iceberg.BaseMetastoreTableOperations;
import org.apache.iceberg.TableMetadata;
import org.apache.iceberg.exceptions.NotFoundException;
import org.apache.iceberg.hadoop.HadoopFileIO;
import org.apache.iceberg.io.FileIO;

Expand Down Expand Up @@ -50,8 +52,17 @@ public FileIO io() {

@Override
public TableMetadata refresh() {
refreshFromMetadataLocation(this.location, config.getIcebergRefreshFromMetadataLocationRetryNumber());
return super.current();
try {
refreshFromMetadataLocation(this.location, config.getIcebergRefreshFromMetadataLocationRetryNumber());
return super.current();
} catch (Exception e) {
for (Throwable ex : Throwables.getCausalChain(e)) {
if (ex.getMessage().contains("NoSuchKey")) {
throw new NotFoundException(e, String.format("Location %s does not exist", location));
}
}
throw e;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.netflix.metacat.common.exception.MetacatNotFoundException
import com.netflix.metacat.common.exception.MetacatNotSupportedException
import com.netflix.metacat.common.json.MetacatJson
import com.netflix.metacat.common.json.MetacatJsonLocator
import feign.Logger
import org.apache.hadoop.hive.metastore.Warehouse
import org.joda.time.Instant
import org.skyscreamer.jsonassert.JSONAssert
Expand All @@ -54,6 +55,7 @@ class MetacatFunctionalSpec extends Specification {

def client = Client.builder()
.withHost("https://localhost:$httpPort")
.withLogLevel(Logger.Level.NONE)
.withDataTypeContext('pig')
.withUserName('metacat-test')
.withClientAppName('metacat-test')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import com.netflix.metacat.common.json.MetacatJsonLocator
import com.netflix.metacat.common.server.connectors.exception.InvalidMetaException
import com.netflix.metacat.connector.hive.util.PartitionUtil
import com.netflix.metacat.testdata.provider.PigDataDtoProvider
import feign.Logger
import groovy.sql.Sql
import org.apache.commons.io.FileUtils
import org.joda.time.Instant
Expand Down Expand Up @@ -65,9 +66,11 @@ class MetacatSmokeSpec extends Specification {
.withHost(url)
.withUserName('metacat-test')
.withClientAppName('metacat-test')
.withLogLevel(Logger.Level.NONE)
.build()
def hiveClient = Client.builder()
.withHost(url)
.withLogLevel(Logger.Level.NONE)
.withDataTypeContext('hive')
.withUserName('metacat-test')
.withClientAppName('metacat-test')
Expand Down