mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
Merge pull request #69549 from rschu1ze/qc-with-truncated-results
Disallow query cache for queries with non-throw overflow mode
This commit is contained in:
commit
c9dd409baa
@ -1118,6 +1118,19 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
|
|||||||
&& settings.use_query_cache
|
&& settings.use_query_cache
|
||||||
&& !internal
|
&& !internal
|
||||||
&& client_info.query_kind == ClientInfo::QueryKind::INITIAL_QUERY
|
&& client_info.query_kind == ClientInfo::QueryKind::INITIAL_QUERY
|
||||||
|
/// Bug 67476: Avoid that the query cache stores truncated results if the query ran with a non-THROW overflow mode and hit a limit.
|
||||||
|
/// This is more workaround than a fix ... unfortunately it is hard to detect from the perspective of the query cache that the
|
||||||
|
/// query result is truncated.
|
||||||
|
&& (settings.read_overflow_mode == OverflowMode::THROW
|
||||||
|
&& settings.read_overflow_mode_leaf == OverflowMode::THROW
|
||||||
|
&& settings.group_by_overflow_mode == OverflowMode::THROW
|
||||||
|
&& settings.sort_overflow_mode == OverflowMode::THROW
|
||||||
|
&& settings.result_overflow_mode == OverflowMode::THROW
|
||||||
|
&& settings.timeout_overflow_mode == OverflowMode::THROW
|
||||||
|
&& settings.set_overflow_mode == OverflowMode::THROW
|
||||||
|
&& settings.join_overflow_mode == OverflowMode::THROW
|
||||||
|
&& settings.transfer_overflow_mode == OverflowMode::THROW
|
||||||
|
&& settings.distinct_overflow_mode == OverflowMode::THROW)
|
||||||
&& (ast->as<ASTSelectQuery>() || ast->as<ASTSelectWithUnionQuery>());
|
&& (ast->as<ASTSelectQuery>() || ast->as<ASTSelectWithUnionQuery>());
|
||||||
QueryCache::Usage query_cache_usage = QueryCache::Usage::None;
|
QueryCache::Usage query_cache_usage = QueryCache::Usage::None;
|
||||||
|
|
||||||
|
@ -22,3 +22,24 @@ Row 1:
|
|||||||
──────
|
──────
|
||||||
x: 1
|
x: 1
|
||||||
2
|
2
|
||||||
|
-- Bug 67476: Queries with overflow mode != throw must not be cached by the query cache
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
@ -36,4 +36,32 @@ SELECT count(*) FROM system.query_cache;
|
|||||||
|
|
||||||
DROP TABLE tab;
|
DROP TABLE tab;
|
||||||
|
|
||||||
|
SELECT '-- Bug 67476: Queries with overflow mode != throw must not be cached by the query cache';
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS tab;
|
||||||
|
|
||||||
|
CREATE TABLE tab(c UInt64) ENGINE = Memory;
|
||||||
|
|
||||||
|
SYSTEM DROP QUERY CACHE;
|
||||||
|
SELECT sum(c) FROM tab SETTINGS read_overflow_mode = 'break', use_query_cache = 1;
|
||||||
|
SELECT count(*) from system.query_cache;
|
||||||
|
SELECT sum(c) FROM tab SETTINGS read_overflow_mode_leaf = 'break', use_query_cache = 1;
|
||||||
|
SELECT count(*) from system.query_cache;
|
||||||
|
SELECT sum(c) FROM tab SETTINGS group_by_overflow_mode = 'break', use_query_cache = 1;
|
||||||
|
SELECT count(*) from system.query_cache;
|
||||||
|
SELECT sum(c) FROM tab SETTINGS sort_overflow_mode = 'break', use_query_cache = 1;
|
||||||
|
SELECT count(*) from system.query_cache;
|
||||||
|
SELECT sum(c) FROM tab SETTINGS result_overflow_mode = 'break', use_query_cache = 1;
|
||||||
|
SELECT count(*) from system.query_cache;
|
||||||
|
SELECT sum(c) FROM tab SETTINGS timeout_overflow_mode = 'break', use_query_cache = 1;
|
||||||
|
SELECT count(*) from system.query_cache;
|
||||||
|
SELECT sum(c) FROM tab SETTINGS set_overflow_mode = 'break', use_query_cache = 1;
|
||||||
|
SELECT count(*) from system.query_cache;
|
||||||
|
SELECT sum(c) FROM tab SETTINGS join_overflow_mode = 'break', use_query_cache = 1;
|
||||||
|
SELECT count(*) from system.query_cache;
|
||||||
|
SELECT sum(c) FROM tab SETTINGS transfer_overflow_mode = 'break', use_query_cache = 1;
|
||||||
|
SELECT count(*) from system.query_cache;
|
||||||
|
SELECT sum(c) FROM tab SETTINGS distinct_overflow_mode = 'break', use_query_cache = 1;
|
||||||
|
SELECT count(*) from system.query_cache;
|
||||||
|
|
||||||
SYSTEM DROP QUERY CACHE;
|
SYSTEM DROP QUERY CACHE;
|
||||||
|
Loading…
Reference in New Issue
Block a user