HDFS-11903. Ozone: Cleaning up local storage when closing MiniOzoneCluster. Contributed by Mingliang Liu
This commit is contained in:
parent
6b9915fcbd
commit
677dcf529c
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.ozone;
|
package org.apache.hadoop.ozone;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
@ -126,6 +127,15 @@ public final class MiniOzoneCluster extends MiniDFSCluster
|
||||||
String errorMessage = "Cleaning up metadata directories failed." + e;
|
String errorMessage = "Cleaning up metadata directories failed." + e;
|
||||||
assertFalse(errorMessage, true);
|
assertFalse(errorMessage, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
final String localStorage =
|
||||||
|
conf.getTrimmed(OzoneConfigKeys.OZONE_LOCALSTORAGE_ROOT,
|
||||||
|
OzoneConfigKeys.OZONE_LOCALSTORAGE_ROOT_DEFAULT);
|
||||||
|
FileUtils.deleteDirectory(new File(localStorage));
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.error("Cleaning up local storage failed", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue