You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had searched in the issues and found no similar issues.
Version
all version
What's Wrong?
When enable query sql cache, if we delete some partition(s), the cache will not be refreshed and the query will return wrong result.
What You Expected?
Query cache should return right result.
How to Reproduce?
At fe.conf, set cache_last_version_interval_second=0, cache_enable_sql_mode=true, then set session variable set enable_sql_cache=true, and create a table like this:
CREATETABLE `tbl_test` (
`siteid`int(11) NOT NULL DEFAULT "10",
`citycode`smallint(6) NOT NULL DEFAULT "0",
`username`varchar(32) NOT NULL DEFAULT "",
`pday`varchar(20) NOT NULL DEFAULT "",
`pv`bigint(20) SUM NOT NULL DEFAULT "0",
INDEX siteid_Idx (`siteid`) USING BITMAP COMMENT '创建表加siteid列索引'
) ENGINE=OLAP
AGGREGATE KEY(`siteid`, `citycode`, `username`, `pday`)
PARTITION BY LIST(`pday`)
(
PARTITION `p_20230825`VALUESIN ("20230825"),
PARTITION `p_20230826`VALUESIN ("20230826"),
PARTITION `p_20230827`VALUESIN ("20230827")
)
DISTRIBUTED BY HASH(`siteid`) BUCKETS 10
PROPERTIES (
"replication_allocation"="tag.location.default: 1"
);
execute a query: select * from tbl_test, it will return 3 rows.
delete partition p_20230826 by executing alter table tbl_test drop partition p_20230826.
execute this query again: select * from tbl_test, it will return 3 rows too (in fact the right result should be 2, the row in partition p_20230826 should not be returned).
Anything Else?
The reason is that sql cache just use partitionKey , latestVersion and latestTime to check if the cache should be returned, if we delete some partition(s) which is not the latest updated partition, the all above values are not changed, so the cache will hit.
Test the master branch code and the problem cannot be repeated.The cache_last_version_interval_second variable does not exist.
Oh, this is a FE configuration, set these configurations cache_last_version_interval_second=0, cache_enable_sql_mode=true at fe.conf, and set session variable by executing set enable_sql_cache=true to enable sql cache.
Search before asking
Version
all version
What's Wrong?
When enable query sql cache, if we delete some partition(s), the cache will not be refreshed and the query will return wrong result.
What You Expected?
Query cache should return right result.
How to Reproduce?
fe.conf
, setcache_last_version_interval_second=0
,cache_enable_sql_mode=true
, then set session variableset enable_sql_cache=true
, and create a table like this:select * from tbl_test
, it will return 3 rows.p_20230826
by executingalter table tbl_test drop partition p_20230826
.select * from tbl_test
, it will return 3 rows too (in fact the right result should be 2, the row in partitionp_20230826
should not be returned).Anything Else?
The reason is that sql cache just use
partitionKey
,latestVersion
andlatestTime
to check if the cache should be returned, if we delete some partition(s) which is not the latest updated partition, the all above values are not changed, so the cache will hit.Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: