-
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
Optimize isValidPath check in MetadataStore #12663
Merged
codelipenghui
merged 5 commits into
apache:master
from
Jason918:fix_error_in_LocalMemoryMetadataStore#isValidPath
Nov 12, 2021
Merged
Optimize isValidPath check in MetadataStore #12663
codelipenghui
merged 5 commits into
apache:master
from
Jason918:fix_error_in_LocalMemoryMetadataStore#isValidPath
Nov 12, 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
github-actions
bot
added
the
doc
Your PR contains doc changes, no matter whether the changes are in markdown or code files.
label
Nov 8, 2021
pulsar-metadata/src/test/java/org/apache/pulsar/metadata/LocalMemoryMetadataStoreTest.java
Outdated
Show resolved
Hide resolved
/pulsarbot run-failure-checks |
Jason918
force-pushed
the
fix_error_in_LocalMemoryMetadataStore#isValidPath
branch
from
November 10, 2021 03:27
0528c16
to
99f7294
Compare
merlimat
reviewed
Nov 10, 2021
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java
Outdated
Show resolved
Hide resolved
merlimat
approved these changes
Nov 10, 2021
…AbstractMetadataStore.java Co-authored-by: Matteo Merli <[email protected]>
/pulsarbot run-failure-checks |
codelipenghui
approved these changes
Nov 12, 2021
Jason918
deleted the
fix_error_in_LocalMemoryMetadataStore#isValidPath
branch
November 12, 2021 06:10
eolivelli
pushed a commit
to eolivelli/pulsar
that referenced
this pull request
Nov 29, 2021
### Motivation 1. There is a logic error in original LocalMemoryMetadataStore#isValidPath with this code line 239 > return !path.equals("/") || !path.endsWith("/"); The "||" operator should be "&&", to forbids path ends with "/" 2. Further more, as we can implement other MetadataStore based on etcd or other external storage system. The path check function should be added to AbstractMetadataStore, and get checked before any operations. ### Modifications 1. Fixed the logic error in isValidPath and moved it to AbstractMetadataStore. 2. Check path before each operation in AbstractMetadataStore. 3. Add MetadataStoreException.InvalidPathException
2 tasks
Merged
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
doc
Your PR contains doc changes, no matter whether the changes are in markdown or code files.
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 "||" operator should be "&&", to forbids path ends with "/"
Modifications
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below and label this PR (if you have committer privilege).
Need to update docs?
doc
Added doc in
isValidPath
No user doc needed.