You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by dm...@apache.org on 2022/08/05 15:25:54 UTC
[hive] branch master updated: HIVE-22417: Remove stringifyException from MetaStore (#3478) (David Mollitor reviewed by Stamatis Zampetakis)
This is an automated email from the ASF dual-hosted git repository.
dmollitor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 778c838317 HIVE-22417: Remove stringifyException from MetaStore (#3478) (David Mollitor reviewed by Stamatis Zampetakis)
778c838317 is described below
commit 778c838317c952dcd273fd6c7a51491746a1d807
Author: belugabehr <12...@users.noreply.github.com>
AuthorDate: Fri Aug 5 11:25:48 2022 -0400
HIVE-22417: Remove stringifyException from MetaStore (#3478) (David Mollitor reviewed by Stamatis Zampetakis)
---
.../hive/metastore/SerDeStorageSchemaReader.java | 2 -
.../apache/hadoop/hive/ql/exec/ReplCopyTask.java | 5 +--
.../repl/dump/events/AbstractEventHandler.java | 2 +-
.../repl/dump/events/CreateFunctionHandler.java | 2 +-
.../hadoop/hive/metastore/ReplChangeManager.java | 47 ++++++++++------------
.../hadoop/hive/metastore/utils/StringUtils.java | 2 +
.../apache/hadoop/hive/metastore/ObjectStore.java | 9 +++--
.../hive/metastore/utils/MetaStoreServerUtils.java | 4 +-
8 files changed, 36 insertions(+), 37 deletions(-)
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/SerDeStorageSchemaReader.java b/metastore/src/java/org/apache/hadoop/hive/metastore/SerDeStorageSchemaReader.java
index 958f21bb03..7f2b08c13a 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/SerDeStorageSchemaReader.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/SerDeStorageSchemaReader.java
@@ -23,7 +23,6 @@ import org.apache.hadoop.hive.metastore.api.EnvironmentContext;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.api.Table;
-import org.apache.hadoop.hive.metastore.utils.StringUtils;
import java.util.List;
@@ -47,7 +46,6 @@ public class SerDeStorageSchemaReader implements StorageSchemaReader {
Deserializer s = HiveMetaStoreUtils.getDeserializer(conf, tbl, null, false);
return HiveMetaStoreUtils.getFieldsFromDeserializer(tbl.getTableName(), s, conf);
} catch (Exception e) {
- StringUtils.stringifyException(e);
throw new MetaException(e.getMessage());
} finally {
if (orgHiveLoader != null) {
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/ReplCopyTask.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/ReplCopyTask.java
index 474859f99b..231f57455b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/ReplCopyTask.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/ReplCopyTask.java
@@ -19,7 +19,6 @@
package org.apache.hadoop.hive.ql.exec;
import org.apache.hadoop.hive.metastore.ReplChangeManager;
-import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.ql.exec.repl.util.ReplUtils;
import org.apache.hadoop.hive.ql.parse.EximUtil;
import org.apache.hadoop.hive.ql.parse.ReplicationSpec;
@@ -189,10 +188,10 @@ public class ReplCopyTask extends Task<ReplCopyWork> implements Serializable {
ReplChangeManager.FileInfo f = ReplChangeManager
.getFileInfo(new Path(fragments[0]), fragments[1], fragments[2], fragments[3], conf);
filePaths.add(f);
- } catch (MetaException e) {
+ } catch (IOException ioe) {
// issue warning for missing file and throw exception
LOG.warn("Cannot find {} in source repo or cmroot", fragments[0]);
- throw new IOException(e.getMessage());
+ throw ioe;
}
// Note - we need srcFs rather than fs, because it is possible that the _files lists files
// which are from a different filesystem than the fs where the _files file itself was loaded
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AbstractEventHandler.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AbstractEventHandler.java
index f488b8577f..7f0830589d 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AbstractEventHandler.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AbstractEventHandler.java
@@ -106,7 +106,7 @@ abstract class AbstractEventHandler<T extends EventMessage> implements EventHand
}
protected void writeFileEntry(Table table, Partition ptn, String file, Context withinContext)
- throws IOException, LoginException, MetaException, HiveFatalException {
+ throws IOException, LoginException, HiveFatalException {
HiveConf hiveConf = withinContext.hiveConf;
String distCpDoAsUser = hiveConf.getVar(HiveConf.ConfVars.HIVE_DISTCP_DOAS_USER);
if (!Utils.shouldDumpMetaDataOnly(withinContext.hiveConf)) {
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/CreateFunctionHandler.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/CreateFunctionHandler.java
index 59eb0f552e..638a22961d 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/CreateFunctionHandler.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/CreateFunctionHandler.java
@@ -75,7 +75,7 @@ class CreateFunctionHandler extends AbstractEventHandler<CreateFunctionMessage>
}
private void copyFunctionBinaries(List<DataCopyPath> functionBinaryCopyPaths, HiveConf hiveConf)
- throws MetaException, IOException, LoginException, HiveFatalException {
+ throws IOException, LoginException, HiveFatalException {
if (!functionBinaryCopyPaths.isEmpty()) {
String distCpDoAsUser = hiveConf.getVar(HiveConf.ConfVars.HIVE_DISTCP_DOAS_USER);
List<ReplChangeManager.FileInfo> filePaths = new ArrayList<>();
diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ReplChangeManager.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ReplChangeManager.java
index 3436fbc506..43894ed4f6 100644
--- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ReplChangeManager.java
+++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ReplChangeManager.java
@@ -205,7 +205,8 @@ public class ReplChangeManager {
inited = true;
}
} catch (IOException e) {
- throw new MetaException(StringUtils.stringifyException(e));
+ LOG.error("Failed to created ReplChangeManager", e);
+ throw new MetaException(e.getMessage());
}
}
@@ -378,32 +379,28 @@ public class ReplChangeManager {
* @return Corresponding FileInfo object
*/
public static FileInfo getFileInfo(Path src, String checksumString, String srcCMRootURI, String subDir,
- Configuration conf) throws MetaException {
- try {
- FileSystem srcFs = src.getFileSystem(conf);
- if (checksumString == null) {
- return new FileInfo(srcFs, src, subDir);
- }
+ Configuration conf) throws IOException {
+ FileSystem srcFs = src.getFileSystem(conf);
+ if (checksumString == null) {
+ return new FileInfo(srcFs, src, subDir);
+ }
- Path cmPath = getCMPath(conf, src.getName(), checksumString, srcCMRootURI);
- if (!srcFs.exists(src)) {
- return new FileInfo(srcFs, src, cmPath, checksumString, false, subDir);
- }
+ Path cmPath = getCMPath(conf, src.getName(), checksumString, srcCMRootURI);
+ if (!srcFs.exists(src)) {
+ return new FileInfo(srcFs, src, cmPath, checksumString, false, subDir);
+ }
- String currentChecksumString;
- try {
- currentChecksumString = checksumFor(src, srcFs);
- } catch (IOException ex) {
- // If the file is missing or getting modified, then refer CM path
- return new FileInfo(srcFs, src, cmPath, checksumString, false, subDir);
- }
- if ((currentChecksumString == null) || checksumString.equals(currentChecksumString)) {
- return new FileInfo(srcFs, src, cmPath, checksumString, true, subDir);
- } else {
- return new FileInfo(srcFs, src, cmPath, checksumString, false, subDir);
- }
- } catch (IOException e) {
- throw new MetaException(StringUtils.stringifyException(e));
+ String currentChecksumString;
+ try {
+ currentChecksumString = checksumFor(src, srcFs);
+ } catch (IOException ex) {
+ // If the file is missing or getting modified, then refer CM path
+ return new FileInfo(srcFs, src, cmPath, checksumString, false, subDir);
+ }
+ if ((currentChecksumString == null) || checksumString.equals(currentChecksumString)) {
+ return new FileInfo(srcFs, src, cmPath, checksumString, true, subDir);
+ } else {
+ return new FileInfo(srcFs, src, cmPath, checksumString, false, subDir);
}
}
diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/StringUtils.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/StringUtils.java
index e49a4233ce..61258acbef 100644
--- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/StringUtils.java
+++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/StringUtils.java
@@ -98,7 +98,9 @@ public class StringUtils {
* Make a string representation of the exception.
* @param e The exception to stringify
* @return A string with exception name and call stack.
+ * @deprecated
*/
+ @Deprecated
public static String stringifyException(Throwable e) {
StringWriter stm = new StringWriter();
PrintWriter wrt = new PrintWriter(stm);
diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index 435ac4fc6b..99ea4b73e1 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -987,7 +987,8 @@ public class ObjectStore implements RawStore, Configurable {
pm.deletePersistent(db);
success = commitTransaction();
} catch (Exception e) {
- throw new MetaException(e.getMessage() + " " + org.apache.hadoop.hive.metastore.utils.StringUtils.stringifyException(e));
+ LOG.error("Failed to drop database", e);
+ throw new MetaException(e.getMessage());
} finally {
rollbackAndCleanup(success, null);
}
@@ -1195,7 +1196,8 @@ public class ObjectStore implements RawStore, Configurable {
pm.deletePersistent(mdb);
success = commitTransaction();
} catch (Exception e) {
- throw new MetaException(e.getMessage() + " " + org.apache.hadoop.hive.metastore.utils.StringUtils.stringifyException(e));
+ LOG.error("Failed to drop data connector", e);
+ throw new MetaException(e.getMessage());
} finally {
rollbackAndCleanup(success, null);
}
@@ -3247,7 +3249,8 @@ public class ObjectStore implements RawStore, Configurable {
try {
return convertToParts(listMPartitions(catName, dbName, tblName, maxParts));
} catch (Exception e) {
- throw new MetaException(e.getMessage() + " " + org.apache.hadoop.hive.metastore.utils.StringUtils.stringifyException(e));
+ LOG.error("Failed to convert to parts", e);
+ throw new MetaException(e.getMessage());
}
}
}.run(false);
diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreServerUtils.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreServerUtils.java
index 8793c8c7c6..5e3a331129 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreServerUtils.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreServerUtils.java
@@ -1217,8 +1217,8 @@ public class MetaStoreServerUtils {
}
PropertyUtils.setNestedProperty(bean, propertyName, value);
} catch (Exception e) {
- throw new MetaException(
- org.apache.hadoop.hive.metastore.utils.StringUtils.stringifyException(e));
+ LOG.error("Failed to set nested property", e);
+ throw new MetaException(e.getMessage());
}
}