-
Notifications
You must be signed in to change notification settings - Fork 7.3k
ZOOKEEPER-3546: Delete empty containers with cversion == 0 after a grace period #1091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -237,6 +237,22 @@ public Void call() throws Exception { | |
| assertEquals(queue.poll(5, TimeUnit.SECONDS), "/four"); | ||
| } | ||
|
|
||
| @Test(timeout = 30000) | ||
| public void testContainerWithNoChildGracePeriod() throws KeeperException, InterruptedException { | ||
| zk.create("/foo", new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.CONTAINER); | ||
|
|
||
| ContainerManager containerManager = new ContainerManager(serverFactory.getZooKeeperServer().getZKDatabase(), serverFactory.getZooKeeperServer().firstProcessor, 1, 100); | ||
| containerManager.checkContainers(); | ||
| Thread.sleep(1000); | ||
|
|
||
| assertNotNull("Container should still be there", zk.exists("/foo", false)); | ||
|
|
||
| containerManager.checkContainers(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we avoid this sleep?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used the same approach as other tests in that class, where I understand that these Did I miss something? |
||
| Thread.sleep(1000); | ||
|
|
||
| assertNull("Container should have been deleted", zk.exists("/foo", false)); | ||
| } | ||
|
|
||
| private void createNoStatVerifyResult(String newName) throws KeeperException, InterruptedException { | ||
| assertNull("Node existed before created", zk.exists(newName, false)); | ||
| zk.create(newName, newName.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.CONTAINER); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At a first glance we are only adding elements and never clearing the collection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we do it outside of the
getChildren().isEmpty()test. Children may have been added since the container was added to that collection, so we need to make sure that containers with children don't stay in it forever.