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

stack commented on HBASE-12431:
-------------------------------

Here is the commit that added it:

{code}
HBASE-5625 Avoid byte buffer allocations when reading a value from a …
…Result object (Tudor Scurtu)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1333159 
13f79535-47bb-0310-9956-ffa450edef68
 master   hbase-0.96.1RC1 
…
 0.94.0mvnrelease
commit d032ea818beb7578e75e7c286cc58d6e8aad3449 1 parent 00cfc8f
 Zhihong Yu authored on May 2, 2012
{code}

Should have doc on what its about. Thread-local sounds like way to go since 
purging it looks like it'd be a perf regression.

> Use of getColumnLatestCell(byte[], int, int, byte[], int, int) is Not Thread 
> Safe
> ---------------------------------------------------------------------------------
>
>                 Key: HBASE-12431
>                 URL: https://issues.apache.org/jira/browse/HBASE-12431
>             Project: HBase
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: 0.98.1
>            Reporter: Jonathan Jarvis
>
> Result declares that it is NOT THREAD SAFE at the top of the source code, but 
> one would assume that refers to many different threads accessing the same 
> Result object. I've run into an issue when I have several different threads 
> accessing their own Result object that runs into an issue because of use of 
> common static member variable.
> I noticed the problem when I switched from:
> getColumnLatestCell(byte[], byte[]) to
> getColumnLatestCell(byte[], int, int, byte[], int, int)
> These methods call different binarySearch methods, the latter invoking:
> protected int  binarySearch(final Cell [] kvs,
> 309      final byte [] family, final int foffset, final int flength,
> 310      final byte [] qualifier, final int qoffset, final int qlength) {
> This method utilizes a private static member variable called "buffer"
> If more than one thread is utilizing "buffer" you'll see unpredictable 
> behavior unless you synchronize(Result.class) {}.
> If buffer is to remain a static variable, I would recommend changing it to a 
> ThreadLocal<byte[]> instead.



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

Reply via email to