forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 14
Implement clear parquet metadata cache command #713
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
44faec6
implement clear parquet metadata cache command, no tests for cluster yet
arthurpassos 6971379
add cluster tests
arthurpassos e53b670
Merge branch 'antalya' into clear_parquet_metadata_cache
arthurpassos 58f3cb1
Update test.py
arthurpassos 0baf53d
Update test.py
arthurpassos 7f60fc2
move config dir
arthurpassos f612bd5
fix minioendpoint and withminio
arthurpassos 32f5d58
fix integ tests
arthurpassos 97ca59e
throw in case support is disabled and command is used
arthurpassos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
20 changes: 20 additions & 0 deletions
20
tests/integration/test_parquet_drop_metadata_cache/configs/config.d/cluster.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <clickhouse> | ||
| <remote_servers> | ||
| <parquet_clear_cache_cluster> | ||
| <shard> | ||
| <replica> | ||
| <host>node1</host> | ||
| <port>9000</port> | ||
| </replica> | ||
| <replica> | ||
| <host>node2</host> | ||
| <port>9000</port> | ||
| </replica> | ||
| <replica> | ||
| <host>node3</host> | ||
| <port>9000</port> | ||
| </replica> | ||
| </shard> | ||
| </parquet_clear_cache_cluster> | ||
| </remote_servers> | ||
| </clickhouse> |
69 changes: 69 additions & 0 deletions
69
tests/integration/test_parquet_drop_metadata_cache/test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import pytest | ||
| from helpers.cluster import ClickHouseCluster | ||
| import time | ||
|
|
||
| cluster = ClickHouseCluster(__file__) | ||
| node1 = cluster.add_instance("node1", main_configs=["configs/config.d/cluster.xml"], with_zookeeper=True, with_minio=True) | ||
| node2 = cluster.add_instance("node2", main_configs=["configs/config.d/cluster.xml"], with_zookeeper=True) | ||
| node3 = cluster.add_instance("node3", main_configs=["configs/config.d/cluster.xml"], with_zookeeper=True) | ||
|
|
||
|
|
||
| @pytest.fixture(scope="module") | ||
| def started_cluster(): | ||
| try: | ||
| cluster.start() | ||
| yield cluster | ||
| finally: | ||
| cluster.shutdown() | ||
|
|
||
|
|
||
| def test_clear_cache_on_cluster(started_cluster): | ||
| node1.query("INSERT INTO TABLE FUNCTION s3('http://minio1:9001/root/data/test_clear_cache/{_partition_id}.parquet', 'minio', 'minio123', 'Parquet') PARTITION BY number SELECT number FROM numbers(1, 3)") | ||
|
|
||
| node1.query("SELECT * FROM s3('http://minio1:9001/root/data/test_clear_cache/1.parquet', 'minio', 'minio123', 'Parquet') SETTINGS log_comment='cold_cache'") | ||
| node2.query("SELECT * FROM s3('http://minio1:9001/root/data/test_clear_cache/2.parquet', 'minio', 'minio123', 'Parquet') SETTINGS log_comment='cold_cache'") | ||
| node3.query("SELECT * FROM s3('http://minio1:9001/root/data/test_clear_cache/3.parquet', 'minio', 'minio123', 'Parquet') SETTINGS log_comment='cold_cache'") | ||
|
|
||
| node1.query("SYSTEM FLUSH LOGS ON CLUSTER parquet_clear_cache_cluster") | ||
|
|
||
| cold_cache_result_n1 = node1.query("SELECT ProfileEvents['ParquetMetaDataCacheHits'] FROM system.query_log where log_comment = 'cold_cache' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
| cold_cache_result_n2 = node2.query("SELECT ProfileEvents['ParquetMetaDataCacheHits'] FROM system.query_log where log_comment = 'cold_cache' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
| cold_cache_result_n3 = node3.query("SELECT ProfileEvents['ParquetMetaDataCacheHits'] FROM system.query_log where log_comment = 'cold_cache' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
|
|
||
| assert(cold_cache_result_n1 == cold_cache_result_n2 == cold_cache_result_n3) | ||
| assert(cold_cache_result_n1 == '0\n') | ||
|
|
||
| node1.query("SELECT * FROM s3('http://minio1:9001/root/data/test_clear_cache/1.parquet', 'minio', 'minio123', 'Parquet') SETTINGS log_comment='hot_cache'") | ||
| node2.query("SELECT * FROM s3('http://minio1:9001/root/data/test_clear_cache/2.parquet', 'minio', 'minio123', 'Parquet') SETTINGS log_comment='hot_cache'") | ||
| node3.query("SELECT * FROM s3('http://minio1:9001/root/data/test_clear_cache/3.parquet', 'minio', 'minio123', 'Parquet') SETTINGS log_comment='hot_cache'") | ||
|
|
||
| node1.query("SYSTEM FLUSH LOGS ON CLUSTER parquet_clear_cache_cluster") | ||
|
|
||
| warm_cache_result_n1 = node1.query("SELECT ProfileEvents['ParquetMetaDataCacheHits'] FROM system.query_log where log_comment = 'hot_cache' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
| warm_cache_result_n2 = node2.query("SELECT ProfileEvents['ParquetMetaDataCacheHits'] FROM system.query_log where log_comment = 'hot_cache' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
| warm_cache_result_n3 = node3.query("SELECT ProfileEvents['ParquetMetaDataCacheHits'] FROM system.query_log where log_comment = 'hot_cache' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
|
|
||
| assert(warm_cache_result_n1 == warm_cache_result_n2 == warm_cache_result_n3) | ||
| assert(warm_cache_result_n1 == '1\n') | ||
|
|
||
| node1.query("SYSTEM DROP PARQUET METADATA CACHE ON CLUSTER parquet_clear_cache_cluster") | ||
|
|
||
| node1.query("SELECT * FROM s3('http://minio1:9001/root/data/test_clear_cache/1.parquet', 'minio', 'minio123', 'Parquet') SETTINGS log_comment='cache_after_drop'") | ||
| node2.query("SELECT * FROM s3('http://minio1:9001/root/data/test_clear_cache/2.parquet', 'minio', 'minio123', 'Parquet') SETTINGS log_comment='cache_after_drop'") | ||
| node3.query("SELECT * FROM s3('http://minio1:9001/root/data/test_clear_cache/3.parquet', 'minio', 'minio123', 'Parquet') SETTINGS log_comment='cache_after_drop'") | ||
|
|
||
| node1.query("SYSTEM FLUSH LOGS ON CLUSTER parquet_clear_cache_cluster") | ||
|
|
||
| cache_after_drop_result_n1 = node1.query("SELECT ProfileEvents['ParquetMetaDataCacheHits'] FROM system.query_log where log_comment = 'cache_after_drop' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
| cache_after_drop_result_n2 = node2.query("SELECT ProfileEvents['ParquetMetaDataCacheHits'] FROM system.query_log where log_comment = 'cache_after_drop' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
| cache_after_drop_result_n3 = node3.query("SELECT ProfileEvents['ParquetMetaDataCacheHits'] FROM system.query_log where log_comment = 'cache_after_drop' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
|
|
||
| assert(cache_after_drop_result_n1 == cache_after_drop_result_n2 == cache_after_drop_result_n3) | ||
| assert(cache_after_drop_result_n1 == '0\n') | ||
|
|
||
| misses_after_drop_result_n1 = node1.query("SELECT ProfileEvents['ParquetMetaDataCacheMisses'] FROM system.query_log where log_comment = 'cache_after_drop' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
| misses_after_drop_result_n2 = node2.query("SELECT ProfileEvents['ParquetMetaDataCacheMisses'] FROM system.query_log where log_comment = 'cache_after_drop' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
| misses_after_drop_result_n3 = node3.query("SELECT ProfileEvents['ParquetMetaDataCacheMisses'] FROM system.query_log where log_comment = 'cache_after_drop' AND type = 'QueryFinish' ORDER BY event_time desc LIMIT 1;") | ||
|
|
||
| assert(misses_after_drop_result_n1 == misses_after_drop_result_n2 == misses_after_drop_result_n3) | ||
| assert(misses_after_drop_result_n1 == '1\n') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,6 @@ | |
| 10 | ||
| 10 | ||
| 10 | ||
| 10 | ||
| 0 | ||
| 10 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
NIT: May be throw exception when USE_PARQUET not defined, as for USE_EMBEDDED_COMPILER below?
(I don't think than sometimes someone assemble clickhouse without parquet support)