Skip to content

Commit

Permalink
Handle storage connection exceptions correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikhil Collooru authored and highker committed Sep 23, 2020
1 parent 6bb12b6 commit 1fc69dc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 40 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
package com.facebook.presto.hive.orc;

import com.facebook.presto.common.FileSystemCommunicationException;
import com.facebook.presto.hive.FileFormatDataSourceStats;
import com.facebook.presto.orc.AbstractOrcDataSource;
import com.facebook.presto.orc.OrcDataSourceId;
Expand All @@ -23,6 +22,7 @@

import java.io.IOException;

import static com.facebook.presto.hive.HiveErrorCode.HIVE_FILESYSTEM_ERROR;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_MISSING_DATA;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_UNKNOWN_ERROR;
import static java.lang.String.format;
Expand Down Expand Up @@ -74,7 +74,7 @@ protected void readInternal(long position, byte[] buffer, int bufferOffset, int
throw new PrestoException(HIVE_MISSING_DATA, message, e);
}
if (e instanceof IOException) {
throw new FileSystemCommunicationException(message, e);
throw new PrestoException(HIVE_FILESYSTEM_ERROR, message, e);
}
throw new PrestoException(HIVE_UNKNOWN_ERROR, message, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
package com.facebook.presto.hive.orc;

import com.facebook.presto.common.FileSystemCommunicationException;
import com.facebook.presto.common.InvalidFunctionArgumentException;
import com.facebook.presto.common.Page;
import com.facebook.presto.hive.FileFormatDataSourceStats;
Expand All @@ -29,7 +28,6 @@

import static com.facebook.presto.hive.HiveErrorCode.HIVE_BAD_DATA;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_CURSOR_ERROR;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_FILESYSTEM_ERROR;
import static com.facebook.presto.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
import static com.google.common.base.MoreObjects.toStringHelper;
import static java.lang.String.format;
Expand Down Expand Up @@ -99,10 +97,6 @@ public Page getNextPage()
closeWithSuppression(e);
throw e;
}
catch (FileSystemCommunicationException e) {
closeWithSuppression(e);
throw new PrestoException(HIVE_FILESYSTEM_ERROR, e);
}
catch (OrcCorruptionException e) {
closeWithSuppression(e);
throw new PrestoException(HIVE_BAD_DATA, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
package com.facebook.presto.orc.metadata;

import com.facebook.presto.common.FileSystemCommunicationException;
import com.facebook.presto.orc.OrcCorruptionException;
import com.facebook.presto.orc.OrcDataSourceId;
import com.facebook.presto.orc.metadata.PostScript.HiveWriterVersion;
Expand All @@ -24,7 +23,6 @@
import java.util.List;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Throwables.propagateIfPossible;
import static java.util.Objects.requireNonNull;

public class ExceptionWrappingMetadataReader
Expand Down Expand Up @@ -114,7 +112,9 @@ public List<HiveBloomFilter> readBloomFilterIndexes(InputStream inputStream)

private OrcCorruptionException propagate(Throwable throwable, String message)
{
propagateIfPossible(throwable, FileSystemCommunicationException.class);
if (throwable.getClass().getSimpleName().equals("PrestoException")) {
throw (RuntimeException) throwable;
}
return new OrcCorruptionException(throwable, orcDataSourceId, message);
}
}

0 comments on commit 1fc69dc

Please sign in to comment.