incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [15/20] git commit: Fixed BLUR-149
Date Mon, 05 Aug 2013 18:56:52 GMT
Fixed BLUR-149


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/de5d2e1f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/de5d2e1f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/de5d2e1f

Branch: refs/heads/0.2.0-newtypesystem
Commit: de5d2e1f049380b7fba4acfe4d8bac8d63743444
Parents: 5e2f484
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sat Aug 3 17:41:36 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sat Aug 3 17:41:36 2013 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/blur/utils/BlurUtil.java  | 17 +++++++++++++++++
 .../blur/mapreduce/lib/BlurOutputFormat.java       |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/de5d2e1f/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java b/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
index c56191d..e805867 100644
--- a/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
+++ b/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
@@ -42,6 +42,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.UUID;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutionException;
@@ -832,4 +833,20 @@ public class BlurUtil {
       }
     };
   }
+
+  public static void validateWritableDirectory(FileSystem fileSystem, Path tablePath) throws
IOException {
+    String tmpDir = UUID.randomUUID().toString();
+    String tmpFile = UUID.randomUUID().toString();
+    Path path = new Path(tablePath, tmpDir);
+    if (!fileSystem.mkdirs(path)) {
+      throw new IOException("Could not create new directory in [" + tablePath + "] ");
+    }
+    Path filePath = new Path(path, tmpFile);
+    try {
+      fileSystem.create(filePath).close();
+    } catch (IOException e) {
+      throw new IOException("Could not create new filr in [" + path + "] ");
+    }
+    fileSystem.delete(path, true);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/de5d2e1f/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/BlurOutputFormat.java
----------------------------------------------------------------------
diff --git a/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/BlurOutputFormat.java
b/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/BlurOutputFormat.java
index 6a46e46..eb8112b 100644
--- a/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/BlurOutputFormat.java
+++ b/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/BlurOutputFormat.java
@@ -139,7 +139,7 @@ public class BlurOutputFormat extends OutputFormat<Text, BlurMutate>
{
       throw new IOException("Table path [ " + tablePath + " ] doesn't exist for table [ "
+ tableDescriptor.getName()
           + " ].");
     }
-
+    BlurUtil.validateWritableDirectory(fileSystem, tablePath);
     int reducers = context.getNumReduceTasks();
     int reducerMultiplier = getReducerMultiplier(config);
     int validNumberOfReducers = reducerMultiplier * shardCount;


Mime
View raw message