Remove flaky test_page_cache

This commit is contained in:
Michael Kolupaev 2024-11-28 21:06:37 +00:00
parent e7e30d67fb
commit 29b722df29

View File

@ -329,75 +329,6 @@ def test_replicated_database(cluster):
node2.query("DROP DATABASE rdb SYNC")
def test_page_cache(cluster):
node = cluster.instances["node2"]
global uuids
assert len(uuids) == 3
for i in range(3):
node.query(
"""
CREATE TABLE test{} UUID '{}'
(id Int32) ENGINE = MergeTree() ORDER BY id
SETTINGS storage_policy = 'web';
""".format(
i, uuids[i]
)
)
result1 = node.query(
f"SELECT sum(cityHash64(*)) FROM test{i} SETTINGS use_page_cache_for_disks_without_file_cache=1 -- test cold cache"
)
result2 = node.query(
f"SELECT sum(cityHash64(*)) FROM test{i} SETTINGS use_page_cache_for_disks_without_file_cache=1 -- test warm cache"
)
result3 = node.query(
f"SELECT sum(cityHash64(*)) FROM test{i} SETTINGS use_page_cache_for_disks_without_file_cache=0 -- test no cache"
)
assert result1 == result3
assert result2 == result3
node.query("SYSTEM FLUSH LOGS")
def get_profile_events(query_name):
text = node.query(
f"SELECT ProfileEvents.Names, ProfileEvents.Values FROM system.query_log ARRAY JOIN ProfileEvents WHERE query LIKE '% -- {query_name}' AND type = 'QueryFinish'"
)
res = {}
for line in text.split("\n"):
if line == "":
continue
name, value = line.split("\t")
res[name] = int(value)
return res
ev1 = get_profile_events("test cold cache")
assert ev1.get("PageCacheChunkMisses", 0) > 0
assert (
ev1.get("DiskConnectionsCreated", 0) + ev1.get("DiskConnectionsReused", 0)
> 0
)
ev2 = get_profile_events("test warm cache")
assert ev2.get("PageCacheChunkDataHits", 0) > 0
assert ev2.get("PageCacheChunkMisses", 0) == 0
assert (
ev2.get("DiskConnectionsCreated", 0) + ev2.get("DiskConnectionsReused", 0)
== 0
)
ev3 = get_profile_events("test no cache")
assert ev3.get("PageCacheChunkDataHits", 0) == 0
assert ev3.get("PageCacheChunkMisses", 0) == 0
assert (
ev3.get("DiskConnectionsCreated", 0) + ev3.get("DiskConnectionsReused", 0)
> 0
)
node.query("DROP TABLE test{} SYNC".format(i))
print(f"Ok {i}")
def test_config_reload(cluster):
node1 = cluster.instances["node5"]
table_name = "config_reload"