Skip to content

Commit

Permalink
Replaced String.matches with Pattern to test regex on DDL
Browse files Browse the repository at this point in the history
  • Loading branch information
subkanthi committed Nov 4, 2024
1 parent 30de53a commit 56dfb44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sink-connector-lightweight/docker/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ clickhouse.database.override.map: "test:ch_test"
#disable.ddl: "false"

#ignore.ddl.regex: If set, the connector will ignore DDL events that match the regex.
ignore.ddl.regex: "^ANALYZE PARTITION.*"
ignore.ddl.regex: "(?i)(ANALYZE PARTITION).*"

#disable.drop.truncate: If set to true, the connector will ignore drop and truncate events. The default is false.
#disable.drop.truncate: "false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -337,7 +339,9 @@ private boolean checkIfDDLNeedsToBeIgnored(String DDL, Properties props, SourceR
String[] separatedIgnoreDDLRegexList = ignoreDDLRegexProperty.split("\\|\\|");

for(String regex : separatedIgnoreDDLRegexList) {
if(DDL.matches(regex)) {
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(DDL);
if (m.find()) {
log.info("Ignoring DDL: " + DDL + " as it matches the regex: " + regex);
return true;
}
Expand Down

0 comments on commit 56dfb44

Please sign in to comment.