import org.apache.hadoop.fs.permission.FsAction;
import org.apache.hadoop.util.Progressable;
import org.apache.hadoop.fs.FileStatus;
-//import org.apache.hadoop.fs.FsStatus;
-//import org.apache.hadoop.fs.CreateFlag;
+import org.apache.hadoop.fs.FsStatus;
+import org.apache.hadoop.fs.CreateFlag;
/**
* <p>
* Create a new file and open an FSDataOutputStream that's connected to it.
* @param path The file to create.
* @param permission The permissions to apply to the file.
- * @param overwrite If true, overwrite any existing file with this name.
+ * @param flag If CreateFlag.OVERWRITE, overwrite any existing
+ * file with this name; otherwise don't.
* @param bufferSize Ceph does internal buffering; this is ignored.
- * @param replication Ignored by Ceph. This can be configured via Ceph configuration.
- * @param blockSize Ignored by Ceph.
- * @param progress A Progressable to report back to. Reporting is limited but exists.
+ * @param replication Ignored by Ceph. This can be
+ * configured via Ceph configuration.
+ * @param blockSize Ignored by Ceph. You can set client-wide block sizes
+ * via the fs.ceph.blockSize param if you like.
+ * @param progress A Progressable to report back to.
+ * Reporting is limited but exists.
* @return An FSDataOutputStream pointing to the created file.
* @throws IOException if initialize() hasn't been called, or the path is an
* existing directory, or the path exists but overwrite is false, or there is a
*/
public FSDataOutputStream create(Path path,
FsPermission permission,
- //EnumSet<CreateFlag> flag,
- boolean overwrite,
+ EnumSet<CreateFlag> flag,
+ //boolean overwrite,
int bufferSize,
short replication,
long blockSize,
if(isDirectory(abs_path))
throw new IOException("create: Cannot overwrite existing directory \""
+ path.toString() + "\" with a file");
- if (!overwrite)
- //if (!flag.contains(CreateFlag.OVERWRITE)) {
+ //if (!overwrite)
+ if (!flag.contains(CreateFlag.OVERWRITE))
throw new IOException("createRaw: Cannot open existing file \""
+ abs_path.toString()
+ "\" for writing without overwrite flag");
OutputStream cephOStream = new CephOutputStream(getConf(), fh);
if(debug) debug("create:exit");
return new FSDataOutputStream(cephOStream);
- }
+ }
/**
* Open a Ceph file and attach the file handle to an FSDataInputStream.
* @return FsStatus reportin capacity, usage, and remaining spac.
* @throws IOException if initialize() hasn't been called, or the
* stat somehow fails.
- *
+ */
public FsStatus getStatus (Path path) throws IOException {
if (!initialized) throw new IOException("You have to initialize the"
+ " CephFileSystem before calling other methods.");
if(debug) debug("getStatus:exit");
return new FsStatus(ceph_stat.capacity,
ceph_stat.used, ceph_stat.remaining);
- } */
+ }
/**
* Delete the given path, and any children if it's a directory.
<h3>Introduction</h3>
-This page describes how to use <a href="http://ceph.newdream.net"> Ceph </a>
-as a backing store with Hadoop. This page assumes that you have downloaded
+This page describes how to use <a href="http://ceph.newdream.net">Ceph</a>
+as a backing store with Hadoop. This page assumes that you have downloaded
the Ceph software and installed necessary binaries as outlined in the Ceph
documentation.
<value>/usr/local/lib</value>
<description>The folder holding libceph and libhadoopceph</description>
</property>
+</pre>
+ <li>There are also a number of optional Ceph configuration options.
+<pre>
+<property>
+ <name>fs.ceph.blockSize</name>
+ <value>67108864</value>
+ <description>Defaulting to 64MB, this is the size (in bytes) you want Ceph to use in striping data internally and presenting it to Hadoop.</description>
+</property>
+
+<property>
+ <name>fs.ceph.debug</name>
+ <value>true</value>
+ <description>If true, the Java-based code will print debugging information.</description>
+</property>
+
+<property>
+ <name>fs.ceph.clientDebug</name>
+ <value>1</value>
+ <description>If non-zero, the Ceph client will print debugging information (a higher number=more debugging).</description>
+</property>
+
+<property>
+ <name>fs.ceph.messengerDebug</name>
+ <value>1</value>
+ <description>If non-zero, the Ceph messenger will print debugging information (a higher number=more debugging)</description>
+</property>
+
+<property>
+ <name>fs.ceph.readahead</name>
+ <value>1</value>
+ <description>Sets the number of object periods to read ahead in prefetching. This should probably be left at the default of 1.</description>
+</property>
+
+<property>
+ <name>fs.ceph.commandLine</name>
+ <value>a string</value>
+ <description>If you prefer, you may enter any of Ceph's command-line configuration here and it will get passed to the C client. Note that any filled-in configuration options will override what you put here.</description>
+</property>
</pre>
<li>Start up your Ceph instance according to the Ceph documentation.</li>