'connector.lookup.cache.max-rows' 是什么意思

What does 'connector.lookup.cache.max-rows' mean

当我定义一个mysqltable作为维度table时,定义如下:


CREATE TABLE MyUserTable (
  ...
) WITH (
  'connector.type' = 'jdbc', -- required: specify this table type is jdbc
  
  'connector.url' = 'jdbc:mysql://localhost:3306/flink-test', -- required: JDBC DB url
  
  'connector.table' = 'jdbc_table_name',  -- required: jdbc table name
  
  'connector.driver' = 'com.mysql.jdbc.Driver', -- optional: the class name of the JDBC driver to use to connect to this URL. 
                                                -- If not set, it will automatically be derived from the URL.

  'connector.username' = 'name', -- optional: jdbc user name and password
  'connector.password' = 'password',
  'connector.lookup.cache.max-rows' = '5000', -- optional, max number of rows of lookup cache, over this value, the oldest rows will
                                              -- be eliminated. "cache.max-rows" and "cache.ttl" options must all be specified if any
                                              -- of them is specified. Cache is not enabled as default.
  'connector.lookup.cache.ttl' = '10s', -- optional, the max time to live for each rows in lookup cache, over this time, the oldest rows
                                        -- will be expired. "cache.max-rows" and "cache.ttl" options must all be specified if any of
                                        -- them is specified. Cache is not enabled as default.
  'connector.lookup.max-retries' = '3', -- optional, max retry times if lookup database failed

我定义了connector.lookup.cache.max-rows = 5000connector.lookup.cache.ttl = 10s

如果我的mysqltable有10001行(多于connector.lookup.cache.max-rows),是否意味着

  1. mysqltable中的前 5000 行将被缓存?
  2. 10s后,这5000行会过期,mysqltable中另外5000行会被缓存吗?

我认为它的行为与我上面描述的不一样,那么,如果我的行数(此处为 10001)多于 connector.lookup.cache.max-rows(此处为 500)[=16] 所指定的行数,确切的行为是什么=]

我相信它的工作方式是每次缓存未命中时,连接器都会从数据库中读取 scan.fetch-size 行。

行在其 TTL 过期时从缓存中过期,并且在缓存已满时踢出最旧的行以为新获取的行腾出空间。

docs 更详细地描述了查找缓存行为。