zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject session expiration testing
Date Wed, 04 May 2011 00:35:07 GMT
I have built an HA component that includes handling for session expiration.
 I would like to test that code.

This FAQ seems to imply that this is simple:

http://wiki.apache.org/hadoop/ZooKeeper/FAQ#A4

Based on that, I do this:

    ZooKeeper keeper = lm.getZk();
    ZooKeeper zkClone = new ZooKeeper("localhost:" + zkPort, 0, new
Watcher() {
      @Override
      public void process(WatchedEvent event) {
        // ignore
      }
    }, keeper.getSessionId(), keeper.getSessionPasswd());
    zkClone.close();

The lm object is my HA thing-thing.  This seems plausibly correct based on
the FAQ answer, but then I do this:

    keeper.getChildren("/", false);

I would expect that this would throw a session expired exception.

It does not.

The server that I am using was started in the before class part of the test:

    zs = new ZooKeeperServer(tmpdir, tmpdir, 1000);
    SyncRequestProcessor.setSnapCount(150);
    NIOServerCnxn.Factory f = new NIOServerCnxn.Factory(new
InetSocketAddress(zkPort));
    f.startup(zs);
    log.info("starting up the zookeeper server .. waiting");
    Assert.assertTrue("waiting for server being up", waitForServerUp(zkPort,
2000));

This is code that I stole from the ZK test classes and it seems to work for
my other tests.

My questions are:

a) did I misread the FAQ?

b) is the FAQ correct?

c) is there an obvious and silly error in my code?

d) WTF?

Anybody have any thoughts?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message