Skip to content
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

Some zookeeper znodes can remain after database or table are dropped #58964

Closed
hamidtahi opened this issue Jan 18, 2024 · 4 comments · Fixed by #57575
Closed

Some zookeeper znodes can remain after database or table are dropped #58964

hamidtahi opened this issue Jan 18, 2024 · 4 comments · Fixed by #57575
Labels
question Question?

Comments

@hamidtahi
Copy link

Version: 23.10.4.25 + zookeeper 3.8.2

It seems with the default replica path, if a table is created and dropped, one or more znodes associated with that table may not get deleted.

This can be problematic if, for example, automated tests are creating and deleting unique databases and tables, causing znodes to grow. It would require manual znode cleanup from time to time, which is not ideal.

Is this intended behaviour, if so could the reasoning be explained? Is there any setting that can help with clean up of these stale znodes?

To reproduce:

Create database:
create database test on cluster default

Create table:

CREATE TABLE IF NOT EXISTS test.mytable ON CLUSTER default
(
   a Int32,
   d DateTime64 DEFAULT now(),
) ENGINE = ReplicatedMergeTree()
PARTITION BY toYYYYMM(d)
ORDER BY (d)

Internally this uses the default replica path: ENGINE = ReplicatedMergeTree('/clickhouse/tables/{uuid}/{shard}', '{replica}')

Drop the database:
drop database test on cluster default sync

The /clickhouse/tables/{uuid} znode will not get deleted:

getAllChildrenNumber /clickhouse/tables
1
SELECT *
FROM system.zookeeper
WHERE path = '/clickhouse/tables'
FORMAT Vertical

Query id: 75e82258-60db-4bd6-bcae-4745023cbcaf

Row 1:
──────
name:  522b38bb-a75a-4fc3-b223-b6f0037ff78d
value:
path:  /clickhouse/tables
@hamidtahi hamidtahi added the question Question? label Jan 18, 2024
@tavplubix
Copy link
Member

Will be fixed by #57575

@hamidtahi
Copy link
Author

Hi, on version 24.8.5.115 I am still running into this issue and can reproduce as per the steps in the original post. After dropping the database, the node at path '/clickhouse/tables/{uuid}' does not get deleted, but the children nodes do.

Is this expected?

@tavplubix
Copy link
Member

Yes, it's expected

@hamidtahi
Copy link
Author

Is there any setting/solution to have the node at path '/clickhouse/tables/{uuid}' to get cleaned up as well? This can cause keeper nodes to keep growing in cases where new databases with unique names are created and deleted frequently. For example, if automated testing is creating and dropping databases with timestamp in the name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question?
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants