-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix wrong isEmpty method of ConcurrentOpenLongPairRangeSet #12953
Merged
codelipenghui
merged 1 commit into
apache:master
from
BewareMyPower:bewaremypower/fix-range-set-is-empty
Nov 25, 2021
Merged
Fix wrong isEmpty method of ConcurrentOpenLongPairRangeSet #12953
codelipenghui
merged 1 commit into
apache:master
from
BewareMyPower:bewaremypower/fix-range-set-is-empty
Nov 25, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BewareMyPower
added
type/bug
The PR fixed a bug or issue reported a bug
doc-not-needed
Your PR changes do not impact docs
release/2.9.1
release/2.8.3
labels
Nov 24, 2021
BewareMyPower
requested review from
merlimat,
rdhabalia,
hangc0276,
codelipenghui,
gaoran10 and
congbobo184
November 24, 2021 03:23
michaeljmarshall
approved these changes
Nov 24, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Technoboy-
approved these changes
Nov 24, 2021
yuruguo
approved these changes
Nov 24, 2021
Jason918
approved these changes
Nov 24, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Demogorgon314
approved these changes
Nov 24, 2021
RobertIndie
approved these changes
Nov 25, 2021
codelipenghui
approved these changes
Nov 25, 2021
nicoloboschi
pushed a commit
to datastax/pulsar
that referenced
this pull request
Nov 25, 2021
) (cherry picked from commit 6cc5cff)
nicoloboschi
pushed a commit
to datastax/pulsar
that referenced
this pull request
Nov 25, 2021
) (cherry picked from commit 6cc5cff)
codelipenghui
pushed a commit
that referenced
this pull request
Nov 26, 2021
(cherry picked from commit 6cc5cff)
eolivelli
pushed a commit
to eolivelli/pulsar
that referenced
this pull request
Nov 29, 2021
fxbing
pushed a commit
to fxbing/pulsar
that referenced
this pull request
Dec 19, 2021
codelipenghui
pushed a commit
that referenced
this pull request
Dec 21, 2021
(cherry picked from commit 6cc5cff)
2 tasks
gaoran10
pushed a commit
that referenced
this pull request
Jan 18, 2022
### Motivation There are some methods implemented with an inefficient forEach loop, so fix it to get better performance. It is similar to #12953 ### Modifications I rewrite it with the `for` loop.
codelipenghui
pushed a commit
that referenced
this pull request
Jan 18, 2022
codelipenghui
pushed a commit
that referenced
this pull request
Jan 18, 2022
Shawyeok
pushed a commit
to Shawyeok/pulsar
that referenced
this pull request
Sep 6, 2022
) (cherry picked from commit 6cc5cff)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/broker
cherry-picked/branch-2.8
Archived: 2.8 is end of life
cherry-picked/branch-2.9
Archived: 2.9 is end of life
doc-not-needed
Your PR changes do not impact docs
release/2.8.3
release/2.9.2
type/bug
The PR fixed a bug or issue reported a bug
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The
ConcurrentOpenLongPairRangeSet#isEmpty
implementation is wrong. SeeThe comment of
[1]
should beisEmpty.get()
, not!isEmpty.get()
. However, the implementation is still bad becauseforEach
method will iterate over the whole map. If the map has many entries, the performance cost will not be ignorable.Modifications
ConcurrentOpenLongPairRangeSet#isEmpty
. Instead of callingforEach
, here we use a trivial for loop and break the loop if there is an entry whose value is a non-empty set.testIsEmpty
), which adds an empty set toConcurrentOpenLongPairRangeSet
. Before this patch, theisEmpty()
returns false, which is incorrect.Verifying this change
This change added test
ConcurrentOpenLongPairRangeSetTest#testIsEmpty
.