Skip to content

Commit

Permalink
Merge pull request #6226 from amanpsbhatia/moveLog
Browse files Browse the repository at this point in the history
[ALLUXIO-3037] moved log statement out of util function
  • Loading branch information
apc999 committed Oct 4, 2017
2 parents 891a289 + c1ce0ba commit 8069c25
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions core/common/src/main/java/alluxio/util/io/FileUtils.java
Expand Up @@ -249,10 +249,11 @@ public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOExce
* Also, appropriate directory permissions (777 + StickyBit, namely "drwxrwxrwt") are set.
*
* @param path storage directory path to create
* @return true if the directory is created and false if the directory already exists
*/
public static void createStorageDirPath(String path) throws IOException {
public static boolean createStorageDirPath(String path) throws IOException {
if (Files.exists(Paths.get(path))) {
return;
return false;
}
Path storagePath;
try {
Expand All @@ -263,7 +264,7 @@ public static void createStorageDirPath(String path) throws IOException {
String absolutePath = storagePath.toAbsolutePath().toString();
changeLocalFileToFullPermission(absolutePath);
setLocalDirStickyBit(absolutePath);
LOG.info("Folder {} was created!", path);
return true;
}

/**
Expand Down
Expand Up @@ -105,7 +105,11 @@ public static StorageDir newStorageDir(StorageTier tier, int dirIndex, long capa
private void initializeMeta() throws BlockAlreadyExistsException, IOException,
WorkerOutOfSpaceException {
// Create the storage directory path
FileUtils.createStorageDirPath(mDirPath);
boolean isDirectoryNewlyCreated = FileUtils.createStorageDirPath(mDirPath);

if (isDirectoryNewlyCreated) {
LOG.info("Folder {} was created!", mDirPath);
}

File dir = new File(mDirPath);
File[] paths = dir.listFiles();
Expand Down

0 comments on commit 8069c25

Please sign in to comment.