You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@crunch.apache.org by jw...@apache.org on 2012/08/13 03:33:51 UTC
[1/3] git commit: CRUNCH-4: Add fix for HBASE-5711 to the CRUNCH-4
changes so that they work w/Hadoop 1.0.3 and Hadoop 2.0.0-alpha
Updated Branches:
refs/heads/master 38d7b3a6b -> d78e890a6
CRUNCH-4: Add fix for HBASE-5711 to the CRUNCH-4 changes so that they work w/Hadoop 1.0.3 and Hadoop 2.0.0-alpha
Project: http://git-wip-us.apache.org/repos/asf/incubator-crunch/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-crunch/commit/d78e890a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-crunch/tree/d78e890a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-crunch/diff/d78e890a
Branch: refs/heads/master
Commit: d78e890a6efa8786b39128b762becdea474ec55f
Parents: 1af6210
Author: jwills <jw...@apache.org>
Authored: Sun Aug 12 18:31:54 2012 -0700
Committer: jwills <jw...@apache.org>
Committed: Sun Aug 12 18:31:54 2012 -0700
----------------------------------------------------------------------
.../java/org/apache/crunch/WordCountHBaseIT.java | 24 ++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/d78e890a/crunch/src/it/java/org/apache/crunch/WordCountHBaseIT.java
----------------------------------------------------------------------
diff --git a/crunch/src/it/java/org/apache/crunch/WordCountHBaseIT.java b/crunch/src/it/java/org/apache/crunch/WordCountHBaseIT.java
index b7531b9..b96c125 100644
--- a/crunch/src/it/java/org/apache/crunch/WordCountHBaseIT.java
+++ b/crunch/src/it/java/org/apache/crunch/WordCountHBaseIT.java
@@ -20,10 +20,12 @@ package org.apache.crunch;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.Random;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
@@ -98,7 +100,27 @@ public class WordCountHBaseIT {
conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/1");
conf.setInt("hbase.master.info.port", -1);
conf.setInt("hbase.regionserver.info.port", -1);
- conf.set("dfs.datanode.data.dir.perm", "775");
+
+ // Workaround for HBASE-5711, we need to set config value dfs.datanode.data.dir.perm
+ // equal to the permissions of the temp dirs on the filesystem. These temp dirs were
+ // probably created using this process' umask. So we guess the temp dir permissions as
+ // 0777 & ~umask, and use that to set the config value.
+ try {
+ Process process = Runtime.getRuntime().exec("/bin/sh -c umask");
+ BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ int rc = process.waitFor();
+ if(rc == 0) {
+ String umask = br.readLine();
+
+ int umaskBits = Integer.parseInt(umask, 8);
+ int permBits = 0777 & ~umaskBits;
+ String perms = Integer.toString(permBits, 8);
+
+ conf.set("dfs.datanode.data.dir.perm", perms);
+ }
+ } catch (Exception e) {
+ // ignore errors, we might not be running on POSIX, or "sh" might not be on the path
+ }
hbaseTestUtil.startMiniZKCluster();
hbaseTestUtil.startMiniCluster();