Skip to content

Commit e094b3b

Browse files
elekbharatviswa504
authored andcommitted
HDDS-1680. Create missing parent directories during the creation of HddsVolume dirs (#961)
1 parent 89acbbc commit e094b3b

File tree

2 files changed

+2
-2
lines changed
  • hadoop-hdds/container-service/src

2 files changed

+2
-2
lines changed

hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/HddsVolume.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private void initialize() throws IOException {
204204
switch (intialVolumeState) {
205205
case NON_EXISTENT:
206206
// Root directory does not exist. Create it.
207-
if (!hddsRootDir.mkdir()) {
207+
if (!hddsRootDir.mkdirs()) {
208208
throw new IOException("Cannot create directory " + hddsRootDir);
209209
}
210210
setState(VolumeState.NOT_FORMATTED);

hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestVolumeSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public void testFailVolumes() throws Exception{
230230
ozoneConfig.set(HDDS_DATANODE_DIR_KEY, readOnlyVolumePath.getAbsolutePath()
231231
+ "," + volumePath.getAbsolutePath());
232232
volSet = new VolumeSet(UUID.randomUUID().toString(), ozoneConfig);
233-
assertTrue(volSet.getFailedVolumesList().size() == 1);
233+
assertEquals(1, volSet.getFailedVolumesList().size());
234234
assertEquals(readOnlyVolumePath, volSet.getFailedVolumesList().get(0)
235235
.getHddsRootDir());
236236

0 commit comments

Comments
 (0)