You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Chia-Ping Tsai (JIRA)" <ji...@apache.org> on 2017/04/04 10:35:41 UTC
[jira] [Comment Edited] (HBASE-17872) Make ByteBufferUtils
thread-safe
[ https://issues.apache.org/jira/browse/HBASE-17872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15954964#comment-15954964 ]
Chia-Ping Tsai edited comment on HBASE-17872 at 4/4/17 10:35 AM:
-----------------------------------------------------------------
It is just code reading...I will make some tests late.
was (Author: chia7712):
It is just code reading...I will make some tests lately.
> Make ByteBufferUtils thread-safe
> --------------------------------
>
> Key: HBASE-17872
> URL: https://issues.apache.org/jira/browse/HBASE-17872
> Project: HBase
> Issue Type: Bug
> Reporter: Chia-Ping Tsai
> Assignee: Chia-Ping Tsai
> Priority: Critical
>
> A case is shown below.
> We will get the wrong position of buffer in multithreaded environment, so the method makes the invalid cell in MSLAB.
> {noformat}
> public static int copyFromBufferToBuffer(ByteBuffer in, ByteBuffer out, int sourceOffset,
> int destinationOffset, int length) {
> if (in.hasArray() && out.hasArray()) {
> // ...
> } else if (UNSAFE_AVAIL) {
> // ...
> } else {
> int outOldPos = out.position();
> out.position(destinationOffset);
> ByteBuffer inDup = in.duplicate();
> inDup.position(sourceOffset).limit(sourceOffset + length);
> out.put(inDup);
> out.position(outOldPos);
> }
> return destinationOffset + length;
> }
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)