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 lj...@apache.org on 2019/04/26 11:59:57 UTC
[hadoop] branch trunk updated: HDDS-1460: Add the optmizations of
HDDS-1300 to BasicOzoneFileSystem (#765)
This is an automated email from the ASF dual-hosted git repository.
ljain pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 556eafd HDDS-1460: Add the optmizations of HDDS-1300 to BasicOzoneFileSystem (#765)
556eafd is described below
commit 556eafd01a76145e6255b5ff720c80bf8bf7d08b
Author: Lokesh Jain <lj...@apache.org>
AuthorDate: Fri Apr 26 17:29:50 2019 +0530
HDDS-1460: Add the optmizations of HDDS-1300 to BasicOzoneFileSystem (#765)
---
.../hadoop/fs/ozone/BasicOzoneFileSystem.java | 34 +---------------------
1 file changed, 1 insertion(+), 33 deletions(-)
diff --git a/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java b/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java
index 3af4cce..77e5a60 100644
--- a/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java
+++ b/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java
@@ -203,14 +203,8 @@ public class BasicOzoneFileSystem extends FileSystem {
incrementCounter(Statistic.INVOCATION_OPEN);
statistics.incrementWriteOps(1);
LOG.trace("open() path:{}", f);
- final FileStatus fileStatus = getFileStatus(f);
final String key = pathToKey(f);
- if (fileStatus.isDirectory()) {
- throw new FileNotFoundException("Can't open directory " + f + " to read");
- }
-
- return new FSDataInputStream(
- new OzoneFSInputStream(adapter.readFile(key)));
+ return new FSDataInputStream(new OzoneFSInputStream(adapter.readFile(key)));
}
protected void incrementCounter(Statistic statistic) {
@@ -226,25 +220,6 @@ public class BasicOzoneFileSystem extends FileSystem {
incrementCounter(Statistic.INVOCATION_CREATE);
statistics.incrementWriteOps(1);
final String key = pathToKey(f);
- final FileStatus status;
- try {
- status = getFileStatus(f);
- if (status.isDirectory()) {
- throw new FileAlreadyExistsException(f + " is a directory");
- } else {
- if (!overwrite) {
- // path references a file and overwrite is disabled
- throw new FileAlreadyExistsException(f + " already exists");
- }
- LOG.trace("Overwriting file {}", f);
- adapter.deleteObject(key);
- }
- } catch (FileNotFoundException ignored) {
- // this means the file is not found
- }
-
- // We pass null to FSDataOutputStream so it won't count writes that
- // are being buffered to a file
return createOutputStream(key, overwrite, true);
}
@@ -259,13 +234,6 @@ public class BasicOzoneFileSystem extends FileSystem {
incrementCounter(Statistic.INVOCATION_CREATE_NON_RECURSIVE);
statistics.incrementWriteOps(1);
final String key = pathToKey(path);
- final Path parent = path.getParent();
- if (parent != null) {
- // expect this to raise an exception if there is no parent
- if (!getFileStatus(parent).isDirectory()) {
- throw new FileAlreadyExistsException("Not a directory: " + parent);
- }
- }
return createOutputStream(key, flags.contains(CreateFlag.OVERWRITE), false);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org