[Bug Fix][KeySharedPolicy] Fixed bug where KeySharedPolicy::setStickyRanges duplicated ranges.#242
Merged
BewareMyPower merged 3 commits intoapache:mainfrom Apr 20, 2023
Merged
Conversation
…icate ranges to KeySharedPolicy->ranges. The for loop was nested when it shouldn't have been nested. *Added overloaded KeySharedPolicy::setStickyRanges function that takes the StickyRanges vector. This is convenient in case a developer wants to provide a vector. It is also required for adding KeySharedPolicy to the python pulsar client which uses pybind11. std::initializer_list type conversion is not supported with pybind11. See pybind/pybind11#1302 (comment) *Added a test that checks to see if the KeySharedPolicy->ranges variable is set as expected after calling KeySharedPolicy::setStickyRanges *Added a test that checks to see if the KeySharedPolicy->ranges variable is the same when using the two different overloaded KeySharedPolicy::setStickyRanges functions.
Contributor
Author
|
Here is the pulsar python client pr that is dependent on this pr apache/pulsar-client-python#109 |
Member
|
@hyperevo Please fix the code format. You can use |
BewareMyPower
requested changes
Apr 4, 2023
Contributor
BewareMyPower
left a comment
There was a problem hiding this comment.
Please fix the code format as well
…nce. Implicit conversion from std::initializer_list to std::vector
e7dc0f2 to
e09f1e7
Compare
Contributor
Author
|
Thanks for reviewing! I made the changes requested and ran ./build-support/docker-format.sh to format correctly in the latest commit. |
Contributor
|
Please fix the build error: |
Contributor
Author
This should be fixed now. |
BewareMyPower
requested changes
Apr 17, 2023
b816e10 to
802671d
Compare
BewareMyPower
approved these changes
Apr 20, 2023
2 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
*[fix] Fixed bug where KeySharedPolicy::setStickyRanges appended duplicate ranges to KeySharedPolicy->ranges. The for loop was nested when it shouldn't have been nested.
This fixes the issue #241
*Added a test that checks to see if the KeySharedPolicy->ranges variable is set as expected after calling KeySharedPolicy::setStickyRanges
*Added overloaded KeySharedPolicy::setStickyRanges function that takes the StickyRanges vector. This is convenient in case a developer wants to provide a vector. It is also required for adding KeySharedPolicy to the python pulsar client which uses pybind11. std::initializer_list type conversion is not supported with pybind11. See pybind/pybind11#1302 (comment)
I am in the process of adding support for KeySharedPolicy to the python-pulsar-client and will submit a pr soon.
*Added a test that checks to see if the KeySharedPolicy->ranges variable is the same when using the two different overloaded KeySharedPolicy::setStickyRanges functions.
Modifications
Moved for loop in KeySharedPolicy::setStickyRanges to unnested location to eliminate duplicate vector entries.
Added simple overloaded version of the same function that a parameter of type StickyRanges in addition to existing function that takes a parameter of type std::initializer_list
Added two new tests in KeySharedPolicyTest.cc to validate the changes.
Verifying this change
This change added tests and can be verified as follows:
Added two new tests in KeySharedPolicyTest.cc to validate the changes.
Documentation
doc-required(Your PR needs to update docs and you will update later)
[ *]
doc-not-needed(Please explain why)
Bug fix did not change functionality in any new ways that are not covered by existing documentation.
doc(Your PR contains doc changes)
doc-complete(Docs have been already added)