DBZ-8170 Error caused by database name containing regular keywords#5800
DBZ-8170 Error caused by database name containing regular keywords#5800jpechane merged 1 commit intodebezium:mainfrom
Conversation
|
Welcome as a new contributor to Debezium, @jw-itq. Reviewers, please add missing author name(s) and alias name(s) to the COPYRIGHT.txt and Aliases.txt respectively. |
|
Hi @jw-itq would it be possible to add a test not only for the use case you've described with |
thanks, I will attempt to add a test case. Yes, this could potentially cause test$user not to be interpreted correctly. However, on the JDBC URL, you cannot use $ but you can use \$. If the Matcher.quoteReplacement is used, test$user will still be effective. |
But you're also adjusting the |
thanks, the Predicate indeed requires more thought, and I will reconsider the changes regarding the Predicate. Or do you have any better suggestions? |
Ritabrata1080
left a comment
There was a problem hiding this comment.
Please squash the commits to have a linear history.
|
❌ Developer Certificate of Origin (DCO) check failed. Hi @jw-itq, please sign off all commits with: If pull request commits are not signed off, the pull request cannot be merged. For more information about why this is required, please see our blog about contribution requirement changes. |
ok, thanks. I'll handle it right away. |
ok! |
|
@Naros @Ritabrata1080 hi,commits squashed and DCO sign-off added. |
|
|
||
| public static <T, U> BiPredicate<T, U> includes(String regexPatterns, BiFunction<T, U, String> conversion) { | ||
| Set<Pattern> patterns = Strings.setOfRegex(regexPatterns, Pattern.CASE_INSENSITIVE); | ||
| Set<Pattern> patterns = Strings.setOfRegex(regexPatterns != null ? Matcher.quoteReplacement(regexPatterns) : null, Pattern.CASE_INSENSITIVE); |
There was a problem hiding this comment.
What happens if patterns set tries to set regex of null value ? Please check for potential NPE crash across patch.
80bc397 to
e85dd76
Compare
| */ | ||
| public static <T> Predicate<T> includes(String regexPatterns, Function<T, String> conversion) { | ||
| Set<Pattern> patterns = Strings.setOfRegex(regexPatterns, Pattern.CASE_INSENSITIVE); | ||
| Set<Pattern> patterns = Strings.setOfRegex(regexPatterns != null ? Matcher.quoteReplacement(regexPatterns) : null, Pattern.CASE_INSENSITIVE); |
There was a problem hiding this comment.
We've always expected that if a provided include/exclude list configuration property contains regex characters that may not be interpreted as literal, they should be manually escaped in the configuration. This change here would specifically create breaking behavior in environments that already pre-escape special characters.
I'm personally not convinced we should change this behavior, as using $ and, to a lesser degree, ? in tablenames is quite common among certain database vendors. I am concerned about the potential impact on a longstanding expectation when handling these strings.
When it comes to the JDBC URL, we can certainly be significantly more lenient there.
@jpechane any thoughts?
There was a problem hiding this comment.
I agree, we should not break backward compatibility in this regard.
b05dab0 to
79aa9bb
Compare
|
@Naros @Ritabrata1080 @jpechane Thank you for your review. I will revert the changes made to Predicates.java |
|
@jw-itq LGTM. Could you please rebase the PR on the latest main and add a test case if possible to make sure the results are expected? |
|
@jw-itq Please take a lok at the PR changes. I belive it is broken now. |
@jpechane hi. the JdbcConnection.java fix using Matcher.quoteReplacement() is already present in the main branch (commit fe5758e or earlier). After rebasing, my PR now only contains contributor information updates. Should I close this PR since the actual fix is already merged, or would you like me to keep it for the contributor credits? |
|
@jw-itq Please keep the credits, just it is necessary to rebase on the latest main and remove the extra lines ike |
…uch as database name: test Signed-off-by: Shiwanming <[email protected]>
https://issues.redhat.com/browse/DBZ-8170
Error caused by database name containing regular keywords, such as database name: test$user