You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by xu...@apache.org on 2015/10/28 13:11:24 UTC

[31/55] [abbrv] hive git commit: HIVE-12262: Session log dir cannot be created in some cases (Daniel Dai, reviewed by Thejas Nair)

HIVE-12262: Session log dir cannot be created in some cases (Daniel Dai, reviewed by Thejas Nair)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/48a1e1f7
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/48a1e1f7
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/48a1e1f7

Branch: refs/heads/spark
Commit: 48a1e1f7b051e6ca2a5bbb4a55eda16f5349d369
Parents: e3ef96f
Author: Daniel Dai <da...@hortonworks.com>
Authored: Sun Oct 25 09:46:27 2015 -0700
Committer: Daniel Dai <da...@hortonworks.com>
Committed: Sun Oct 25 09:48:00 2015 -0700

----------------------------------------------------------------------
 .../hive/service/cli/session/HiveSessionImpl.java       | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/48a1e1f7/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
index a600309..3eaab9a 100644
--- a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
+++ b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
@@ -241,6 +241,18 @@ public class HiveSessionImpl implements HiveSession {
 
   @Override
   public void setOperationLogSessionDir(File operationLogRootDir) {
+    if (!operationLogRootDir.exists()) {
+      LOG.warn("The operation log root directory is removed, recreating:" +
+          operationLogRootDir.getAbsolutePath());
+      if (!operationLogRootDir.mkdirs()) {
+        LOG.warn("Unable to create operation log root directory: " +
+            operationLogRootDir.getAbsolutePath());
+      }
+    }
+    if (!operationLogRootDir.canWrite()) {
+      LOG.warn("The operation log root directory is not writable: " +
+          operationLogRootDir.getAbsolutePath());
+    }
     sessionLogDir = new File(operationLogRootDir, sessionHandle.getHandleIdentifier().toString());
     isOperationLogEnabled = true;
     if (!sessionLogDir.exists()) {