hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r644155 - in /hadoop/core/trunk: ./ src/java/org/apache/hadoop/dfs/ src/java/org/apache/hadoop/fs/ src/java/org/apache/hadoop/fs/kfs/ src/java/org/apache/hadoop/fs/s3/
Date Thu, 03 Apr 2008 04:27:51 GMT
Author: cdouglas
Date: Wed Apr  2 21:27:49 2008
New Revision: 644155

URL: http://svn.apache.org/viewvc?rev=644155&view=rev
Log:
HADOOP-2634. Deprecate ClientProtocol::exists.
Contributed by lohit vijayarenu.


Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ClientProtocol.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/HftpFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/FilterFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/S3FileSystem.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Apr  2 21:27:49 2008
@@ -74,6 +74,9 @@
     HADOOP-2839. Remove deprecated FileSystem::globPaths.
     (lohit vijayarenu via cdouglas)
 
+    HADOOP-2634. Deprecate ClientProtocol::exists.
+    (lohit vijayarenu via cdouglas)
+
   NEW FEATURES
 
     HADOOP-1398.  Add HBase in-memory block cache.  (tomwhite)

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ClientProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ClientProtocol.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ClientProtocol.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ClientProtocol.java Wed Apr  2 21:27:49
2008
@@ -231,9 +231,10 @@
    */
   public boolean delete(String src, boolean recursive) throws IOException;
   
-  /**
+  /** @deprecated Use getFileInfo() instead
    * Check whether the given file exists.
    */
+  @Deprecated
   public boolean exists(String src) throws IOException;
 
   /**

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java Wed Apr  2 21:27:49 2008
@@ -504,11 +504,15 @@
     return namenode.delete(src, recursive);
   }
   
-  /**
+  /** Implemented using getFileInfo(src)
    */
   public boolean exists(String src) throws IOException {
     checkOpen();
-    return namenode.exists(src);
+    try {
+      return getFileInfo(src) != null;
+    } catch (FileNotFoundException e) {
+      return false;
+    }
   }
 
   /** @deprecated Use getFileStatus() instead */

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java Wed Apr  2
21:27:49 2008
@@ -180,10 +180,6 @@
    return dfs.delete(getPathName(f), recursive);
   }
   
-  public boolean exists(Path f) throws IOException {
-    return dfs.exists(getPathName(f));
-  }
-
   /** {@inheritDoc} */
   @Deprecated
   public long getContentLength(Path f) throws IOException {

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java Wed Apr  2 21:27:49
2008
@@ -985,7 +985,7 @@
       throw new IOException("Invalid file name: " + src);      	  
     }
     if (isPermissionEnabled) {
-      if (overwrite && exists(src)) {
+      if (overwrite && dir.exists(src)) {
         checkPathAccess(src, FsAction.WRITE);
       }
       else {
@@ -1539,14 +1539,18 @@
     return true;
   }
 
-  /**
+  /** @deprecated Use getFileInfo(String) instead
    * Return whether the given filename exists
    */
+  @Deprecated
   public boolean exists(String src) throws AccessControlException {
-    if (isPermissionEnabled) {
-      checkTraverse(src);
+    try {
+      getFileInfo(src);
+      return true;
+    } catch (IOException e) {
+      //getFileInfo throws IOException for file not found
+      return false;
     }
-    return dir.exists(src);
   }
 
   /** Get the file info for a specific file.

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/HftpFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/HftpFileSystem.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/HftpFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/HftpFileSystem.java Wed Apr  2 21:27:49
2008
@@ -209,12 +209,6 @@
   }
 
   @Override
-  public boolean exists(Path f) throws IOException {
-    LsParser lsparser = new LsParser();
-    return lsparser.getFileStatus(f) != null;
-  }
-
-  @Override
   public FileStatus[] listStatus(Path f) throws IOException {
     LsParser lsparser = new LsParser();
     return lsparser.listStatus(f);

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java Wed Apr  2 21:27:49 2008
@@ -382,10 +382,16 @@
     stateChangeLog.debug("*DIR* Namenode.delete:  " + src);
     return namesystem.delete(src, recursive);
   }
-  /**
+  /**@deprecated Use getFileInfo(String) instead
    */
+  @Deprecated
   public boolean exists(String src) throws IOException {
-    return namesystem.exists(src);
+    try {
+      getFileInfo(src);
+      return true;
+    } catch (FileNotFoundException e) {
+      return false;
+    }
   }
 
   /**

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java Wed Apr  2 21:27:49 2008
@@ -580,7 +580,13 @@
   /** Check if exists.
    * @param f source file
    */
-  public abstract boolean exists(Path f) throws IOException;
+  public boolean exists(Path f) throws IOException {
+    try {
+      return getFileStatus(f) != null;
+    } catch (FileNotFoundException e) {
+      return false;
+    }
+  }
 
   /** True iff the named path is a directory. */
   /** @deprecated Use getFileStatus() instead */ @Deprecated

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/FilterFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/FilterFileSystem.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/FilterFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/FilterFileSystem.java Wed Apr  2 21:27:49
2008
@@ -145,13 +145,6 @@
     return fs.delete(f, recursive);
   }
   
-  /** Check if exists.
-   * @param f source file
-   */
-  public boolean exists(Path f) throws IOException {
-    return fs.exists(f);
-  }
-
   /** List files in a directory. */
   public FileStatus[] listStatus(Path f) throws IOException {
     return fs.listStatus(f);

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java Wed Apr  2 21:27:49
2008
@@ -273,12 +273,6 @@
         return false;
       }
     }
-
-    public boolean exists(Path f) throws IOException {
-      synchronized (this) {
-        return pathToFileAttribs.containsKey(getPath(f));
-      }
-    }
   
     /**
      * Directory operations are not supported

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java Wed Apr  2 21:27:49
2008
@@ -226,11 +226,7 @@
     }
     return FileUtil.fullyDelete(f);
   }
-  
-  public boolean exists(Path f) throws IOException {
-    return pathToFile(f).exists();
-  }
-
+ 
   public FileStatus[] listStatus(Path f) throws IOException {
     File localf = pathToFile(f);
     FileStatus[] results;

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java Wed Apr  2 21:27:49
2008
@@ -95,13 +95,6 @@
 	return new Path(workingDir, path);
     }
 
-    public boolean exists(Path path) throws IOException {
-	// stat the path to make sure it exists
-	Path absolute = makeAbsolute(path);
-        String srep = absolute.toUri().getPath();
-        return kfsImpl.exists(srep);
-    }
-
     public boolean mkdirs(Path path, FsPermission permission
         ) throws IOException {
 	Path absolute = makeAbsolute(path);

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/S3FileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/S3FileSystem.java?rev=644155&r1=644154&r2=644155&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/S3FileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/S3FileSystem.java Wed Apr  2 21:27:49
2008
@@ -125,11 +125,6 @@
     return new Path(workingDir, path);
   }
 
-  @Override
-  public boolean exists(Path path) throws IOException {
-    return store.inodeExists(makeAbsolute(path));
-  }
-
   /**
    * @param permission Currently ignored.
    */



Mime
View raw message