]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Hadoop: All configuration is now done through Hadoop's config mechanism.
authorGreg Farnum <gregf@hq.newdream.net>
Fri, 31 Jul 2009 21:17:29 +0000 (14:17 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Mon, 3 Aug 2009 19:01:06 +0000 (12:01 -0700)
This includes debug on CephFileSystem/n, passing it to ceph's Client,
and the monitor address.

src/client/hadoop/CephFSInterface.cc
src/client/hadoop/CephFSInterface.h
src/client/hadoop/ceph/CephFileSystem.java
src/client/hadoop/org_apache_hadoop_fs_ceph_CephFileSystem.h

index f86b1e9445f169ebff0e47ebdd9f7f6ba9194644..5c00ac1014bec044b399868b35ed9508ff0b56b3 100644 (file)
@@ -9,24 +9,30 @@
 #include <sys/stat.h>
 
 using namespace std;
-
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
  * Method:    ceph_initializeClient
  * Signature: (Ljava/lang/String;)Z
  */
+
+/*
+ * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
+ * Method:    ceph_initializeClient
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
+ */
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
-  (JNIEnv * env, jobject obj, jstring j_debug_level)
+  (JNIEnv * env, jobject obj, jstring j_debug_level, jstring j_mon_addr)
 {
   dout(3) << "CephFSInterface: Initializing Ceph client:" << dendl;
 
   const char* c_debug_level = env->GetStringUTFChars(j_debug_level, 0);
+  const char* c_mon_addr = env->GetStringUTFChars(j_mon_addr, 0);
   //construct an arguments array
   const char *argv[10];
   int argc = 0;
   argv[argc++] = "CephFSInterface";
   argv[argc++] = "-m";
-  argv[argc++] = "10.0.1.247:6789";
+  argv[argc++] = c_mon_addr;
   argv[argc++] = "--debug_client";
   argv[argc++] = c_debug_level;
 
index 3381157be61e93181a6434df6c5eb3605eea6152..5b5f7c39ef36bfee6c8610b0915cb46c8ea118c6 100644 (file)
@@ -14,14 +14,14 @@ extern "C" {
 #define org_apache_hadoop_fs_ceph_CephFileSystem_DEFAULT_BLOCK_SIZE 8388608LL
 #undef org_apache_hadoop_fs_ceph_CephInputStream_SKIP_BUFFER_SIZE
 #define org_apache_hadoop_fs_ceph_CephInputStream_SKIP_BUFFER_SIZE 2048L
-  
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
  * Method:    ceph_initializeClient
- * Signature: (Ljava/lang/String;)Z
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
  */
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
-  (JNIEnv *, jobject, jstring);
+  (JNIEnv *, jobject, jstring, jstring);
+
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
  * Method:    ceph_copyFromLocalFile
index 779deeabd7145aabb50bd6b1fac5d42324730677..1ac920949d73a41ef55945dbebbf75f3e5f7504a 100644 (file)
@@ -39,15 +39,14 @@ public class CephFileSystem extends FileSystem {
   private URI uri;
 
   private FileSystem localFs;
-  
   private Path root;
-
   private Path parent;
 
-  private static boolean debug = false;
-  private static String cephDebugLevel = "0";
+  private static boolean debug;
+  private static String cephDebugLevel;
+  private static String monAddr;
   
-  private native boolean ceph_initializeClient(String debugLevel);
+  private native boolean ceph_initializeClient(String debugLevel, String mon);
   private native boolean ceph_copyFromLocalFile(String localPath, String cephPath);
   private native boolean ceph_copyToLocalFile(String cephPath, String localPath);
   private native String  ceph_getcwd();
@@ -97,8 +96,11 @@ public class CephFileSystem extends FileSystem {
     // TODO: local filesystem? we really need to figure out this conf thingy
     this.localFs = get(URI.create("file:///"), conf);
 
+    monAddr = conf.get("fs.ceph.monAddr");
+    cephDebugLevel = conf.get("fs.ceph.debugLevel");
+    debug = ("true".equals(conf.get("fs.ceph.debug")));
     //  Initializes the client
-    if (!ceph_initializeClient(cephDebugLevel)) {
+    if (!ceph_initializeClient(cephDebugLevel, monAddr)) {
       throw new IOException("Ceph initialization failed!");
     }
     debug("Initialized client. Setting cwd to /");
index 521a3f72e5488d231e8ba918feedffaadbc39381..83c058a5993ea610bcd8b1dc3bdd93ba77bbaf92 100644 (file)
@@ -12,10 +12,10 @@ extern "C" {
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
  * Method:    ceph_initializeClient
- * Signature: (Ljava/lang/String;)Z
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
  */
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
-  (JNIEnv *, jobject, jstring);
+  (JNIEnv *, jobject, jstring, jstring);
 
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem