hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r669641 - in /hadoop/core/branches/branch-0.18: CHANGES.txt src/core/org/apache/hadoop/fs/kfs/KFSInputStream.java src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java
Date Thu, 19 Jun 2008 18:45:15 GMT
Author: omalley
Date: Thu Jun 19 11:45:14 2008
New Revision: 669641

URL: http://svn.apache.org/viewvc?rev=669641&view=rev
Log:
HADOOP-3569 Merge -r 669638:669639 from trunk to branch 0.18.

Modified:
    hadoop/core/branches/branch-0.18/CHANGES.txt
    hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/fs/kfs/KFSInputStream.java
    hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java

Modified: hadoop/core/branches/branch-0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=669641&r1=669640&r2=669641&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.18/CHANGES.txt Thu Jun 19 11:45:14 2008
@@ -645,6 +645,9 @@
     HADOOP-3320. Fix NullPointerException in NetworkTopology.getDistance().
     (hairong)
 
+    HADOOP-3569. KFS input stream read() now correctly reads 1 byte
+    instead of 4. (Sriram Rao via omalley)
+
 Release 0.17.1 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/fs/kfs/KFSInputStream.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/fs/kfs/KFSInputStream.java?rev=669641&r1=669640&r2=669641&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/fs/kfs/KFSInputStream.java
(original)
+++ hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/fs/kfs/KFSInputStream.java
Thu Jun 19 11:45:14 2008
@@ -79,13 +79,13 @@
         if (kfsChannel == null) {
             throw new IOException("File closed");
         }
-        byte b[] = new byte[4];
-        int res = read(b, 0, 4);
-        if (res == 4) {
+        byte b[] = new byte[1];
+        int res = read(b, 0, 1);
+        if (res == 1) {
           if (statistics != null) {
             statistics.incrementBytesRead(1);
           }
-          return (b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24));  
       
+          return ((int) (b[0] & 0xff));
         }
         return -1;
     }

Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java?rev=669641&r1=669640&r2=669641&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java
(original)
+++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java
Thu Jun 19 11:45:14 2008
@@ -134,7 +134,10 @@
         for (int i = 0; i < data.length; i++)
             data[i] = (byte) (i % 16);
 
-        // write an integer
+        // write 4 bytes and read them back; read API should return a byte per call
+        s1.write(32);
+        s1.write(32);
+        s1.write(32);
         s1.write(32);
         // write some data
         s1.write(data, 0, data.length);
@@ -147,6 +150,12 @@
 
         v = s2.read();
         assertEquals(v, 32);
+        v = s2.read();
+        assertEquals(v, 32);
+        v = s2.read();
+        assertEquals(v, 32);
+        v = s2.read();
+        assertEquals(v, 32);
 
         assertEquals(s2.available(), data.length);
 



Mime
View raw message