]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Hadoop: More debugging output changes.
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 30 Jul 2009 00:01:54 +0000 (17:01 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 30 Jul 2009 21:40:10 +0000 (14:40 -0700)
src/client/Client.h
src/client/hadoop/CephFSInterface.cc
src/client/hadoop/ceph/CephFileSystem.java
src/client/hadoop/ceph/CephInputStream.java
src/client/hadoop/ceph/CephOutputStream.java

index fb189106c6ca05885a5ad9452c9cf8e67123bc70..9ee722cc72b39086233ffc5daa38f892ed1dd059 100644 (file)
@@ -380,11 +380,11 @@ class Inode {
 
   void get() { 
     ref++; 
-    //dout(0) << "inode.get on " << this << " " << hex << ino << dec << " now " << ref << dendl;
+    dout(0) << "inode.get on " << this << " " << hex << ino << dec << " now " << ref << dendl;
   }
   void put(int n=1) { 
     ref -= n; 
-    //dout(0) << "inode.put on " << this << " " << hex << ino << dec << " now " << ref << dendl;
+    dout(0) << "inode.put on " << this << " " << hex << ino << dec << " now " << ref << dendl;
     assert(ref >= 0);
   }
 
index f83e25fc8d9b27eba4a512717ee347a2d0c3783d..79191a2ebe1fc818ccdb101143d7842f58732e2d 100644 (file)
@@ -28,6 +28,8 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1i
   argv[argc++] = "CephFSInterface";
   argv[argc++] = "-m";
   argv[argc++] = "10.0.1.247:6789";
+  argv[argc++] = "--debug_client";
+  argv[argc++] = "20";
 
   ceph_initialize(argc, argv);
   ceph_mount();
index f8111b55a2547d8cc5ce6ec4ef7ec92e234c8503..4a90ed44c39d2135094520efade9e81b463e1cbf 100644 (file)
@@ -105,6 +105,7 @@ public class CephFileSystem extends FileSystem {
   @Override
     public void close() throws IOException {
     debug("close:enter");
+    System.gc(); //to run the finalizers on CephInput/OutputStreams
     ceph_kill_client();
     //for some reason this just hangs, so not doing it for now
     debug("close:exit");
index 26f88de881afd42bc820db1e7d256a3118086457..0914bcda175d0618506daf1dfb74dd92d338c747 100644 (file)
@@ -26,6 +26,8 @@ class CephInputStream extends FSInputStream {
 
   private long fileLength;
 
+  private static boolean debug = true;
+
   //private long pos = 0;
 
   //private DataInputStream blockStream;
@@ -63,6 +65,14 @@ class CephInputStream extends FSInputStream {
     // Anything? Bueller?
 
   }
+  //Ceph requires that things be closed before it can shutdown,
+  //so closing the IOStream stuff voluntarily is good
+  public void finalize () throws Throwable {
+    try {
+      if (!closed) close();
+    }
+    finally { super.finalize(); }
+  }
 
   public synchronized long getPos() throws IOException {
     return ceph_getpos(fileHandle);
@@ -149,6 +159,7 @@ class CephInputStream extends FSInputStream {
 
   @Override
     public void close() throws IOException {
+    debug("CephOutputStream.close:enter");
     if (closed) {
       throw new IOException("Stream closed");
     }
@@ -157,8 +168,8 @@ class CephInputStream extends FSInputStream {
     if (result != 0) {
       throw new IOException("Close failed!");
     }
-       
     closed = true;
+    debug("CephOutputStream.close:exit");
   }
 
   /**
@@ -179,4 +190,7 @@ class CephInputStream extends FSInputStream {
     throw new IOException("Mark not supported");
   }
 
+  private void debug(String out) {
+    if (debug) System.out.println(out);
+  }
 }
index 5d01c056332761f235e7d9ceb4d13364fe173a2c..614d3014750feea023ba61f19f0118a6a6189f3e 100644 (file)
@@ -41,6 +41,8 @@ class CephOutputStream extends OutputStream {
 
   private byte[] outBuf;
 
+  private static boolean debug = true;
+
   //private List<Block> blocks = new ArrayList<Block>();
 
   //private Block nextBlock;
@@ -81,6 +83,15 @@ class CephOutputStream extends OutputStream {
     closed = false;
   }
 
+  //Ceph requires that things be closed before it can shutdown,
+  //so closing the IOStream stuff voluntarily is good
+  public void finalize () throws Throwable {
+    try {
+      if (!closed) close();
+    }
+    finally { super.finalize();}
+  }
+
   // possibly useful for the local copy, write later thing?
   // keep it around for now
   private File newBackupFile() throws IOException {
@@ -161,6 +172,7 @@ class CephOutputStream extends OutputStream {
     
   @Override
     public synchronized void close() throws IOException {
+      debug("CephOutputStream.close:enter");
       if (closed) {
        throw new IOException("Stream closed");
       }
@@ -171,8 +183,12 @@ class CephOutputStream extends OutputStream {
       }
        
       closed = true;
-
+      debug("CephOutputStream.close:exit");
     }
+
+  private void debug(String out) {
+    if (debug) System.out.println(out);
+  }
     
 
 }