Return-Path: Delivered-To: apmail-hadoop-hbase-dev-archive@locus.apache.org Received: (qmail 40575 invoked from network); 20 Jan 2009 06:39:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Jan 2009 06:39:21 -0000 Received: (qmail 31347 invoked by uid 500); 20 Jan 2009 06:39:20 -0000 Delivered-To: apmail-hadoop-hbase-dev-archive@hadoop.apache.org Received: (qmail 31331 invoked by uid 500); 20 Jan 2009 06:39:20 -0000 Mailing-List: contact hbase-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hbase-dev@hadoop.apache.org Delivered-To: mailing list hbase-dev@hadoop.apache.org Received: (qmail 31320 invoked by uid 99); 20 Jan 2009 06:39:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jan 2009 22:39:20 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jan 2009 06:39:19 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id ABA40234C48D for ; Mon, 19 Jan 2009 22:38:59 -0800 (PST) Message-ID: <1951627347.1232433539701.JavaMail.jira@brutus> Date: Mon, 19 Jan 2009 22:38:59 -0800 (PST) From: "stack (JIRA)" To: hbase-dev@hadoop.apache.org Subject: [jira] Resolved: (HBASE-1136) HashFunction inadvertently destroys some randomness In-Reply-To: <674646780.1232391721647.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HBASE-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] stack resolved HBASE-1136. -------------------------- Resolution: Fixed Committed (again). Thanks for the fixup Jonathan. There is no unit test up in Hadoop. > HashFunction inadvertently destroys some randomness > --------------------------------------------------- > > Key: HBASE-1136 > URL: https://issues.apache.org/jira/browse/HBASE-1136 > Project: Hadoop HBase > Issue Type: Bug > Reporter: Jonathan Ellis > Fix For: 0.20.0 > > Attachments: hash.patch, hbase-testfilter.patch > > > the code > for (int i = 0, initval = 0; i < nbHash; i++) { > initval = result[i] = Math.abs(hashFunction.hash(b, initval) % maxValue); > } > restricts initval for the next hash to the [0, maxValue) range of the hash indexes returned. This is suboptimal, particularly for larger nbHash and smaller maxValue. Instead, use: > for (int i = 0, initval = 0; i < nbHash; i++) { > initval = hashFunction.hash(b, initval); > result[i] = Math.abs(initval) % maxValue; > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.