dajac commented on code in PR #17651:
URL: https://github.com/apache/kafka/pull/17651#discussion_r1824447195
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -2406,6 +2410,17 @@ private boolean hasMemberSubscriptionChanged(
if
(!updatedMember.subscribedTopicRegex().equals(member.subscribedTopicRegex())) {
log.debug("[GroupId {}] Member {} updated its subscribed regex
to: {}.",
groupId, memberId, updatedMember.subscribedTopicRegex());
+ // If the regular expression has changed, we compile it to
ensure that
+ // its syntax is valid.
+ if (updatedMember.subscribedTopicRegex() != null) {
+ try {
+ Pattern.compile(updatedMember.subscribedTopicRegex());
+ } catch (PatternSyntaxException ex) {
+ throw new InvalidRegularExpression(
+ String.format("SubscribedTopicRegex `%s` is not a
valid regular expression: %s.",
+ updatedMember.subscribedTopicRegex(),
ex.getDescription()));
+ }
+ }
Review Comment:
I will look into caching the compile regex in a subsequent PR.
--
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]