HBASE-5711 Tests are failing with incorrect data directory permissions -- OVER-REVERTED; UNDOING LAST COMMIT

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1310097 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-04-05 22:04:26 +00:00
parent 050e8df896
commit 8fd194d696
3 changed files with 11 additions and 25 deletions

View File

@ -26,7 +26,6 @@ import java.io.PrintWriter;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Socket; import java.net.Socket;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@ -36,19 +35,17 @@ import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.EmptyWatcher; import org.apache.hadoop.hbase.*;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.executor.RegionTransitionData; import org.apache.hadoop.hbase.executor.RegionTransitionData;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.hbase.util.Threads;
import org.apache.zookeeper.AsyncCallback; import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.KeeperException.NoNodeException; import org.apache.zookeeper.KeeperException.NoNodeException;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooDefs.Ids; import org.apache.zookeeper.ZooDefs.Ids;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.ACL; import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat; import org.apache.zookeeper.data.Stat;
@ -599,14 +596,12 @@ public class ZKUtil {
ZooKeeperWatcher zkw, String baseNode) throws KeeperException { ZooKeeperWatcher zkw, String baseNode) throws KeeperException {
List<String> nodes = List<String> nodes =
ZKUtil.listChildrenAndWatchForNewChildren(zkw, baseNode); ZKUtil.listChildrenAndWatchForNewChildren(zkw, baseNode);
List<NodeAndData> newNodes = Collections.emptyList(); List<NodeAndData> newNodes = new ArrayList<NodeAndData>();
if (nodes != null) { for (String node: nodes) {
for (String node : nodes) {
String nodePath = ZKUtil.joinZNode(baseNode, node); String nodePath = ZKUtil.joinZNode(baseNode, node);
byte[] data = ZKUtil.getDataAndWatch(zkw, nodePath); byte [] data = ZKUtil.getDataAndWatch(zkw, nodePath);
newNodes.add(new NodeAndData(nodePath, data)); newNodes.add(new NodeAndData(nodePath, data));
} }
}
return newNodes; return newNodes;
} }

View File

@ -432,6 +432,9 @@ public class HBaseTestingUtility {
// It's also deprecated // It's also deprecated
System.setProperty("test.cache.data", this.clusterTestDir.toString()); System.setProperty("test.cache.data", this.clusterTestDir.toString());
// Set the permissions for dfs data directories
this.conf.set("dfs.datanode.data.dir.perm", "700");
// Ok, now we can start // Ok, now we can start
this.dfsCluster = new MiniDFSCluster(0, this.conf, servers, true, true, this.dfsCluster = new MiniDFSCluster(0, this.conf, servers, true, true,
true, null, null, hosts, null); true, null, null, hosts, null);

View File

@ -343,18 +343,6 @@ public class TestZooKeeper {
ZKUtil.createAndFailSilent(zk2, aclZnode); ZKUtil.createAndFailSilent(zk2, aclZnode);
} }
@Test
/**
* Test should not fail with NPE when getChildDataAndWatchForNewChildren
* invoked with wrongNode
*/
public void testGetChildDataAndWatchForNewChildrenShouldNotThrowNPE()
throws Exception {
ZooKeeperWatcher zkw = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(),
"testGetChildDataAndWatchForNewChildrenShouldNotThrowNPE", null);
ZKUtil.getChildDataAndWatchForNewChildren(zkw, "/wrongNode");
}
@org.junit.Rule @org.junit.Rule
public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu = public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu =
new org.apache.hadoop.hbase.ResourceCheckerJUnitRule(); new org.apache.hadoop.hbase.ResourceCheckerJUnitRule();