HBASE-6447 Common TestZooKeeper failures on jenkins: testMasterSessionExpired and testCreateSilentIsReallySilent
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1365502 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dcafdefbf6
commit
c5af2aeb18
|
@ -48,6 +48,7 @@ import org.apache.hadoop.hbase.master.HMaster;
|
||||||
import org.apache.hadoop.hbase.master.LoadBalancer;
|
import org.apache.hadoop.hbase.master.LoadBalancer;
|
||||||
import org.apache.hadoop.hbase.master.balancer.DefaultLoadBalancer;
|
import org.apache.hadoop.hbase.master.balancer.DefaultLoadBalancer;
|
||||||
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.zookeeper.EmptyWatcher;
|
import org.apache.hadoop.hbase.zookeeper.EmptyWatcher;
|
||||||
import org.apache.hadoop.hbase.zookeeper.ZKAssign;
|
import org.apache.hadoop.hbase.zookeeper.ZKAssign;
|
||||||
import org.apache.hadoop.hbase.zookeeper.ZKConfig;
|
import org.apache.hadoop.hbase.zookeeper.ZKConfig;
|
||||||
|
@ -202,7 +203,9 @@ public class TestZooKeeper {
|
||||||
testSanity();
|
testSanity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test Disabled because seems to make no sense expiring master session
|
||||||
|
// and then trying to create table (down in testSanity); on master side
|
||||||
|
// it will fail because the master's session has expired -- St.Ack 07/24/2012
|
||||||
public void testMasterSessionExpired() throws Exception {
|
public void testMasterSessionExpired() throws Exception {
|
||||||
LOG.info("Starting testMasterSessionExpired");
|
LOG.info("Starting testMasterSessionExpired");
|
||||||
TEST_UTIL.expireMasterSession();
|
TEST_UTIL.expireMasterSession();
|
||||||
|
@ -353,14 +356,46 @@ public class TestZooKeeper {
|
||||||
// Assumes the root of the ZooKeeper space is writable as it creates a node
|
// Assumes the root of the ZooKeeper space is writable as it creates a node
|
||||||
// wherever the cluster home is defined.
|
// wherever the cluster home is defined.
|
||||||
ZooKeeperWatcher zk2 = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(),
|
ZooKeeperWatcher zk2 = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(),
|
||||||
"testMasterAddressManagerFromZK",
|
"testMasterAddressManagerFromZK", null);
|
||||||
null);
|
|
||||||
|
|
||||||
// I set this acl after the attempted creation of the cluster home node.
|
// I set this acl after the attempted creation of the cluster home node.
|
||||||
zk.setACL("/", ZooDefs.Ids.CREATOR_ALL_ACL, -1);
|
// Add retries in case of retryable zk exceptions.
|
||||||
zk.create(aclZnode, null, ZooDefs.Ids.CREATOR_ALL_ACL, CreateMode.PERSISTENT);
|
while (true) {
|
||||||
zk.close();
|
try {
|
||||||
|
zk.setACL("/", ZooDefs.Ids.CREATOR_ALL_ACL, -1);
|
||||||
|
break;
|
||||||
|
} catch (KeeperException e) {
|
||||||
|
switch (e.code()) {
|
||||||
|
case CONNECTIONLOSS:
|
||||||
|
case SESSIONEXPIRED:
|
||||||
|
case OPERATIONTIMEOUT:
|
||||||
|
LOG.warn("Possibly transient ZooKeeper exception: " + e);
|
||||||
|
Threads.sleep(100);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
zk.create(aclZnode, null, ZooDefs.Ids.CREATOR_ALL_ACL, CreateMode.PERSISTENT);
|
||||||
|
break;
|
||||||
|
} catch (KeeperException e) {
|
||||||
|
switch (e.code()) {
|
||||||
|
case CONNECTIONLOSS:
|
||||||
|
case SESSIONEXPIRED:
|
||||||
|
case OPERATIONTIMEOUT:
|
||||||
|
LOG.warn("Possibly transient ZooKeeper exception: " + e);
|
||||||
|
Threads.sleep(100);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
zk.close();
|
||||||
ZKUtil.createAndFailSilent(zk2, aclZnode);
|
ZKUtil.createAndFailSilent(zk2, aclZnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue