Przeglądaj źródła

HADOOP-5079 HashFunction inadvertently destroys some randomness

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.20@737313 13f79535-47bb-0310-9956-ffa450edef68
Michael Stack 16 lat temu
rodzic
commit
ea6a244d74

+ 3 - 0
CHANGES.txt

@@ -571,6 +571,9 @@ Release 0.20.0 - Unreleased
     HADOOP-4671. Mark loop control variables shared between threads as
     HADOOP-4671. Mark loop control variables shared between threads as
     volatile. (cdouglas)
     volatile. (cdouglas)
 
 
+    HADOOP-5079. HashFunction inadvertently destroys some randomness
+    (Jonathan Ellis via stack)
+
 Release 0.19.1 - Unreleased
 Release 0.19.1 - Unreleased
 
 
   IMPROVEMENTS
   IMPROVEMENTS

+ 2 - 1
src/core/org/apache/hadoop/util/bloom/HashFunction.java

@@ -111,7 +111,8 @@ public final class HashFunction {
       }
       }
       int[] result = new int[nbHash];
       int[] result = new int[nbHash];
       for (int i = 0, initval = 0; i < nbHash; i++) {
       for (int i = 0, initval = 0; i < nbHash; i++) {
-        initval = result[i] = Math.abs(hashFunction.hash(b, initval) % maxValue);
+	  initval = hashFunction.hash(b, initval);
+	  result[i] = Math.abs(initval) % maxValue;
       }
       }
       return result;
       return result;
   }
   }