You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "qiujaiwei (JIRA)" <ji...@apache.org> on 2012/06/27 10:24:42 UTC

[jira] [Created] (HBASE-6280) why using treeMap at default implement with class Batch.Callback

qiujaiwei created HBASE-6280:
--------------------------------

             Summary: why using treeMap at default implement with class  Batch.Callback
                 Key: HBASE-6280
                 URL: https://issues.apache.org/jira/browse/HBASE-6280
             Project: HBase
          Issue Type: Bug
          Components: coprocessors
    Affects Versions: 0.92.0
         Environment: centos 6.2 hbase 0.92.0
            Reporter: qiujaiwei


public <T extends CoprocessorProtocol, R> Map<byte[],R> coprocessorExec(
      Class<T> protocol, byte[] startKey, byte[] endKey,
      Batch.Call<T,R> callable)
      throws IOException, Throwable {

    final Map<byte[],R> results = new TreeMap<byte[],R>(
        Bytes.BYTES_COMPARATOR);
    coprocessorExec(protocol, startKey, endKey, callable,
        new Batch.Callback<R>(){
      public void update(byte[] region, byte[] row, R value) {
        results.put(region, value);
      }
    });
    return results;
  }





when mulit region  call the Batch.Callback ,the treemap should lockup.
we meet this situation after we run 3 month.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-6280) why using treeMap at default implement with class Batch.Callback

Posted by "Jieshan Bean (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-6280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13402074#comment-13402074 ] 

Jieshan Bean commented on HBASE-6280:
-------------------------------------

Good finding, qiujaiwei. It seems a concurrency issue. We can see from the method of HConnectionManager#processExecs:
{noformat}
Future<R> future = pool.submit(
 new Callable<R>() {
  public R call() throws Exception {
	T instance = (T)Proxy.newProxyInstance(conf.getClassLoader(),
		new Class[]{protocol},
		invoker);
	R result = callable.call(instance);
	byte[] region = invoker.getRegionName();
	if (callback != null) {
	  callback.update(region, r, result);
	}
	return result;
  }
});
{noformat}

I think we should use a concurrent map instead of using TreeMap.

                
> why using treeMap at default implement with class  Batch.Callback
> -----------------------------------------------------------------
>
>                 Key: HBASE-6280
>                 URL: https://issues.apache.org/jira/browse/HBASE-6280
>             Project: HBase
>          Issue Type: Bug
>          Components: coprocessors
>    Affects Versions: 0.92.0
>         Environment: centos 6.2 hbase 0.92.0
>            Reporter: qiujaiwei
>
> public <T extends CoprocessorProtocol, R> Map<byte[],R> coprocessorExec(
>       Class<T> protocol, byte[] startKey, byte[] endKey,
>       Batch.Call<T,R> callable)
>       throws IOException, Throwable {
>     final Map<byte[],R> results = new TreeMap<byte[],R>(
>         Bytes.BYTES_COMPARATOR);
>     coprocessorExec(protocol, startKey, endKey, callable,
>         new Batch.Callback<R>(){
>       public void update(byte[] region, byte[] row, R value) {
>         results.put(region, value);
>       }
>     });
>     return results;
>   }
> when mulit region  call the Batch.Callback ,the treemap should lockup.
> we meet this situation after we run 3 month.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira