-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Cache Implement
Look at pic 1. Doris supports two kinds of cache: sql cache and partition cache. The cache structure is sql key -> {<partition key, cache data>, <partition key, cache data>, <partition key, cache data>}. One sql has one cache node, one cache node has many partition cache point. But for sql cache, it has only one partition cache point, partition key is the latest partition id. When fetch cache data, it will compare partition key and partition version, partition update time to make sure the cache data available.
The Problem
When a table has four partitons [p202103, p202104, p202105, p202106].
- partition p202103 is loaded data into it, it is the latest partition.
select * from tablewill take the partition id of p202103 as the request param to fetche cache.- sql cache will be planted, like <sql_key, {<p202103, cache data>}
- partition p202104 is loaded data into it, it is the latest partition.
- execute sql query
select * from table, it will take the partition id of p202104 as the request param to fetche cache - sql cache will be planted, like <sql_key, {<p202103, cache data>, <p202104, cache data>}
Therefore, in this situation, one sql key will exist many version cache, the old version can not be replaced by new cache. We expected one sql key has only one version cache in case of memory waste.
