loserwang1024 commented on code in PR #4422:
URL: https://github.com/apache/flink-cdc/pull/4422#discussion_r3748352096
##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/config/MySqlSourceConfig.java:
##########
@@ -284,6 +286,31 @@ public Predicate<TableId> getTableFilter() {
return tableId ->
tableFilters.dataCollectionFilter().isIncluded(tableId);
}
+ static Tables.TableFilter createCachedTableFilter(
+ Tables.TableFilter tableFilter, @Nullable Selectors
excludeTableFilter) {
+ LoadingCache<TableId, Boolean> tableFilterCache =
+ CacheBuilder.newBuilder()
+ .expireAfterAccess(TABLE_FILTER_CACHE_EXPIRE_DURATION)
+ .maximumSize(TABLE_FILTER_CACHE_MAXIMUM_SIZE)
+ .build(
+ new CacheLoader<TableId, Boolean>() {
+ @Override
+ public Boolean load(TableId tableId) {
Review Comment:
We should implement negative caching here. Even if a table name doesn't
match any regex in the cache, we should still store a 'null' or 'not found'
entry.
Without this, every log line for an invalid/non-matching table will trigger
an unnecessary and expensive regex matching operation against the entire rule
set. Caching the negative result prevents this repeated overhead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]