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 2022/06/08 00:41:23 UTC
[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #8789: Allow appending UUID at end of segment name
Jackie-Jiang commented on code in PR #8789:
URL: https://github.com/apache/pinot/pull/8789#discussion_r891815822
##########
pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-common/src/main/java/org/apache/pinot/plugin/ingestion/batch/common/SegmentGenerationTaskRunner.java:
##########
@@ -137,11 +138,16 @@ private SegmentNameGenerator getSegmentNameGenerator()
if (segmentNameGeneratorConfigs == null) {
segmentNameGeneratorConfigs = new HashMap<>();
}
+
+ boolean isAppendUUIDToSegmentName =
Review Comment:
(minor)
```suggestion
boolean appendUUIDToSegmentName =
```
##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGenerator.java:
##########
@@ -64,23 +71,25 @@ public InputFileSegmentNameGenerator(String filePathPattern, String segmentNameT
throw new IllegalArgumentException(
String.format("Invalid inputFileUri: %s for InputFileSegmentNameGenerator", inputFileUri), e);
}
+ _appendUUIDToSegmentName = appendUUIDToSegmentName;
_segmentName = makeSegmentName();
}
private String makeSegmentName() {
String inputFilePath = _inputFileUri.getPath();
Matcher m = _filePathPattern.matcher(inputFilePath);
+ String segmentName;
+
if (!m.matches()) {
LOGGER.warn(String.format("No match for pattern '%s' in '%s'", _filePathPattern, inputFilePath));
- return safeConvertPathToFilename(inputFilePath);
+ segmentName = safeConvertPathToFilename(inputFilePath);
+ } else {
+ segmentName = _segmentNameTemplate;
+ for (int i = 1; i <= m.groupCount(); i++) {
+ segmentName = segmentName.replace(String.format(PARAMETER_TEMPLATE, i), m.group(i));
+ }
}
-
- String segmentName = _segmentNameTemplate;
- for (int i = 1; i <= m.groupCount(); i++) {
- segmentName = segmentName.replace(String.format(PARAMETER_TEMPLATE, i), m.group(i));
- }
-
- return segmentName;
+ return JOINER.join(segmentName, _appendUUIDToSegmentName ? UUID.randomUUID() : null);
Review Comment:
(minor) avoid unnecessary join
```suggestion
return _appendUUIDToSegmentName ? JOINER.join(segmentName, UUID.randomUUID()) : segmentName;
```
--
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