HDFS-15072. HDFS MiniCluster fails to start when run in directory path with a %. (#1775)
(cherry picked from commit a43c177f1d
)
This commit is contained in:
parent
d55d02d25a
commit
4c8b01abcb
|
@ -196,9 +196,10 @@ public class FsVolumeImpl implements FsVolumeSpi {
|
|||
DFSConfigKeys.DFS_DATANODE_FSDATASETCACHE_MAX_THREADS_PER_VOLUME_KEY,
|
||||
DFSConfigKeys.DFS_DATANODE_FSDATASETCACHE_MAX_THREADS_PER_VOLUME_DEFAULT);
|
||||
|
||||
String escapedPath = parent.toString().replaceAll("%", "%%");
|
||||
ThreadFactory workerFactory = new ThreadFactoryBuilder()
|
||||
.setDaemon(true)
|
||||
.setNameFormat("FsVolumeImplWorker-" + parent.toString() + "-%d")
|
||||
.setNameFormat("FsVolumeImplWorker-" + escapedPath + "-%d")
|
||||
.build();
|
||||
ThreadPoolExecutor executor = new ThreadPoolExecutor(
|
||||
1, maxNumThreads,
|
||||
|
|
|
@ -951,4 +951,17 @@ public class TestFsDatasetImpl {
|
|||
}
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
public void testDataDirWithPercent() throws IOException {
|
||||
String baseDir = new FileSystemTestHelper().getTestRootDir();
|
||||
File dataDir = new File(baseDir, "invalidFormatString-%z");
|
||||
dataDir.mkdirs();
|
||||
FsVolumeImpl volumeFixed = new FsVolumeImplBuilder()
|
||||
.setConf(new HdfsConfiguration())
|
||||
.setDataset(dataset)
|
||||
.setStorageID("storage-id")
|
||||
.setStorageDirectory(
|
||||
new StorageDirectory(StorageLocation.parse(dataDir.getPath())))
|
||||
.build();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue