]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Hadoop: Moved ceph debug level set into Java code; disabled CephIOStream debugs.
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 30 Jul 2009 21:39:02 +0000 (14:39 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 30 Jul 2009 21:46:38 +0000 (14:46 -0700)
src/client/hadoop/CephFSInterface.cc
src/client/hadoop/CephFSInterface.h
src/client/hadoop/ceph/CephFileSystem.java
src/client/hadoop/ceph/CephInputStream.java
src/client/hadoop/ceph/CephOutputStream.java
src/client/hadoop/org_apache_hadoop_fs_ceph_CephFileSystem.h

index 79191a2ebe1fc818ccdb101143d7842f58732e2d..f85f6b536dfd356bc334a443ce2d75c17b054b8b 100644 (file)
 
 using namespace std;
 
-
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
  * Method:    ceph_initializeClient
- * Signature: ()Z
- * Initializes a ceph client.
+ * Signature: (Ljava/lang/String;)Z
  */
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
-(JNIEnv *env, jobject )
+  (JNIEnv * env, jobject obj, jstring j_debug_level)
 {
   dout(3) << "CephFSInterface: Initializing Ceph client:" << dendl;
 
+  const char* c_debug_level = env->GetStringUTFChars(j_debug_level, 0);
   //construct an arguments array
   const char *argv[10];
   int argc = 0;
@@ -29,10 +28,11 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1i
   argv[argc++] = "-m";
   argv[argc++] = "10.0.1.247:6789";
   argv[argc++] = "--debug_client";
-  argv[argc++] = "20";
+  argv[argc++] = c_debug_level;
 
   ceph_initialize(argc, argv);
   ceph_mount();
+  env->ReleaseStringUTFChars(j_debug_level, c_debug_level);
   return true;
 }
 
@@ -56,6 +56,8 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1c
   int r = ::stat(c_local_path, &st);
   if (r == 0) {
     dout(0) << "CephFSInterface: failed to stat local file " << c_local_path << dendl;
+    env->ReleaseStringUTFChars(j_local_path, c_local_path);
+    env->ReleaseStringUTFChars(j_ceph_path, c_ceph_path);
     return JNI_FALSE;
   }
 
index daa6a82bc05b2bdb52d15445996f4ef3b0640449..f5d2dabbf278f8a3b2ff796487d006940e623f98 100644 (file)
@@ -18,11 +18,10 @@ extern "C" {
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
  * Method:    ceph_initializeClient
- * Signature: ()Z
+ * Signature: (Ljava/lang/String;)Z
  */
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
-  (JNIEnv *, jobject);
-
+  (JNIEnv *, jobject, jstring);
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
  * Method:    ceph_copyFromLocalFile
index debe9015b4f14865aa52e679e81ac2c98f392113..881a1a3be15280da0b3d04cce6710f1d8e022a69 100644 (file)
@@ -43,9 +43,10 @@ public class CephFileSystem extends FileSystem {
 
   private Path parent;
 
-  private static boolean debug = true;
+  private static boolean debug = false;
+  private static String cephDebugLevel = "0";
   
-  private native boolean ceph_initializeClient();
+  private native boolean ceph_initializeClient(String debugLevel);
   private native boolean ceph_copyFromLocalFile(String localPath, String cephPath);
   private native boolean ceph_copyToLocalFile(String cephPath, String localPath);
   private native String  ceph_getcwd();
@@ -96,7 +97,7 @@ public class CephFileSystem extends FileSystem {
     this.localFs = get(URI.create("file:///"), conf);
 
     //  Initializes the client
-    if (!ceph_initializeClient()) {
+    if (!ceph_initializeClient(cephDebugLevel)) {
       throw new IOException("Ceph initialization failed!");
     }
     debug("Initialized client. Setting cwd to /");
@@ -207,8 +208,8 @@ public class CephFileSystem extends FileSystem {
     debug("Returned from ceph_mkdirs to Java with result " + result);
     debug("mkdirs:exit with result " + result);
     if (result != 0)
-      return true;
-    else return false;
+      return false;
+    else return true;
   }
 
   /**
index 0914bcda175d0618506daf1dfb74dd92d338c747..2324872b39235cb1c249911f5f682e43500a25d2 100644 (file)
@@ -26,7 +26,7 @@ class CephInputStream extends FSInputStream {
 
   private long fileLength;
 
-  private static boolean debug = true;
+  private static boolean debug = false;
 
   //private long pos = 0;
 
index 614d3014750feea023ba61f19f0118a6a6189f3e..1d37637ccb57ee97832e2dd3ef8c2dc761f86ccb 100644 (file)
@@ -41,7 +41,7 @@ class CephOutputStream extends OutputStream {
 
   private byte[] outBuf;
 
-  private static boolean debug = true;
+  private static boolean debug = false;
 
   //private List<Block> blocks = new ArrayList<Block>();
 
index e6ce747be4bc4dbbaef8675b117276fa558ced52..3fb1a250ab8e16c5fd87356c2e99815049346f89 100644 (file)
@@ -12,10 +12,10 @@ extern "C" {
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
  * Method:    ceph_initializeClient
- * Signature: ()J
+ * Signature: (Ljava/lang/String;)Z
  */
-JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
-  (JNIEnv *, jobject);
+JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
+  (JNIEnv *, jobject, jstring);
 
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem