Package org.apache.druid.frame.util
Class DurableStorageUtils
java.lang.Object
org.apache.druid.frame.util.DurableStorageUtils
Helper class that fetches the directory and file names corresponding to file location
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetControllerDirectory(String controllerTaskId) static StringTries to parse out the most top level directory from the path.static StringgetOutputsFileNameForPath(String controllerTaskId, int stageNumber, int workerNumber, String taskId, String path) Fetches the file location where a particular worker writes the data corresponding to a particular stage and a custom path namestatic StringgetPartitionOutputsFileNameWithPathForPartition(String controllerTaskId, int stageNumber, int workerNumber, String taskId, int partitionNumber) Fetches the file location where a particular worker writes the data corresponding to a particular stage and partitionstatic StringgetQueryResultsFileNameWithPathForPartition(String controllerTaskId, int stageNumber, int workerNumber, String taskId, int partitionNumber) static StringgetQueryResultsForTaskIdFolderName(String controllerTaskId, int stageNumber, int workerNumber, String taskId) static StringgetQueryResultsSuccessFilePath(String controllerTaskId, int stageNumber, int workerNumber) static StringgetTaskIdOutputsFolderName(String controllerTaskId, int stageNumber, int workerNumber, String taskId) Fetches the directory location where a particular worker will store the partition files corresponding to the stage number, and it's task idstatic StringgetWorkerOutputSuccessFilePath(String controllerTaskId, int stageNumber, int workerNumber) static booleanisQueryResultFileActive(String path, Set<String> recentlyCompletedTaskIds) Checks if a query result file should be retained by checking if its task ID is recently completed.
-
Field Details
-
SUCCESS_MARKER_FILENAME
- See Also:
-
SPLITTER
public static final com.google.common.base.Splitter SPLITTER -
QUERY_RESULTS_DIR
- See Also:
-
-
Constructor Details
-
DurableStorageUtils
public DurableStorageUtils()
-
-
Method Details
-
getControllerDirectory
-
getWorkerOutputSuccessFilePath
-
getQueryResultsSuccessFilePath
-
getTaskIdOutputsFolderName
public static String getTaskIdOutputsFolderName(String controllerTaskId, int stageNumber, int workerNumber, String taskId) Fetches the directory location where a particular worker will store the partition files corresponding to the stage number, and it's task id -
getQueryResultsForTaskIdFolderName
-
getPartitionOutputsFileNameWithPathForPartition
public static String getPartitionOutputsFileNameWithPathForPartition(String controllerTaskId, int stageNumber, int workerNumber, String taskId, int partitionNumber) Fetches the file location where a particular worker writes the data corresponding to a particular stage and partition -
getQueryResultsFileNameWithPathForPartition
-
getOutputsFileNameForPath
public static String getOutputsFileNameForPath(String controllerTaskId, int stageNumber, int workerNumber, String taskId, String path) Fetches the file location where a particular worker writes the data corresponding to a particular stage and a custom path name -
getNextDirNameWithPrefixFromPath
Tries to parse out the most top level directory from the path. Returns null if there is no such directory.
For eg:
- for input path controller_query_id/task/123 the function will return controller_query_id
- for input path abcd, the function will return abcd
- for input path null, the function will return null
-
isQueryResultFileActive
Checks if a query result file should be retained by checking if its task ID is recently completed. Parses the controller task ID from paths underQUERY_RESULTS_DIRand checks membership in the provided set.- Parameters:
path- the file path to checkrecentlyCompletedTaskIds- set of task IDs that completed recently and whose files should be retained- Returns:
trueif the file belongs to a recently completed task;falseotherwise
-