[jira] [Commented] (HBASE-17859) ByteBufferUtils#compareTo is wrong

2017-04-30 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15990409#comment-15990409
 ] 

Hudson commented on HBASE-17859:


ABORTED: Integrated in Jenkins build HBase-HBASE-14614 #190 (See 
[https://builds.apache.org/job/HBase-HBASE-14614/190/])
HBASE-17859 ByteBufferUtils#compareTo is wrong (chia7712: rev 
73e1bcd33515061be2dc2e51e6ad19d9798a8ef6)
* (edit) 
hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestByteBufferUtils.java
* (edit) 
hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java


> ByteBufferUtils#compareTo is wrong
> --
>
> Key: HBASE-17859
> URL: https://issues.apache.org/jira/browse/HBASE-17859
> Project: HBase
>  Issue Type: Sub-task
>Reporter: Chia-Ping Tsai
>Assignee: Chia-Ping Tsai
>Priority: Critical
> Fix For: 2.0.0
>
> Attachments: HBASE-17859.v0.patch, HBASE-17859.v1.patch
>
>
> buf2.get( i ) & 0xFF; -> buf2.get(j) & 0xFF;
> {noformat}
>   public static int compareTo(byte [] buf1, int o1, int l1, ByteBuffer buf2, 
> int o2, int l2) {
>// 
> int end1 = o1 + l1;
> int end2 = o2 + l2;
> for (int i = o1, j = o2; i < end1 && j < end2; i++, j++) {
>   int a = buf1[i] & 0xFF;
>   int b = buf2.get(i) & 0xFF;
>   if (a != b) {
> return a - b;
>   }
> }
> return l1 - l2;
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (HBASE-17859) ByteBufferUtils#compareTo is wrong

2017-04-01 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15952191#comment-15952191
 ] 

Hudson commented on HBASE-17859:


FAILURE: Integrated in Jenkins build HBase-Trunk_matrix #2779 (See 
[https://builds.apache.org/job/HBase-Trunk_matrix/2779/])
HBASE-17859 ByteBufferUtils#compareTo is wrong (chia7712: rev 
73e1bcd33515061be2dc2e51e6ad19d9798a8ef6)
* (edit) 
hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestByteBufferUtils.java
* (edit) 
hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java


> ByteBufferUtils#compareTo is wrong
> --
>
> Key: HBASE-17859
> URL: https://issues.apache.org/jira/browse/HBASE-17859
> Project: HBase
>  Issue Type: Bug
>Reporter: Chia-Ping Tsai
>Assignee: Chia-Ping Tsai
>Priority: Critical
> Fix For: 2.0.0
>
> Attachments: HBASE-17859.v0.patch, HBASE-17859.v1.patch
>
>
> buf2.get( i ) & 0xFF; -> buf2.get(j) & 0xFF;
> {noformat}
>   public static int compareTo(byte [] buf1, int o1, int l1, ByteBuffer buf2, 
> int o2, int l2) {
>// 
> int end1 = o1 + l1;
> int end2 = o2 + l2;
> for (int i = o1, j = o2; i < end1 && j < end2; i++, j++) {
>   int a = buf1[i] & 0xFF;
>   int b = buf2.get(i) & 0xFF;
>   if (a != b) {
> return a - b;
>   }
> }
> return l1 - l2;
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (HBASE-17859) ByteBufferUtils#compareTo is wrong

2017-03-31 Thread stack (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15951176#comment-15951176
 ] 

stack commented on HBASE-17859:
---

+1 Great find [~chia7712]

> ByteBufferUtils#compareTo is wrong
> --
>
> Key: HBASE-17859
> URL: https://issues.apache.org/jira/browse/HBASE-17859
> Project: HBase
>  Issue Type: Bug
>Reporter: Chia-Ping Tsai
>Assignee: Chia-Ping Tsai
>Priority: Critical
> Fix For: 2.0.0
>
> Attachments: HBASE-17859.v0.patch, HBASE-17859.v1.patch
>
>
> buf2.get( i ) & 0xFF; -> buf2.get(j) & 0xFF;
> {noformat}
>   public static int compareTo(byte [] buf1, int o1, int l1, ByteBuffer buf2, 
> int o2, int l2) {
>// 
> int end1 = o1 + l1;
> int end2 = o2 + l2;
> for (int i = o1, j = o2; i < end1 && j < end2; i++, j++) {
>   int a = buf1[i] & 0xFF;
>   int b = buf2.get(i) & 0xFF;
>   if (a != b) {
> return a - b;
>   }
> }
> return l1 - l2;
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (HBASE-17859) ByteBufferUtils#compareTo is wrong

2017-03-31 Thread Chia-Ping Tsai (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15951055#comment-15951055
 ] 

Chia-Ping Tsai commented on HBASE-17859:


Will commit it tomorrow if no objection.

> ByteBufferUtils#compareTo is wrong
> --
>
> Key: HBASE-17859
> URL: https://issues.apache.org/jira/browse/HBASE-17859
> Project: HBase
>  Issue Type: Bug
>Reporter: Chia-Ping Tsai
>Assignee: Chia-Ping Tsai
>Priority: Critical
> Fix For: 2.0.0
>
> Attachments: HBASE-17859.v0.patch, HBASE-17859.v1.patch
>
>
> buf2.get( i ) & 0xFF; -> buf2.get(j) & 0xFF;
> {noformat}
>   public static int compareTo(byte [] buf1, int o1, int l1, ByteBuffer buf2, 
> int o2, int l2) {
>// 
> int end1 = o1 + l1;
> int end2 = o2 + l2;
> for (int i = o1, j = o2; i < end1 && j < end2; i++, j++) {
>   int a = buf1[i] & 0xFF;
>   int b = buf2.get(i) & 0xFF;
>   if (a != b) {
> return a - b;
>   }
> }
> return l1 - l2;
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (HBASE-17859) ByteBufferUtils#compareTo is wrong

2017-03-31 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15950794#comment-15950794
 ] 

Hadoop QA commented on HBASE-17859:
---

| (/) *{color:green}+1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
| {color:blue}0{color} | {color:blue} reexec {color} | {color:blue} 0m 20s 
{color} | {color:blue} Docker mode activated. {color} |
| {color:green}+1{color} | {color:green} hbaseanti {color} | {color:green} 0m 
0s {color} | {color:green} Patch does not have any anti-patterns. {color} |
| {color:green}+1{color} | {color:green} @author {color} | {color:green} 0m 0s 
{color} | {color:green} The patch does not contain any @author tags. {color} |
| {color:green}+1{color} | {color:green} test4tests {color} | {color:green} 0m 
0s {color} | {color:green} The patch appears to include 1 new or modified test 
files. {color} |
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 4m 
9s {color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 21s 
{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 0m 
25s {color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} mvneclipse {color} | {color:green} 0m 
12s {color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} findbugs {color} | {color:green} 0m 
51s {color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 0m 21s 
{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 0m 
22s {color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 21s 
{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javac {color} | {color:green} 0m 21s 
{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 0m 
25s {color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} mvneclipse {color} | {color:green} 0m 
12s {color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} whitespace {color} | {color:green} 0m 
0s {color} | {color:green} The patch has no whitespace issues. {color} |
| {color:green}+1{color} | {color:green} hadoopcheck {color} | {color:green} 
34m 6s {color} | {color:green} Patch does not cause any errors with Hadoop 
2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7.1 2.7.2 2.7.3 or 3.0.0-alpha2. {color} |
| {color:green}+1{color} | {color:green} findbugs {color} | {color:green} 0m 
50s {color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 0m 16s 
{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} unit {color} | {color:green} 1m 54s 
{color} | {color:green} hbase-common in the patch passed. {color} |
| {color:green}+1{color} | {color:green} asflicense {color} | {color:green} 0m 
9s {color} | {color:green} The patch does not generate ASF License warnings. 
{color} |
| {color:black}{color} | {color:black} {color} | {color:black} 45m 40s {color} 
| {color:black} {color} |
\\
\\
|| Subsystem || Report/Notes ||
| Docker | Client=1.11.2 Server=1.11.2 Image:yetus/hbase:8d52d23 |
| JIRA Patch URL | 
https://issues.apache.org/jira/secure/attachment/12861435/HBASE-17859.v1.patch |
| JIRA Issue | HBASE-17859 |
| Optional Tests |  asflicense  javac  javadoc  unit  findbugs  hadoopcheck  
hbaseanti  checkstyle  compile  |
| uname | Linux 9865a64654f0 3.13.0-105-generic #152-Ubuntu SMP Fri Dec 2 
15:37:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | 
/home/jenkins/jenkins-slave/workspace/PreCommit-HBASE-Build/component/dev-support/hbase-personality.sh
 |
| git revision | master / a9682ca |
| Default Java | 1.8.0_121 |
| findbugs | v3.0.0 |
|  Test Results | 
https://builds.apache.org/job/PreCommit-HBASE-Build/6282/testReport/ |
| modules | C: hbase-common U: hbase-common |
| Console output | 
https://builds.apache.org/job/PreCommit-HBASE-Build/6282/console |
| Powered by | Apache Yetus 0.3.0   http://yetus.apache.org |


This message was automatically generated.



> ByteBufferUtils#compareTo is wrong
> --
>
> Key: HBASE-17859
> URL: https://issues.apache.org/jira/browse/HBASE-17859
> Project: HBase
>  Issue Type: Bug
>Reporter: Chia-Ping Tsai
>Assignee: Chia-Ping Tsai
>Priority: Critical
> Fix For: 2.0.0
>
> Attachments: HBASE-17859.v0.patch, HBASE-17859.v1.patch
>
>
> buf2.get( i ) & 0xFF; -> buf2.get(j) & 0xFF;

[jira] [Commented] (HBASE-17859) ByteBufferUtils#compareTo is wrong

2017-03-31 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15950686#comment-15950686
 ] 

Hadoop QA commented on HBASE-17859:
---

| (x) *{color:red}-1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
| {color:blue}0{color} | {color:blue} reexec {color} | {color:blue} 0m 17s 
{color} | {color:blue} Docker mode activated. {color} |
| {color:green}+1{color} | {color:green} hbaseanti {color} | {color:green} 0m 
0s {color} | {color:green} Patch does not have any anti-patterns. {color} |
| {color:green}+1{color} | {color:green} @author {color} | {color:green} 0m 0s 
{color} | {color:green} The patch does not contain any @author tags. {color} |
| {color:red}-1{color} | {color:red} test4tests {color} | {color:red} 0m 0s 
{color} | {color:red} The patch doesn't appear to include any new or modified 
tests. Please justify why no new tests are needed for this patch. Also please 
list what manual steps were performed to verify this patch. {color} |
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 3m 
55s {color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 18s 
{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 0m 
23s {color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} mvneclipse {color} | {color:green} 0m 
12s {color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} findbugs {color} | {color:green} 0m 
44s {color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 0m 21s 
{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 0m 
22s {color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 20s 
{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javac {color} | {color:green} 0m 20s 
{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 0m 
28s {color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} mvneclipse {color} | {color:green} 0m 
12s {color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} whitespace {color} | {color:green} 0m 
0s {color} | {color:green} The patch has no whitespace issues. {color} |
| {color:green}+1{color} | {color:green} hadoopcheck {color} | {color:green} 
35m 50s {color} | {color:green} Patch does not cause any errors with Hadoop 
2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7.1 2.7.2 2.7.3 or 3.0.0-alpha2. {color} |
| {color:green}+1{color} | {color:green} findbugs {color} | {color:green} 0m 
55s {color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 0m 22s 
{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} unit {color} | {color:green} 2m 8s 
{color} | {color:green} hbase-common in the patch passed. {color} |
| {color:green}+1{color} | {color:green} asflicense {color} | {color:green} 0m 
8s {color} | {color:green} The patch does not generate ASF License warnings. 
{color} |
| {color:black}{color} | {color:black} {color} | {color:black} 47m 19s {color} 
| {color:black} {color} |
\\
\\
|| Subsystem || Report/Notes ||
| Docker | Client=1.12.3 Server=1.12.3 Image:yetus/hbase:8d52d23 |
| JIRA Patch URL | 
https://issues.apache.org/jira/secure/attachment/12861419/HBASE-17859.v0.patch |
| JIRA Issue | HBASE-17859 |
| Optional Tests |  asflicense  javac  javadoc  unit  findbugs  hadoopcheck  
hbaseanti  checkstyle  compile  |
| uname | Linux 1ec64f8e7f09 3.13.0-106-generic #153-Ubuntu SMP Tue Dec 6 
15:44:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | 
/home/jenkins/jenkins-slave/workspace/PreCommit-HBASE-Build/component/dev-support/hbase-personality.sh
 |
| git revision | master / a9682ca |
| Default Java | 1.8.0_121 |
| findbugs | v3.0.0 |
|  Test Results | 
https://builds.apache.org/job/PreCommit-HBASE-Build/6279/testReport/ |
| modules | C: hbase-common U: hbase-common |
| Console output | 
https://builds.apache.org/job/PreCommit-HBASE-Build/6279/console |
| Powered by | Apache Yetus 0.3.0   http://yetus.apache.org |


This message was automatically generated.



> ByteBufferUtils#compareTo is wrong
> --
>
> Key: HBASE-17859
> URL: https://issues.apache.org/jira/browse/HBASE-17859
> Project: HBase
>  Issue Type: Bug
>Reporter: Chia-Ping Tsai
>Assignee: Chia-Ping Tsai
>Priority: Critical
> Fix 

[jira] [Commented] (HBASE-17859) ByteBufferUtils#compareTo is wrong

2017-03-31 Thread ramkrishna.s.vasudevan (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15950667#comment-15950667
 ] 

ramkrishna.s.vasudevan commented on HBASE-17859:


All our recent perf test had a perf issue. Should be this one. 

> ByteBufferUtils#compareTo is wrong
> --
>
> Key: HBASE-17859
> URL: https://issues.apache.org/jira/browse/HBASE-17859
> Project: HBase
>  Issue Type: Bug
>Reporter: Chia-Ping Tsai
>Assignee: Chia-Ping Tsai
>Priority: Critical
> Fix For: 2.0.0
>
> Attachments: HBASE-17859.v0.patch
>
>
> buf2.get( i ) & 0xFF; -> buf2.get(j) & 0xFF;
> {noformat}
>   public static int compareTo(byte [] buf1, int o1, int l1, ByteBuffer buf2, 
> int o2, int l2) {
>// 
> int end1 = o1 + l1;
> int end2 = o2 + l2;
> for (int i = o1, j = o2; i < end1 && j < end2; i++, j++) {
>   int a = buf1[i] & 0xFF;
>   int b = buf2.get(i) & 0xFF;
>   if (a != b) {
> return a - b;
>   }
> }
> return l1 - l2;
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (HBASE-17859) ByteBufferUtils#compareTo is wrong

2017-03-31 Thread Anoop Sam John (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15950664#comment-15950664
 ] 

Anoop Sam John commented on HBASE-17859:


Thanks a ton...  Great catch..
So silly copy paste problem.. Am sure we have struggled because of this in our 
recent perf tests.

+1

> ByteBufferUtils#compareTo is wrong
> --
>
> Key: HBASE-17859
> URL: https://issues.apache.org/jira/browse/HBASE-17859
> Project: HBase
>  Issue Type: Bug
>Reporter: Chia-Ping Tsai
>Assignee: Chia-Ping Tsai
> Fix For: 2.0.0
>
> Attachments: HBASE-17859.v0.patch
>
>
> buf2.get( i ) & 0xFF; -> buf2.get(j) & 0xFF;
> {noformat}
>   public static int compareTo(byte [] buf1, int o1, int l1, ByteBuffer buf2, 
> int o2, int l2) {
>// 
> int end1 = o1 + l1;
> int end2 = o2 + l2;
> for (int i = o1, j = o2; i < end1 && j < end2; i++, j++) {
>   int a = buf1[i] & 0xFF;
>   int b = buf2.get(i) & 0xFF;
>   if (a != b) {
> return a - b;
>   }
> }
> return l1 - l2;
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (HBASE-17859) ByteBufferUtils#compareTo is wrong

2017-03-31 Thread Chia-Ping Tsai (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15950658#comment-15950658
 ] 

Chia-Ping Tsai commented on HBASE-17859:


bq. Add a unit test to prevent regression ?
I will add tests in next patch.

bq. So this will lead to issues when we have Bytebuffer cell and normal KV?
yes, it makes the wrong result if we don't use the UNSAFE.

> ByteBufferUtils#compareTo is wrong
> --
>
> Key: HBASE-17859
> URL: https://issues.apache.org/jira/browse/HBASE-17859
> Project: HBase
>  Issue Type: Bug
>Reporter: Chia-Ping Tsai
>Assignee: Chia-Ping Tsai
> Fix For: 2.0.0
>
> Attachments: HBASE-17859.v0.patch
>
>
> buf2.get( i ) & 0xFF; -> buf2.get(j) & 0xFF;
> {noformat}
>   public static int compareTo(byte [] buf1, int o1, int l1, ByteBuffer buf2, 
> int o2, int l2) {
>// 
> int end1 = o1 + l1;
> int end2 = o2 + l2;
> for (int i = o1, j = o2; i < end1 && j < end2; i++, j++) {
>   int a = buf1[i] & 0xFF;
>   int b = buf2.get(i) & 0xFF;
>   if (a != b) {
> return a - b;
>   }
> }
> return l1 - l2;
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (HBASE-17859) ByteBufferUtils#compareTo is wrong

2017-03-31 Thread ramkrishna.s.vasudevan (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15950651#comment-15950651
 ] 

ramkrishna.s.vasudevan commented on HBASE-17859:


+1. So this will lead to issues when we have Bytebuffer cell and normal KV? 

> ByteBufferUtils#compareTo is wrong
> --
>
> Key: HBASE-17859
> URL: https://issues.apache.org/jira/browse/HBASE-17859
> Project: HBase
>  Issue Type: Bug
>Reporter: Chia-Ping Tsai
>Assignee: Chia-Ping Tsai
> Fix For: 2.0.0
>
> Attachments: HBASE-17859.v0.patch
>
>
> buf2.get( i ) & 0xFF; -> buf2.get(j) & 0xFF;
> {noformat}
>   public static int compareTo(byte [] buf1, int o1, int l1, ByteBuffer buf2, 
> int o2, int l2) {
>// 
> int end1 = o1 + l1;
> int end2 = o2 + l2;
> for (int i = o1, j = o2; i < end1 && j < end2; i++, j++) {
>   int a = buf1[i] & 0xFF;
>   int b = buf2.get(i) & 0xFF;
>   if (a != b) {
> return a - b;
>   }
> }
> return l1 - l2;
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (HBASE-17859) ByteBufferUtils#compareTo is wrong

2017-03-31 Thread Ted Yu (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15950649#comment-15950649
 ] 

Ted Yu commented on HBASE-17859:


Good find.

Add a unit test to prevent regression ?

> ByteBufferUtils#compareTo is wrong
> --
>
> Key: HBASE-17859
> URL: https://issues.apache.org/jira/browse/HBASE-17859
> Project: HBase
>  Issue Type: Bug
>Reporter: Chia-Ping Tsai
>Assignee: Chia-Ping Tsai
> Fix For: 2.0.0
>
> Attachments: HBASE-17859.v0.patch
>
>
> buf2.get( i ) & 0xFF; -> buf2.get(j) & 0xFF;
> {noformat}
>   public static int compareTo(byte [] buf1, int o1, int l1, ByteBuffer buf2, 
> int o2, int l2) {
>// 
> int end1 = o1 + l1;
> int end2 = o2 + l2;
> for (int i = o1, j = o2; i < end1 && j < end2; i++, j++) {
>   int a = buf1[i] & 0xFF;
>   int b = buf2.get(i) & 0xFF;
>   if (a != b) {
> return a - b;
>   }
> }
> return l1 - l2;
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)