From: Greg Farnum Date: Wed, 4 Nov 2009 22:14:41 +0000 (-0800) Subject: Hadoop: Numerous fixes. X-Git-Tag: v0.18~128^2~30 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=56a1f5eeef5092e158231c4cd22ecb60e997ce33;p=ceph.git Hadoop: Numerous fixes. Set bufUsed=0 on a flush to avoid bad rewrites of data Downgrade a warning in IOStream since Hadoop apparently checks for EOF by reading until a read returns -1. Remove some leftover if checks that don't do anything. TODO: Remove something Sage did already. --- diff --git a/src/TODO b/src/TODO index e9fc740b26c2..4f4465bee76f 100644 --- a/src/TODO +++ b/src/TODO @@ -69,7 +69,6 @@ greg - osd: use client session to control osdmaps to clients (auth branch) - osd: error handling - uclient: readdir from cache -- replicate rstat error? - mds: basic auth checks later diff --git a/src/client/hadoop/ceph/CephInputStream.java b/src/client/hadoop/ceph/CephInputStream.java index 73c8a4ac3c8c..74a1698096e4 100644 --- a/src/client/hadoop/ceph/CephInputStream.java +++ b/src/client/hadoop/ceph/CephInputStream.java @@ -174,7 +174,7 @@ public class CephInputStream extends FSInputStream { ceph.debug("CephInputStream.read: cannot read " + len + " bytes from fd " + fileHandle + ": current position is " + getPos() + " and file length is " + fileLength, - ceph.WARN); + ceph.DEBUG); return -1; } diff --git a/src/client/hadoop/ceph/CephOutputStream.java b/src/client/hadoop/ceph/CephOutputStream.java index e8e5f8973bb9..c7dc3a4a0e8a 100644 --- a/src/client/hadoop/ceph/CephOutputStream.java +++ b/src/client/hadoop/ceph/CephOutputStream.java @@ -114,14 +114,6 @@ public class CephOutputStream extends OutputStream { "bytes to fd " + fileHandle + ": stream closed"); } - // sanity check - if (null == buf) { - } - - // check for proper index bounds - if((off < 0) || (len < 0) || (off + len > buf.length)) { - } - int result; int write; while (len>0) { @@ -137,7 +129,7 @@ public class CephOutputStream extends OutputStream { } catch (ArrayStoreException ae) { throw new IOException("Uh-oh, CephOutputStream failed to do an array" - + "copy due to type mismatch..."); + + " copy due to type mismatch..."); } catch (NullPointerException ne) { throw new IOException("CephOutputStream.write: cannot write " @@ -155,9 +147,11 @@ public class CephOutputStream extends OutputStream { if (result != bufUsed) throw new IOException("CephOutputStream.write: Wrote only " + result + " bytes of " + bufUsed - + "in buffer!"); + + " in buffer! Data may be lost or written" + + " twice to Ceph!"); bufUsed = 0; } + } return; } @@ -182,6 +176,7 @@ public class CephOutputStream extends OutputStream { + "was incomplete: only " + result + " of " + bufUsed + " bytes were written."); } + bufUsed = 0; return; } }