[
https://issues.apache.org/jira/browse/HBASE-5711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13412487#comment-13412487
]
Dave Revell commented on HBASE-5711:
------------------------------------
Here's a workaround for people running into permission problems while embedding
a minicluster.
{noformat}
hbaseTestUtil = new HBaseTestingUtility();
// 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);
log.info("Setting dfs.datanode.data.dir.perm to " + perms);
hbaseTestUtil.getConfiguration().set("dfs.datanode.data.dir.perm", perms);
} else {
log.warn("Failed running umask command in a shell, nonzero
return value");
}
} catch (Exception e) {
// ignore errors, we might not be running on POSIX, or "sh"
might not be on the path
log.warn("Couldn't get umask", e);
}
hbaseTestUtil.startMiniCluster();
{noformat}
> Tests are failing with incorrect data directory permissions.
> ------------------------------------------------------------
>
> Key: HBASE-5711
> URL: https://issues.apache.org/jira/browse/HBASE-5711
> Project: HBase
> Issue Type: Bug
> Components: test
> Reporter: Uma Maheswara Rao G
> Assignee: Uma Maheswara Rao G
> Fix For: 0.92.3
>
> Attachments: HBASE-5711.patch
>
>
> When we run some tests in Hbase (TestAdmin), it is failing with following
> error.
> {quote}
> Starting DataNode 0 with dfs.data.dir:
> E:\Repositories\Hbase\target\test-data\5ff23198-892e-4f1c-8022-b3d9969fcf0b\dfscluster_0ecc6984-1925-4870-ac7c-439fceede4cb\dfs\data\data1,E:\Repositories\Hbase\target\test-data\5ff23198-892e-4f1c-8022-b3d9969fcf0b\dfscluster_0ecc6984-1925-4870-ac7c-439fceede4cb\dfs\data\data2
> 2012-04-04 18:04:51,036 WARN [main] impl.MetricsSystemImpl(137): Metrics
> system not started: Cannot locate configuration: tried
> hadoop-metrics2-datanode.properties, hadoop-metrics2.properties
> 2012-04-04 18:04:51,255 WARN [main] datanode.DataNode(1548): Invalid
> directory in dfs.data.dir: Incorrect permission for
> E:/Repositories/Hbase/target/test-data/5ff23198-892e-4f1c-8022-b3d9969fcf0b/dfscluster_0ecc6984-1925-4870-ac7c-439fceede4cb/dfs/data/data1,
> expected: rwxr-xr-x, while actual: rwx------
> 2012-04-04 18:04:51,411 WARN [main] datanode.DataNode(1548): Invalid
> directory in dfs.data.dir: Incorrect permission for
> E:/Repositories/Hbase/target/test-data/5ff23198-892e-4f1c-8022-b3d9969fcf0b/dfscluster_0ecc6984-1925-4870-ac7c-439fceede4cb/dfs/data/data2,
> expected: rwxr-xr-x, while actual: rwx------
> 2012-04-04 18:04:51,411 ERROR [main] datanode.DataNode(1554): All directories
> in dfs.data.dir are invalid.
> 2012-04-04 18:04:51,411 INFO [main] hbase.HBaseTestingUtility(684): Shutting
> down minicluster
> 2012-04-04 18:04:51,646 WARN [main] hbase.HBaseTestingUtility(696): Failed
> delete of
> E:\Repositories\Hbase\target\test-data\5ff23198-892e-4f1c-8022-b3d9969fcf0b\dfscluster_0ecc6984-1925-4870-ac7c-439fceede4cb
> 2012-04-04 18:04:51,646 INFO [main] hbase.HBaseTestingUtility(700):
> Minicluster is down
> {quote}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira