This is an automated email from the ASF dual-hosted git repository. jark pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push: new c782735 [FLINK-25065][docs] Update document for "lookup.cache.caching-missing-key" option for jdbc connector (#17918) c782735 is described below commit c782735a872b2b25ee49e019eae21e174e6330e2 Author: gaurav726 <y14uc...@lnmiit.ac.in> AuthorDate: Mon Nov 29 18:07:41 2021 +0530 [FLINK-25065][docs] Update document for "lookup.cache.caching-missing-key" option for jdbc connector (#17918) --- docs/content.zh/docs/connectors/table/jdbc.md | 9 +++++++++ docs/content/docs/connectors/table/jdbc.md | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/content.zh/docs/connectors/table/jdbc.md b/docs/content.zh/docs/connectors/table/jdbc.md index 774362b..ff1cbe4 100644 --- a/docs/content.zh/docs/connectors/table/jdbc.md +++ b/docs/content.zh/docs/connectors/table/jdbc.md @@ -209,6 +209,13 @@ ON myTopic.key = MyUserTable.id; 默认情况下,lookup cache 是未开启的。请参阅下面的 <a href="#lookup-cache">Lookup Cache</a> 部分了解更多详情。</td> </tr> <tr> + <td><h5>lookup.cache.caching-missing-key</h5></td> + <td>可选</td> + <td style="word-wrap: break-word;">true</td> + <td>Boolean</td> + <td>标记缓存丢失的键,默认为true</td> + </tr> + <tr> <td><h5>lookup.max-retries</h5></td> <td>可选</td> <td style="word-wrap: break-word;">3</td> @@ -280,6 +287,8 @@ lookup cache 的主要目的是用于提高时态表关联 JDBC 连接器的性 当缓存命中最大缓存行 `lookup.cache.max-rows` 或当行超过最大存活时间 `lookup.cache.ttl` 时,缓存中最老的行将被设置为已过期。 缓存中的记录可能不是最新的,用户可以将 `lookup.cache.ttl` 设置为一个更小的值以获得更好的刷新数据,但这可能会增加发送到数据库的请求数。所以要做好吞吐量和正确性之间的平衡。 +默认情况下,flink 会缓存主键的空查询结果,您可以通过将 `lookup.cache.caching-missing-key` 设置为 false 来切换行为。 + ### 幂等写入 如果在 DDL 中定义了主键,JDBC sink 将使用 upsert 语义而不是普通的 INSERT 语句。upsert 语义指的是如果底层数据库中存在违反唯一性约束,则原子地添加新行或更新现有行,这种方式确保了幂等性。 diff --git a/docs/content/docs/connectors/table/jdbc.md b/docs/content/docs/connectors/table/jdbc.md index 75d6aa2..bffca22 100644 --- a/docs/content/docs/connectors/table/jdbc.md +++ b/docs/content/docs/connectors/table/jdbc.md @@ -210,7 +210,7 @@ Connector Options <tr> <td><h5>lookup.cache.caching-missing-key</h5></td> <td>optional</td> - <td style="word-wrap: break-word;">3</td> + <td style="word-wrap: break-word;">true</td> <td>Boolean</td> <td>Flag to cache missing key, true by default</td> </tr> @@ -286,6 +286,8 @@ When lookup cache is enabled, each process (i.e. TaskManager) will hold a cache. The oldest rows in cache will be expired when the cache hit to the max cached rows `lookup.cache.max-rows` or when the row exceeds the max time to live `lookup.cache.ttl`. The cached rows might not be the latest, users can tune `lookup.cache.ttl` to a smaller value to have a better fresh data, but this may increase the number of requests send to database. So this is a balance between throughput and correctness. +By default, flink will cache the empty query result for a Primary key, you can toggle the behaviour by setting `lookup.cache.caching-missing-key` to false. + ### Idempotent Writes JDBC sink will use upsert semantics rather than plain INSERT statements if primary key is defined in DDL. Upsert semantics refer to atomically adding a new row or updating the existing row if there is a unique constraint violation in the underlying database, which provides idempotence.