Kaynağa Gözat

HADOOP-3550. Fix the serialization data structures in MapTask where the value
lengths are incorrectly calculated.



git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.17@669322 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas 17 yıl önce
ebeveyn
işleme
87d3d20678
2 değiştirilmiş dosya ile 7 ekleme ve 3 silme
  1. 3 0
      CHANGES.txt
  2. 4 3
      src/java/org/apache/hadoop/mapred/MapTask.java

+ 3 - 0
CHANGES.txt

@@ -20,6 +20,9 @@ Release 0.17.1
     HADOOP-3475. Fix MapTask to correctly size the accounting allocation of
     io.sort.mb. (cdouglas)
 
+    HADOOP-3550. Fix the serialization data structures in MapTask where the
+    value lengths are incorrectly calculated. (cdouglas)
+
 Release 0.17.1 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 4 - 3
src/java/org/apache/hadoop/mapred/MapTask.java

@@ -435,7 +435,7 @@ class MapTask extends Task {
       try {
         int keystart = bufindex;
         keySerializer.serialize(key);
-        if (bufindex < keystart) {
+        if (bufindex < keystart || bufindex == bufvoid) {
           // wrapped the key; reset required
           bb.reset();
           keystart = 0;
@@ -855,10 +855,11 @@ class MapTask extends Task {
      * deserialized value bytes. Should only be called during a spill.
      */
     private void getVBytesForOffset(int kvoff, InMemValBytes vbytes) {
-      final int nextindex = kvoff / ACCTSIZE == kvend - 1
+      final int nextindex = ((kvoff/ACCTSIZE) == 
+                             ((kvend - 1 + kvoffsets.length) % kvoffsets.length))
         ? bufend
         : kvindices[(kvoff + ACCTSIZE + KEYSTART) % kvindices.length];
-      int vallen = (nextindex > kvindices[kvoff + VALSTART])
+      int vallen = (nextindex >= kvindices[kvoff + VALSTART])
         ? nextindex - kvindices[kvoff + VALSTART]
         : (bufvoid - kvindices[kvoff + VALSTART]) + nextindex;
       vbytes.reset(kvindices[kvoff + VALSTART], vallen);