[jira] [Commented] (HBASE-16880) Correct the javadoc/behaviour of the APIs in ByteBufferUtils

2016-10-25 Thread Hudson (JIRA)

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

Hudson commented on HBASE-16880:


SUCCESS: Integrated in Jenkins build HBase-Trunk_matrix #1850 (See 
[https://builds.apache.org/job/HBase-Trunk_matrix/1850/])
HBASE-16880 Correct the javadoc/behaviour of the APIs in ByteBufferUtils 
(ramkrishna: rev 9875c699afb552d8190df81750e4496677925417)
* (edit) 
hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java
* (edit) 
hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestByteBufferUtils.java


> Correct the javadoc/behaviour of the APIs in ByteBufferUtils
> 
>
> Key: HBASE-16880
> URL: https://issues.apache.org/jira/browse/HBASE-16880
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 2.0.0
>Reporter: ramkrishna.s.vasudevan
>Assignee: ramkrishna.s.vasudevan
> Fix For: 2.0.0
>
> Attachments: HBASE-16880.patch
>
>
> There are some issues either with the javadoc or the actual behaviour of some 
> APIs in BBUtils.
> For eg,
> BBUtil#copyFromBufferToBuffer() says
> {code}
>   /**
>* Copy one buffer's whole data to another. Write starts at the current 
> position of 'out' buffer.
>* Note : This will advance the position marker of {@code out} but not 
> change the position maker
>* for {@code in}. The position and limit of the {@code in} buffer to be 
> set properly by caller.
>* @param in source buffer
>* @param out destination buffer
> {code}
> But this is true in case of UNSAFE.
> {code}
> if (UNSAFE_AVAIL) {
>   int length = in.remaining();
>   UnsafeAccess.copy(in, in.position(), out, out.position(), length);
>   out.position(out.position() + length);
> } else {
>   out.put(in);
> }
> {code}
> But in other case where we move the else - the 'in' is also advanced. So we 
> need to either correct the behaviour or change the doc and see all the used 
> places. This JIRA can be used to correct all the APIs in this util class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HBASE-16880) Correct the javadoc/behaviour of the APIs in ByteBufferUtils

2016-10-24 Thread Anoop Sam John (JIRA)

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

Anoop Sam John commented on HBASE-16880:


+1

> Correct the javadoc/behaviour of the APIs in ByteBufferUtils
> 
>
> Key: HBASE-16880
> URL: https://issues.apache.org/jira/browse/HBASE-16880
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 2.0.0
>Reporter: ramkrishna.s.vasudevan
>Assignee: ramkrishna.s.vasudevan
> Fix For: 2.0.0
>
> Attachments: HBASE-16880.patch
>
>
> There are some issues either with the javadoc or the actual behaviour of some 
> APIs in BBUtils.
> For eg,
> BBUtil#copyFromBufferToBuffer() says
> {code}
>   /**
>* Copy one buffer's whole data to another. Write starts at the current 
> position of 'out' buffer.
>* Note : This will advance the position marker of {@code out} but not 
> change the position maker
>* for {@code in}. The position and limit of the {@code in} buffer to be 
> set properly by caller.
>* @param in source buffer
>* @param out destination buffer
> {code}
> But this is true in case of UNSAFE.
> {code}
> if (UNSAFE_AVAIL) {
>   int length = in.remaining();
>   UnsafeAccess.copy(in, in.position(), out, out.position(), length);
>   out.position(out.position() + length);
> } else {
>   out.put(in);
> }
> {code}
> But in other case where we move the else - the 'in' is also advanced. So we 
> need to either correct the behaviour or change the doc and see all the used 
> places. This JIRA can be used to correct all the APIs in this util class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HBASE-16880) Correct the javadoc/behaviour of the APIs in ByteBufferUtils

2016-10-24 Thread ramkrishna.s.vasudevan (JIRA)

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

ramkrishna.s.vasudevan commented on HBASE-16880:


Can this be committed? Ping [~anoop.hbase]

> Correct the javadoc/behaviour of the APIs in ByteBufferUtils
> 
>
> Key: HBASE-16880
> URL: https://issues.apache.org/jira/browse/HBASE-16880
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 2.0.0
>Reporter: ramkrishna.s.vasudevan
>Assignee: ramkrishna.s.vasudevan
> Fix For: 2.0.0
>
> Attachments: HBASE-16880.patch
>
>
> There are some issues either with the javadoc or the actual behaviour of some 
> APIs in BBUtils.
> For eg,
> BBUtil#copyFromBufferToBuffer() says
> {code}
>   /**
>* Copy one buffer's whole data to another. Write starts at the current 
> position of 'out' buffer.
>* Note : This will advance the position marker of {@code out} but not 
> change the position maker
>* for {@code in}. The position and limit of the {@code in} buffer to be 
> set properly by caller.
>* @param in source buffer
>* @param out destination buffer
> {code}
> But this is true in case of UNSAFE.
> {code}
> if (UNSAFE_AVAIL) {
>   int length = in.remaining();
>   UnsafeAccess.copy(in, in.position(), out, out.position(), length);
>   out.position(out.position() + length);
> } else {
>   out.put(in);
> }
> {code}
> But in other case where we move the else - the 'in' is also advanced. So we 
> need to either correct the behaviour or change the doc and see all the used 
> places. This JIRA can be used to correct all the APIs in this util class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HBASE-16880) Correct the javadoc/behaviour of the APIs in ByteBufferUtils

2016-10-24 Thread ramkrishna.s.vasudevan (JIRA)

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

ramkrishna.s.vasudevan commented on HBASE-16880:


{code}
if (in.hasArray() && out.hasArray()) {
  System.arraycopy(in.array(), sourceOffset + in.arrayOffset(), 
out.array(), out.arrayOffset()
  + destinationOffset, length);
{code}
In every other API we are doing this.  So I do think this makes sense to add 
here. The code is still doing what the JIRA says only. Not sure if we need a 
new JIRA to fix the hasArray case in case some where else we try to use that 
utility in our code base.

> Correct the javadoc/behaviour of the APIs in ByteBufferUtils
> 
>
> Key: HBASE-16880
> URL: https://issues.apache.org/jira/browse/HBASE-16880
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 2.0.0
>Reporter: ramkrishna.s.vasudevan
>Assignee: ramkrishna.s.vasudevan
> Fix For: 2.0.0
>
> Attachments: HBASE-16880.patch
>
>
> There are some issues either with the javadoc or the actual behaviour of some 
> APIs in BBUtils.
> For eg,
> BBUtil#copyFromBufferToBuffer() says
> {code}
>   /**
>* Copy one buffer's whole data to another. Write starts at the current 
> position of 'out' buffer.
>* Note : This will advance the position marker of {@code out} but not 
> change the position maker
>* for {@code in}. The position and limit of the {@code in} buffer to be 
> set properly by caller.
>* @param in source buffer
>* @param out destination buffer
> {code}
> But this is true in case of UNSAFE.
> {code}
> if (UNSAFE_AVAIL) {
>   int length = in.remaining();
>   UnsafeAccess.copy(in, in.position(), out, out.position(), length);
>   out.position(out.position() + length);
> } else {
>   out.put(in);
> }
> {code}
> But in other case where we move the else - the 'in' is also advanced. So we 
> need to either correct the behaviour or change the doc and see all the used 
> places. This JIRA can be used to correct all the APIs in this util class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HBASE-16880) Correct the javadoc/behaviour of the APIs in ByteBufferUtils

2016-10-24 Thread Anoop Sam John (JIRA)

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

Anoop Sam John commented on HBASE-16880:


bq. if (in.hasArray() && out.hasArray())
U want to really add this here?  May be not needed. How that makes a diff?  In 
our code flow, some where we use with both as HBBs?  Better do what the jira 
subject says alone.

> Correct the javadoc/behaviour of the APIs in ByteBufferUtils
> 
>
> Key: HBASE-16880
> URL: https://issues.apache.org/jira/browse/HBASE-16880
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 2.0.0
>Reporter: ramkrishna.s.vasudevan
>Assignee: ramkrishna.s.vasudevan
> Fix For: 2.0.0
>
> Attachments: HBASE-16880.patch
>
>
> There are some issues either with the javadoc or the actual behaviour of some 
> APIs in BBUtils.
> For eg,
> BBUtil#copyFromBufferToBuffer() says
> {code}
>   /**
>* Copy one buffer's whole data to another. Write starts at the current 
> position of 'out' buffer.
>* Note : This will advance the position marker of {@code out} but not 
> change the position maker
>* for {@code in}. The position and limit of the {@code in} buffer to be 
> set properly by caller.
>* @param in source buffer
>* @param out destination buffer
> {code}
> But this is true in case of UNSAFE.
> {code}
> if (UNSAFE_AVAIL) {
>   int length = in.remaining();
>   UnsafeAccess.copy(in, in.position(), out, out.position(), length);
>   out.position(out.position() + length);
> } else {
>   out.put(in);
> }
> {code}
> But in other case where we move the else - the 'in' is also advanced. So we 
> need to either correct the behaviour or change the doc and see all the used 
> places. This JIRA can be used to correct all the APIs in this util class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (HBASE-16880) Correct the javadoc/behaviour of the APIs in ByteBufferUtils

2016-10-19 Thread Anoop Sam John (JIRA)

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

Anoop Sam John commented on HBASE-16880:


Am +1 to change the code so as to make it behave like ByteBuffer put API. ie 
advance pos in the 'in' buf also and correct the javadoc.

> Correct the javadoc/behaviour of the APIs in ByteBufferUtils
> 
>
> Key: HBASE-16880
> URL: https://issues.apache.org/jira/browse/HBASE-16880
> Project: HBase
>  Issue Type: Bug
>Reporter: ramkrishna.s.vasudevan
>Assignee: ramkrishna.s.vasudevan
>
> There are some issues either with the javadoc or the actual behaviour of some 
> APIs in BBUtils.
> For eg,
> BBUtil#copyFromBufferToBuffer() says
> {code}
>   /**
>* Copy one buffer's whole data to another. Write starts at the current 
> position of 'out' buffer.
>* Note : This will advance the position marker of {@code out} but not 
> change the position maker
>* for {@code in}. The position and limit of the {@code in} buffer to be 
> set properly by caller.
>* @param in source buffer
>* @param out destination buffer
> {code}
> But this is true in case of UNSAFE.
> {code}
> if (UNSAFE_AVAIL) {
>   int length = in.remaining();
>   UnsafeAccess.copy(in, in.position(), out, out.position(), length);
>   out.position(out.position() + length);
> } else {
>   out.put(in);
> }
> {code}
> But in other case where we move the else - the 'in' is also advanced. So we 
> need to either correct the behaviour or change the doc and see all the used 
> places. This JIRA can be used to correct all the APIs in this util class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)