From: Colin Patrick McCabe Date: Fri, 27 May 2011 21:46:19 +0000 (-0700) Subject: hadoop: track Hadoop API changes X-Git-Tag: v0.29~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7e1de380ebc45148c0663f0be0a933f8ae82f8fb;p=ceph.git hadoop: track Hadoop API changes Signed-off-by: Colin McCabe --- diff --git a/src/client/hadoop/ceph/CephFS.java b/src/client/hadoop/ceph/CephFS.java index 7c92fce76fcb..f9e1a061c947 100644 --- a/src/client/hadoop/ceph/CephFS.java +++ b/src/client/hadoop/ceph/CephFS.java @@ -209,13 +209,13 @@ abstract class CephFS { abstract protected int ceph_statfs(String path, CephFileSystem.CephStat fill); /* - * Check how many times a path should be replicated (if it is - * degraded it may not actually be replicated this often). + * Check how many times a file should be replicated. If it is, + * degraded it may not actually be replicated this often. * Inputs: - * String path: The path to check. + * int fh: a file descriptor * Returns: an int containing the number of times replicated. */ - abstract protected int ceph_replication(String path); + abstract protected int ceph_replication(int fh); /* * Find the IP address of the primary OSD for a given file and offset. diff --git a/src/client/hadoop/ceph/CephFileSystem.java b/src/client/hadoop/ceph/CephFileSystem.java index 2ea2683fa712..d081558d1d16 100644 --- a/src/client/hadoop/ceph/CephFileSystem.java +++ b/src/client/hadoop/ceph/CephFileSystem.java @@ -535,7 +535,7 @@ public class CephFileSystem extends FileSystem { */ public FSDataOutputStream create(Path path, FsPermission permission, - EnumSet flag, + boolean overwrite, // boolean overwrite, int bufferSize, short replication, @@ -554,8 +554,8 @@ public class CephFileSystem extends FileSystem { } // We ignore replication since that's not configurable here, and // progress reporting is quite limited. - // Required semantics: if the file exists, overwrite if CreateFlag.OVERWRITE; - // throw an exception if !CreateFlag.OVERWRITE. + // Required semantics: if the file exists, overwrite if 'overwrite' is set; + // otherwise, throw an exception // Step 1: existence test boolean exists = exists(abs_path); @@ -566,8 +566,7 @@ public class CephFileSystem extends FileSystem { "create: Cannot overwrite existing directory \"" + path.toString() + "\" with a file"); } - // if (!overwrite) - if (!flag.contains(CreateFlag.OVERWRITE)) { + if (!overwrite) { throw new IOException( "createRaw: Cannot open existing file \"" + abs_path.toString() + "\" for writing without overwrite flag"); diff --git a/src/client/hadoop/ceph/TestCeph.java b/src/client/hadoop/ceph/TestCeph.java index 7f872c888b2e..a63fc6265b12 100644 --- a/src/client/hadoop/ceph/TestCeph.java +++ b/src/client/hadoop/ceph/TestCeph.java @@ -25,8 +25,8 @@ package org.apache.hadoop.fs.ceph; import java.io.IOException; import java.net.URI; -import org.apache.hadoop.fs.FileSystemContractBaseTest; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystemContractBaseTest; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;