-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add statement 'SYSTEM RELOAD ASYNCHRONOUS METRICS'
- Loading branch information
Showing
19 changed files
with
108 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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.
6 changes: 6 additions & 0 deletions
6
tests/integration/test_system_reload_async_metrics/configs/default.xml
This file contains 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,6 @@ | ||
<clickhouse> | ||
|
||
<asynchronous_metrics_update_period_s>60000</asynchronous_metrics_update_period_s> | ||
<asynchronous_heavy_metrics_update_period_s>60000</asynchronous_heavy_metrics_update_period_s> | ||
|
||
</clickhouse> |
46 changes: 46 additions & 0 deletions
46
tests/integration/test_system_reload_async_metrics/test.py
This file contains 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,46 @@ | ||
import os | ||
import pytest | ||
import shutil | ||
import time | ||
from helpers.cluster import ClickHouseCluster | ||
|
||
# Tests that SYSTEM RELOAD ASYNCHRONOUS METRICS works. | ||
|
||
# Config default.xml sets a large refresh interval of asynchronous metrics, so that the periodic updates don't interfere with the manual | ||
# update below. | ||
cluster = ClickHouseCluster(__file__) | ||
node = cluster.add_instance( | ||
"node", | ||
main_configs=["configs/default.xml"], | ||
stay_alive=True, | ||
) | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def start_cluster(): | ||
try: | ||
cluster.start() | ||
yield cluster | ||
finally: | ||
cluster.shutdown() | ||
|
||
|
||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) | ||
CONFIG_DIR = os.path.join(SCRIPT_DIR, "configs") | ||
|
||
|
||
def test_query_cache_size_is_runtime_configurable(start_cluster): | ||
node.query("SYSTEM DROP QUERY CACHE") | ||
|
||
res1 = node.query( | ||
"SELECT value FROM system.asynchronous_metrics WHERE metric = 'NumberOfTables'" | ||
) | ||
|
||
node.query("CREATE TABLE tab (col UInt64) ENGINE MergeTree ORDER BY tuple()") # do anything dumb | ||
|
||
node.query("SYSTEM RELOAD ASYNCHRONOUS METRICS") | ||
|
||
res2 = node.query( | ||
"SELECT value FROM system.asynchronous_metrics WHERE metric = 'NumberOfTables'" | ||
) | ||
assert int(res1.rstrip()) + 1 == int(res2.rstrip()) |
This file contains 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.
1 change: 1 addition & 0 deletions
1
tests/queries/0_stateless/02970_system_reload_asynchronous_metrics.sql
This file contains 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 @@ | ||
SYSTEM RELOAD ASYNCHRONOUS METRICS; |