Log dir locked after ZK shutdown

2014-09-02 Thread Stevo Slavić
Hello ZooKeeper community,

In ZK (3.4.6) related tests, if I try to delete ZK data directory
immediatelly after calling shutdown on server connection factory, only on
Windows I get an IOException that a file could not be deleted. On Linux and
Mac same code works well.

I'm creating a temporary director using Java 7
Files.createTempDirectory(zookeeper-)
resulting in directory similar to the following:

C:\Users\Foo\AppData\Local\Temp\zookeeper-4563523978878660799\

Then ZooKeeper is configured to use this as data directory.

To delete it I'm using FileUtils.deleteDirectory from commons-io (2.4)
It walks the directory tree cleaning it up. It fails deleting log file

C:\Users\Foo\AppData\Local\Temp\zookeeper-4563523978878660799\version-2\log.1

Is there something else I have to call to make sure
ZooKeeperServer/ServerCnxnFactory is stopped and released all locks?
If not, is this a known bug/feature?


Kind regards,
Stevo Slavic.


Re: Log dir locked after ZK shutdown

2014-09-02 Thread Stevo Slavić
Found out through experiment - after shoutdown I also had to close ZK
server database.

I wonder why isn't this part of the server shutdown? ZooKeeperServer
shutdown currently (ZK 3.4.6) calls only clear on database.

Kind regards,
Stevo Slavic.


On Tue, Sep 2, 2014 at 5:19 PM, Stevo Slavić ssla...@gmail.com wrote:

 Hello ZooKeeper community,

 In ZK (3.4.6) related tests, if I try to delete ZK data directory
 immediatelly after calling shutdown on server connection factory, only on
 Windows I get an IOException that a file could not be deleted. On Linux and
 Mac same code works well.

 I'm creating a temporary director using Java 7
 Files.createTempDirectory(zookeeper-)
 resulting in directory similar to the following:

 C:\Users\Foo\AppData\Local\Temp\zookeeper-4563523978878660799\

 Then ZooKeeper is configured to use this as data directory.

 To delete it I'm using FileUtils.deleteDirectory from commons-io (2.4)
 It walks the directory tree cleaning it up. It fails deleting log file


 C:\Users\Foo\AppData\Local\Temp\zookeeper-4563523978878660799\version-2\log.1

 Is there something else I have to call to make sure
 ZooKeeperServer/ServerCnxnFactory is stopped and released all locks?
 If not, is this a known bug/feature?


 Kind regards,
 Stevo Slavic.



Re: Log dir locked after ZK shutdown

2014-09-02 Thread Rakesh Radhakrishnan
Hi Stevo Slavic,

I hope you are experimenting with standalone server. Please see
ZooKeeperServerMain#runFromConfig() to see how a standalone server can be
started/shutdown.  Also, you can refer ZooKeeperServerMainTest to see
standalone tests.

Yes, ZKServer#shutdown is not releasing all the resources, instead it is
only clearing. One reason I can see is - in case of quorum lost, before
entering into the next leader election phase it will only clear out all the
data structures maintained in its database by calling #shutdown. Server
will keep the I/O resources in hand as re-establishing resources is again
costlier one.

Regards,
Rakesh


On Tue, Sep 2, 2014 at 10:06 PM, Stevo Slavić ssla...@gmail.com wrote:

 Found out through experiment - after shoutdown I also had to close ZK
 server database.

 I wonder why isn't this part of the server shutdown? ZooKeeperServer
 shutdown currently (ZK 3.4.6) calls only clear on database.

 Kind regards,
 Stevo Slavic.


 On Tue, Sep 2, 2014 at 5:19 PM, Stevo Slavić ssla...@gmail.com wrote:

  Hello ZooKeeper community,
 
  In ZK (3.4.6) related tests, if I try to delete ZK data directory
  immediatelly after calling shutdown on server connection factory, only on
  Windows I get an IOException that a file could not be deleted. On Linux
 and
  Mac same code works well.
 
  I'm creating a temporary director using Java 7
  Files.createTempDirectory(zookeeper-)
  resulting in directory similar to the following:
 
  C:\Users\Foo\AppData\Local\Temp\zookeeper-4563523978878660799\
 
  Then ZooKeeper is configured to use this as data directory.
 
  To delete it I'm using FileUtils.deleteDirectory from commons-io (2.4)
  It walks the directory tree cleaning it up. It fails deleting log file
 
 
 
 C:\Users\Foo\AppData\Local\Temp\zookeeper-4563523978878660799\version-2\log.1
 
  Is there something else I have to call to make sure
  ZooKeeperServer/ServerCnxnFactory is stopped and released all locks?
  If not, is this a known bug/feature?
 
 
  Kind regards,
  Stevo Slavic.