You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Alexandre Dupriez (JIRA)" <ji...@apache.org> on 2019/08/05 14:34:00 UTC

[jira] [Commented] (KAFKA-8750) Utils#murmur2() method switch case block don't have break

    [ https://issues.apache.org/jira/browse/KAFKA-8750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16900121#comment-16900121 ] 

Alexandre Dupriez commented on KAFKA-8750:
------------------------------------------

The waterfall is expected. If say, the remaining length is 3, in addition to {{data[n-1]}}, you still need to process {{data[n-2]}} and {{data[n-3]}} to calculate the hash.  

> Utils#murmur2() method switch case block don't have break
> ---------------------------------------------------------
>
>                 Key: KAFKA-8750
>                 URL: https://issues.apache.org/jira/browse/KAFKA-8750
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>            Reporter: yangkun
>            Priority: Major
>
> Utils#murmur2() is as following, switch case block don't have break.
>  
> {code:java}
> public static int murmur2(final byte[] data) {
>     ...
>     switch (length % 4) {
>         case 3:
>             h ^= (data[(length & ~3) + 2] & 0xff) << 16;
>             // no break
>         case 2:
>             h ^= (data[(length & ~3) + 1] & 0xff) << 8;
>             // no break
>         case 1:
>             h ^= data[length & ~3] & 0xff;
>             h *= m;
>     }
>    ...
>     return h;
> }
> {code}
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)