From: Greg Farnum Date: Thu, 30 Jul 2009 21:39:02 +0000 (-0700) Subject: Hadoop: Moved ceph debug level set into Java code; disabled CephIOStream debugs. X-Git-Tag: v0.12~44 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0fffbfec8259bcbfb57866455657236024b95db7;p=ceph.git Hadoop: Moved ceph debug level set into Java code; disabled CephIOStream debugs. --- diff --git a/src/client/hadoop/CephFSInterface.cc b/src/client/hadoop/CephFSInterface.cc index 79191a2ebe1f..f85f6b536dfd 100644 --- a/src/client/hadoop/CephFSInterface.cc +++ b/src/client/hadoop/CephFSInterface.cc @@ -10,18 +10,17 @@ 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; } diff --git a/src/client/hadoop/CephFSInterface.h b/src/client/hadoop/CephFSInterface.h index daa6a82bc05b..f5d2dabbf278 100644 --- a/src/client/hadoop/CephFSInterface.h +++ b/src/client/hadoop/CephFSInterface.h @@ -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 diff --git a/src/client/hadoop/ceph/CephFileSystem.java b/src/client/hadoop/ceph/CephFileSystem.java index debe9015b4f1..881a1a3be152 100644 --- a/src/client/hadoop/ceph/CephFileSystem.java +++ b/src/client/hadoop/ceph/CephFileSystem.java @@ -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; } /** diff --git a/src/client/hadoop/ceph/CephInputStream.java b/src/client/hadoop/ceph/CephInputStream.java index 0914bcda175d..2324872b3923 100644 --- a/src/client/hadoop/ceph/CephInputStream.java +++ b/src/client/hadoop/ceph/CephInputStream.java @@ -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; diff --git a/src/client/hadoop/ceph/CephOutputStream.java b/src/client/hadoop/ceph/CephOutputStream.java index 614d3014750f..1d37637ccb57 100644 --- a/src/client/hadoop/ceph/CephOutputStream.java +++ b/src/client/hadoop/ceph/CephOutputStream.java @@ -41,7 +41,7 @@ class CephOutputStream extends OutputStream { private byte[] outBuf; - private static boolean debug = true; + private static boolean debug = false; //private List blocks = new ArrayList(); diff --git a/src/client/hadoop/org_apache_hadoop_fs_ceph_CephFileSystem.h b/src/client/hadoop/org_apache_hadoop_fs_ceph_CephFileSystem.h index e6ce747be4bc..3fb1a250ab8e 100644 --- a/src/client/hadoop/org_apache_hadoop_fs_ceph_CephFileSystem.h +++ b/src/client/hadoop/org_apache_hadoop_fs_ceph_CephFileSystem.h @@ -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