AmatyaAvadhanula commented on code in PR #12473:
URL: https://github.com/apache/druid/pull/12473#discussion_r857073506
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/config/TaskConfig.java:
##########
@@ -184,14 +228,48 @@ public String getBaseDir()
}
@JsonProperty
- public File getBaseTaskDir()
+ public List<StorageLocationConfig> getBaseTaskDirLocations()
+ {
+ return baseTaskDirLocations;
+ }
+
+ public List<StorageLocationConfig> getBaseTaskDirChildrenLocations(String
child)
+ {
+ return getBaseTaskDirLocations().stream()
+ .map(location -> new StorageLocationConfig(
+ getChildFileFromLocation(location,
child),
+ location.getMaxSize(),
+ location.getFreeSpacePercent()))
+ .collect(Collectors.toList());
+ }
+
+ private File getChildFileFromLocation(StorageLocationConfig location, String
child)
+ {
+ return new File(location.getPath(), child);
+ }
+
+ private StorageLocationConfig getBaseTaskDirLocationForId(String taskId)
+ {
+ if (taskId == null) {
+ return null;
+ }
+ // TODO: consider the size of each of the base locations for distribution
+ // use uniformly RANDOM assignment
+ int index = taskId.hashCode() % baseTaskDirLocations.size();
Review Comment:
The argument will never be Integer.MIN_VALUE logically but I had to do it in
a roundabout manner to get past it.
Is there a way to suppress it?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]