AmatyaAvadhanula commented on code in PR #13476:
URL: https://github.com/apache/druid/pull/13476#discussion_r1049454606


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/config/TaskConfig.java:
##########
@@ -300,4 +338,50 @@ private String defaultDir(@Nullable String 
configParameter, final String default
 
     return configParameter;
   }
+
+  private static class TaskStorageDirTracker
+  {
+    private int taskDirIndex = 0;
+
+    private final List<File> baseTaskDirs = new ArrayList<>();
+
+    private final Map<String, File> taskToTempDirMap = new HashMap<>();
+
+    TaskStorageDirTracker(final List<String> baseTaskDirPaths)
+    {
+      for (String baseTaskDirPath : baseTaskDirPaths) {
+        baseTaskDirs.add(new File(baseTaskDirPath));
+      }
+    }
+
+    List<File> getBaseTaskDirs()
+    {
+      return baseTaskDirs;
+    }
+
+    synchronized File getOrSelectTaskDir(final String taskId)
+    {
+      if (!taskToTempDirMap.containsKey(taskId)) {
+        addTask(taskId, baseTaskDirs.get(taskDirIndex));
+        taskDirIndex = (taskDirIndex + 1) % baseTaskDirs.size();
+      }
+
+      return taskToTempDirMap.get(taskId);
+    }
+
+    synchronized void addTask(final String taskId, final File taskDir)

Review Comment:
   This is needed in the case of restore



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

Reply via email to