You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/09/10 10:10:46 UTC

[GitHub] [pinot] richardstartin commented on a change in pull request #7085: modify segment generator to not return illegal filenames

richardstartin commented on a change in pull request #7085:
URL: https://github.com/apache/pinot/pull/7085#discussion_r706063889



##########
File path: pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/SegmentNameGenerator.java
##########
@@ -27,6 +27,7 @@
  * Interface for segment name generator based on the segment sequence id and time range.
  */
 public interface SegmentNameGenerator extends Serializable {
+  String INVALID_SEGMENT_NAME_REGEX = ".*[\\\\/:\\*?\"<>|].*";

Review comment:
       I think this regex should be precompiled:
   
   ```java
   Pattern INVALID_SEGMENT_NAME_REGEX = Pattern.compile(".*[\\\\/:\\*?\"<>|].*");
   ```
   
   Then the checks become e.g.
   
   ```
   Preconditions.checkArgument(
            segmentNamePrefix != null && ! INVALID_SEGMENT_NAME_REGEX.matcher(segmentNamePrefix).matches());
   ```
   
   None of these checks are performance critical, but it makes it easier to use static analysis to keep implicit regular expression compilation out of the critical path if it's just never used.




-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org