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 822051c61c..885b42b9d3 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 @@ -69,8 +69,6 @@ protected int execute(DriverContext driverContext) { Path toPath = null; try { - Hive hiveDb = getHive(); - // Note: CopyWork supports copying multiple files, but ReplCopyWork doesn't. // Not clear of ReplCopyWork should inherit from CopyWork. if (work.getFromPaths().length > 1 || work.getToPaths().length > 1) { @@ -168,7 +166,7 @@ protected int execute(DriverContext driverContext) { // its a replace (insert overwrite ) operation. if (work.getDeleteDestIfExist() && dstFs.exists(toPath)) { LOG.debug(" path " + toPath + " is cleaned before renaming"); - hiveDb.cleanUpOneDirectoryForReplace(toPath, dstFs, HIDDEN_FILES_PATH_FILTER, conf, work.getNeedRecycle(), + getHive().cleanUpOneDirectoryForReplace(toPath, dstFs, HIDDEN_FILES_PATH_FILTER, conf, work.getNeedRecycle(), work.getIsAutoPurge()); } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java index 11ef62c1c6..b39771fcbe 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java @@ -184,7 +184,9 @@ protected void setState(TaskState state) { protected Hive getHive() { try { - return Hive.getWithFastCheck(conf); + // Hive.getWithFastCheck shouldn't be used here as it always re-opens metastore connection. + // The conf object in HMS client is always different from the one used here. + return Hive.get(conf); } catch (HiveException e) { LOG.error(StringUtils.stringifyException(e)); throw new RuntimeException(e);