Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve] Use Google re2/j library for user provided regexes #22829

Merged
merged 9 commits into from
Jun 4, 2024

Conversation

merlimat
Copy link
Contributor

@merlimat merlimat commented Jun 3, 2024

Motivation

Google RE2/J library provide regex library that has worst case linear time processing of pattern, as opposed to standard JDK regexes which could have recursive processing. It's better to avoid these corner cases by just swapping the Pattern class implementation. It's a drop-in replacement for the basic methods we're using, and RE2/J is already a transitive dependency.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@merlimat merlimat added this to the 3.4.0 milestone Jun 3, 2024
@merlimat merlimat self-assigned this Jun 3, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jun 3, 2024
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.26%. Comparing base (bbc6224) to head (797703c).
Report is 340 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #22829      +/-   ##
============================================
- Coverage     73.57%   73.26%   -0.32%     
- Complexity    32624    32955     +331     
============================================
  Files          1877     1888      +11     
  Lines        139502   141764    +2262     
  Branches      15299    15559     +260     
============================================
+ Hits         102638   103858    +1220     
- Misses        28908    29880     +972     
- Partials       7956     8026      +70     
Flag Coverage Δ
inttests 27.45% <0.00%> (+2.87%) ⬆️
systests 24.90% <100.00%> (+0.57%) ⬆️
unittests 72.27% <100.00%> (-0.58%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...va/org/apache/pulsar/broker/service/ServerCnx.java 72.00% <ø> (-0.15%) ⬇️
...apache/pulsar/broker/service/TopicListService.java 67.20% <ø> (ø)
...ar/client/impl/PatternMultiTopicsConsumerImpl.java 83.45% <ø> (ø)
...rg/apache/pulsar/client/impl/PulsarClientImpl.java 73.85% <100.00%> (-0.45%) ⬇️
...rg/apache/pulsar/client/impl/TopicListWatcher.java 67.14% <ø> (-0.72%) ⬇️
...ava-templates/org/apache/pulsar/PulsarVersion.java 78.12% <ø> (ø)
...ava/org/apache/pulsar/common/topics/TopicList.java 89.65% <ø> (ø)

... and 378 files with indirect coverage changes

@lhotari
Copy link
Member

lhotari commented Jun 4, 2024

@merlimat which branches do we target with this change? do you think that it's safe to cherry-pick this to maintenance branches?

@merlimat
Copy link
Contributor Author

merlimat commented Jun 4, 2024

@merlimat which branches do we target with this change? do you think that it's safe to cherry-pick this to maintenance branches?

I think it should be fairly safe, given all "normal" regexes should behave in same way as before. At the same time, I don't think there's urgency to patch in stable branches, so I'd say to skip it unless it's needed later.

@merlimat merlimat merged commit 30069db into apache:master Jun 4, 2024
49 of 50 checks passed
@merlimat merlimat deleted the re2j branch June 4, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants