You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by in...@apache.org on 2018/10/09 19:00:43 UTC
hadoop git commit: HDFS-13979. Review StateStoreFileSystemImpl Class.
Contributed by BELUGA BEHR.
Repository: hadoop
Updated Branches:
refs/heads/trunk 4b5b1ac3d -> a05bd1288
HDFS-13979. Review StateStoreFileSystemImpl Class. Contributed by BELUGA BEHR.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a05bd128
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a05bd128
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a05bd128
Branch: refs/heads/trunk
Commit: a05bd1288cabfe4cafb0693739add4a675aec5a2
Parents: 4b5b1ac
Author: Inigo Goiri <in...@apache.org>
Authored: Tue Oct 9 12:00:21 2018 -0700
Committer: Inigo Goiri <in...@apache.org>
Committed: Tue Oct 9 12:00:21 2018 -0700
----------------------------------------------------------------------
.../store/driver/impl/StateStoreFileSystemImpl.java | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a05bd128/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileSystemImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileSystemImpl.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileSystemImpl.java
index 2e1ff8f..e6bf159 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileSystemImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileSystemImpl.java
@@ -24,7 +24,8 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URI;
import java.nio.charset.StandardCharsets;
-import java.util.LinkedList;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.apache.hadoop.fs.FSDataInputStream;
@@ -33,8 +34,8 @@ import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Options;
import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hdfs.server.federation.router.RBFConfigKeys;
import org.apache.hadoop.hdfs.DistributedFileSystem;
+import org.apache.hadoop.hdfs.server.federation.router.RBFConfigKeys;
import org.apache.hadoop.hdfs.server.federation.store.driver.StateStoreDriver;
import org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord;
import org.slf4j.Logger;
@@ -50,13 +51,13 @@ public class StateStoreFileSystemImpl extends StateStoreFileBaseImpl {
private static final Logger LOG =
LoggerFactory.getLogger(StateStoreFileSystemImpl.class);
-
/** Configuration keys. */
public static final String FEDERATION_STORE_FS_PATH =
RBFConfigKeys.FEDERATION_STORE_PREFIX + "driver.fs.path";
/** File system to back the State Store. */
private FileSystem fs;
+
/** Working path in the filesystem. */
private String workPath;
@@ -141,7 +142,7 @@ public class StateStoreFileSystemImpl extends StateStoreFileBaseImpl {
new InputStreamReader(fdis, StandardCharsets.UTF_8);
reader = new BufferedReader(isr);
} catch (IOException ex) {
- LOG.error("Cannot open read stream for {}", path);
+ LOG.error("Cannot open read stream for {}", path, ex);
}
return reader;
}
@@ -156,25 +157,26 @@ public class StateStoreFileSystemImpl extends StateStoreFileBaseImpl {
new OutputStreamWriter(fdos, StandardCharsets.UTF_8);
writer = new BufferedWriter(osw);
} catch (IOException ex) {
- LOG.error("Cannot open write stream for {}", path);
+ LOG.error("Cannot open write stream for {}", path, ex);
}
return writer;
}
@Override
protected List<String> getChildren(String pathName) {
- List<String> ret = new LinkedList<>();
Path path = new Path(workPath, pathName);
try {
FileStatus[] files = fs.listStatus(path);
+ List<String> ret = new ArrayList<>(files.length);
for (FileStatus file : files) {
Path filePath = file.getPath();
String fileName = filePath.getName();
ret.add(fileName);
}
+ return ret;
} catch (Exception e) {
LOG.error("Cannot get children for {}", pathName, e);
+ return Collections.emptyList();
}
- return ret;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org