Make TaskConfig pull from java.io.tmpdir

* Also makes paths built off of java.nio.file.Paths instead of String.format
This commit is contained in:
Charles Allen 2015-12-23 11:00:32 -08:00
parent 508629916d
commit e18301d99c
2 changed files with 10 additions and 8 deletions

View File

@ -274,9 +274,9 @@ Additional peon configs include:
|Property|Description|Default|
|--------|-----------|-------|
|`druid.peon.mode`|Choices are "local" and "remote". Setting this to local means you intend to run the peon as a standalone node (Not recommended).|remote|
|`druid.indexer.task.baseDir`|Base temporary working directory.|/tmp|
|`druid.indexer.task.baseTaskDir`|Base temporary working directory for tasks.|/tmp/persistent/tasks|
|`druid.indexer.task.hadoopWorkingPath`|Temporary working directory for Hadoop tasks.|/tmp/druid-indexing|
|`druid.indexer.task.baseDir`|Base temporary working directory.|`System.getProperty("java.io.tmpdir")`|
|`druid.indexer.task.baseTaskDir`|Base temporary working directory for tasks.|`${druid.indexer.task.baseDir}/persistent/tasks`|
|`druid.indexer.task.hadoopWorkingPath`|Temporary working directory for Hadoop tasks.|`/tmp/druid-indexing`|
|`druid.indexer.task.defaultRowFlushBoundary`|Highest row count before persisting to disk. Used for indexing generating tasks.|50000|
|`druid.indexer.task.defaultHadoopCoordinates`|Hadoop version to use with HadoopIndexTasks that do not request a particular version.|org.apache.hadoop:hadoop-client:2.3.0|
|`druid.indexer.task.restoreTasksOnRestart`|If true, middleManagers will attempt to stop tasks gracefully on shutdown and restore them on restart.|false|

View File

@ -25,6 +25,7 @@ import com.google.common.collect.ImmutableList;
import org.joda.time.Period;
import java.io.File;
import java.nio.file.Paths;
import java.util.List;
public class TaskConfig
@ -73,9 +74,10 @@ public class TaskConfig
@JsonProperty("directoryLockTimeout") Period directoryLockTimeout
)
{
this.baseDir = baseDir == null ? "/tmp" : baseDir;
this.baseDir = baseDir == null ? System.getProperty("java.io.tmpdir") : baseDir;
this.baseTaskDir = new File(defaultDir(baseTaskDir, "persistent/task"));
this.hadoopWorkingPath = defaultDir(hadoopWorkingPath, "druid-indexing");
// This is usually on HDFS or similar, so we can't use java.io.tmpdir
this.hadoopWorkingPath = hadoopWorkingPath == null ? "/tmp/druid-indexing" : hadoopWorkingPath;
this.defaultRowFlushBoundary = defaultRowFlushBoundary == null ? 500000 : defaultRowFlushBoundary;
this.defaultHadoopCoordinates = defaultHadoopCoordinates == null
? DEFAULT_DEFAULT_HADOOP_COORDINATES
@ -85,8 +87,8 @@ public class TaskConfig
? DEFAULT_GRACEFUL_SHUTDOWN_TIMEOUT
: gracefulShutdownTimeout;
this.directoryLockTimeout = directoryLockTimeout == null
? DEFAULT_DIRECTORY_LOCK_TIMEOUT
: directoryLockTimeout;
? DEFAULT_DIRECTORY_LOCK_TIMEOUT
: directoryLockTimeout;
}
@JsonProperty
@ -155,7 +157,7 @@ public class TaskConfig
private String defaultDir(String configParameter, final String defaultVal)
{
if (configParameter == null) {
return String.format("%s/%s", getBaseDir(), defaultVal);
return Paths.get(getBaseDir(), defaultVal).toString();
}
return configParameter;