Jason918 opened a new pull request #12663:
URL: https://github.com/apache/pulsar/pull/12663


   ### 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
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change added tests and can be verified as follows:
     - org.apache.pulsar.metadata.LocalMemoryMetadataStoreTest#testPathValid
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API: (no)
     - The schema: (no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - The admin cli options: (no)
     - Anything that affects deployment: (no)
   
   ### Documentation
   
   Check the box below and label this PR (if you have committer privilege).
   
   Need to update docs? 
   
     
   - [x] `doc` 
   
   Added doc in `isValidPath` 
   No user doc needed. 
   
   
   


-- 
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]


Reply via email to