diff --git a/tests/queries/0_stateless/02494_query_cache_case_agnostic_matching.sql b/tests/queries/0_stateless/02494_query_cache_case_agnostic_matching.sql index 9f26d7759de..7dbd79059af 100644 --- a/tests/queries/0_stateless/02494_query_cache_case_agnostic_matching.sql +++ b/tests/queries/0_stateless/02494_query_cache_case_agnostic_matching.sql @@ -1,9 +1,8 @@ -- Tags: no-parallel -- Tag no-parallel: Messes with internal cache --- Start with empty query cache (QC) and query log +-- Start with empty query cache (QC) SYSTEM DROP QUERY CACHE; -DROP TABLE system.query_log SYNC; -- Insert an entry into the query cache. SELECT 1 SETTINGS use_query_cache = true; @@ -22,6 +21,7 @@ SYSTEM FLUSH LOGS; SELECT ProfileEvents['QueryCacheHits'], ProfileEvents['QueryCacheMisses'] FROM system.query_log WHERE type = 'QueryFinish' + AND current_database = currentDatabase() AND query = 'select 1 SETTINGS use_query_cache = true;'; SYSTEM DROP QUERY CACHE; diff --git a/tests/queries/0_stateless/02494_query_cache_events.reference b/tests/queries/0_stateless/02494_query_cache_events.reference index db60d3699e0..9bcd2820f27 100644 --- a/tests/queries/0_stateless/02494_query_cache_events.reference +++ b/tests/queries/0_stateless/02494_query_cache_events.reference @@ -3,4 +3,5 @@ 0 1 --- 1 +0 1 1 0 diff --git a/tests/queries/0_stateless/02494_query_cache_events.sql b/tests/queries/0_stateless/02494_query_cache_events.sql index 900b68f5eb2..05c0acad4b8 100644 --- a/tests/queries/0_stateless/02494_query_cache_events.sql +++ b/tests/queries/0_stateless/02494_query_cache_events.sql @@ -1,9 +1,8 @@ -- Tags: no-parallel -- Tag no-parallel: Messes with internal cache --- Start with empty query cache QC and query log +-- Start with empty query cache QC SYSTEM DROP QUERY CACHE; -DROP TABLE system.query_log SYNC; -- Run a query with QC on. The first execution is a QC miss. SELECT '---'; @@ -13,6 +12,7 @@ SYSTEM FLUSH LOGS; SELECT ProfileEvents['QueryCacheHits'], ProfileEvents['QueryCacheMisses'] FROM system.query_log WHERE type = 'QueryFinish' + AND current_database = currentDatabase() AND query = 'SELECT 1 SETTINGS use_query_cache = true;'; @@ -20,11 +20,12 @@ WHERE type = 'QueryFinish' SELECT '---'; SELECT 1 SETTINGS use_query_cache = true; -DROP TABLE system.query_log SYNC; SYSTEM FLUSH LOGS; SELECT ProfileEvents['QueryCacheHits'], ProfileEvents['QueryCacheMisses'] FROM system.query_log WHERE type = 'QueryFinish' - AND query = 'SELECT 1 SETTINGS use_query_cache = true;'; + AND current_database = currentDatabase() + AND query = 'SELECT 1 SETTINGS use_query_cache = true;' +ORDER BY event_time_microseconds; SYSTEM DROP QUERY CACHE; diff --git a/tests/queries/0_stateless/02494_query_cache_normalize_ast.sql b/tests/queries/0_stateless/02494_query_cache_normalize_ast.sql index 5fd09eb935b..1dbb3ef8158 100644 --- a/tests/queries/0_stateless/02494_query_cache_normalize_ast.sql +++ b/tests/queries/0_stateless/02494_query_cache_normalize_ast.sql @@ -1,9 +1,8 @@ -- Tags: no-parallel -- Tag no-parallel: Messes with internal cache --- Start with empty query cache (QC) and query log. +-- Start with empty query cache (QC) SYSTEM DROP QUERY CACHE; -DROP TABLE system.query_log SYNC; -- Run query whose result gets cached in the query cache. -- Besides "use_query_cache", pass two more knobs (one QC-specific knob and one non-QC-specific knob). We just care @@ -24,6 +23,7 @@ SYSTEM FLUSH LOGS; SELECT ProfileEvents['QueryCacheHits'], ProfileEvents['QueryCacheMisses'] FROM system.query_log WHERE type = 'QueryFinish' + AND current_database = currentDatabase() AND query = 'SELECT 1 SETTINGS use_query_cache = true, enable_writes_to_query_cache = false, max_threads = 16;'; SYSTEM DROP QUERY CACHE; diff --git a/tests/queries/0_stateless/02494_query_cache_passive_usage.reference b/tests/queries/0_stateless/02494_query_cache_passive_usage.reference index edff09773d1..8b73647196e 100644 --- a/tests/queries/0_stateless/02494_query_cache_passive_usage.reference +++ b/tests/queries/0_stateless/02494_query_cache_passive_usage.reference @@ -9,4 +9,5 @@ ----- 1 1 +0 1 1 0 diff --git a/tests/queries/0_stateless/02494_query_cache_passive_usage.sql b/tests/queries/0_stateless/02494_query_cache_passive_usage.sql index 6143b5f7083..f0d2f6398a8 100644 --- a/tests/queries/0_stateless/02494_query_cache_passive_usage.sql +++ b/tests/queries/0_stateless/02494_query_cache_passive_usage.sql @@ -22,10 +22,7 @@ SELECT COUNT(*) FROM system.query_cache; SELECT '-----'; --- Run same query with passive mode again. There must still be one entry in the QC and we must have a QC hit. - --- Get rid of log of previous SELECT -DROP TABLE system.query_log SYNC; +/* Run same query with passive mode again. There must still be one entry in the QC and we must have a QC hit. */ SELECT 1 SETTINGS use_query_cache = true, enable_writes_to_query_cache = false; SELECT COUNT(*) FROM system.query_cache; @@ -34,6 +31,9 @@ SYSTEM FLUSH LOGS; SELECT ProfileEvents['QueryCacheHits'], ProfileEvents['QueryCacheMisses'] FROM system.query_log WHERE type = 'QueryFinish' - AND query = 'SELECT 1 SETTINGS use_query_cache = true, enable_writes_to_query_cache = false;'; + AND current_database = currentDatabase() + /* NOTE: client incorrectly join comments from the previous line into query, hence LIKE */ + AND query LIKE '%\nSELECT 1 SETTINGS use_query_cache = true, enable_writes_to_query_cache = false;' +ORDER BY event_time_microseconds; SYSTEM DROP QUERY CACHE;