You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Liu Jia (JIRA)" <ji...@apache.org> on 2011/08/09 04:54:27 UTC

[jira] [Updated] (HBASE-4181) HConnectionManager can't find cached HRegionInterface makes client very slow

     [ https://issues.apache.org/jira/browse/HBASE-4181?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Liu Jia updated HBASE-4181:
---------------------------

    Description: 
HRegionInterface getHRegionConnection(final String hostname,
        final int port, final InetSocketAddress isa, final boolean master)
        throws IOException 


/////////////////////////
	String rsName = isa != null ? isa.toString() : Addressing
          .createHostAndPortStr(hostname, port); 

                
////here,if isa is null, the Addressing created a address like "node41:60010"
                                                                 ////should use "isa.toString():new InetSocketAddress(hostname, port).toString();" 
                                                                 ////instead of "Addressing.createHostAndPortStr(hostname, port);"


 	server = this.servers.get(rsName);                                      
      if (server == null) {
        // create a unique lock for this RS (if necessary)
        this.connectionLock.putIfAbsent(rsName, rsName);
        // get the RS lock
        synchronized (this.connectionLock.get(rsName)) {
          // do one more lookup in case we were stalled above
          server = this.servers.get(rsName);
          if (server == null) {
            try {
              if (clusterId.hasId()) {
                conf.set(HConstants.CLUSTER_ID, clusterId.getId());
              }
              // Only create isa when we need to.
              InetSocketAddress address = isa != null ? isa
                  : new InetSocketAddress(hostname, port);
              // definitely a cache miss. establish an RPC for this RS
              server = (HRegionInterface) HBaseRPC.waitForProxy(
                  serverInterfaceClass, HRegionInterface.VERSION, address,
                  this.conf, this.maxRPCAttempts, this.rpcTimeout,
                  this.rpcTimeout);
              this.servers.put(address.toString(), server);    

          
////but here address.toString() send an address like "node41/10.61.2l.171:60010
////so this method can never get cached address and make client request very slow due to it's synchronized.
	

                  
            } catch (RemoteException e) {
              LOG.warn("RemoteException connecting to RS", e);
              // Throw what the RemoteException was carrying.
              throw RemoteExceptionHandler.decodeRemoteException(e);
            }
          }
        }
///////////////////////

  was:
HRegionInterface getHRegionConnection(final String hostname,
        final int port, final InetSocketAddress isa, final boolean master)
        throws IOException 


/////////////////////////
	String rsName = isa != null ? isa.toString() : Addressing
          .createHostAndPortStr(hostname, port);                          ////here,if isa is null, the Addressing created a address like "node41:60010"
									  ////isa.toString():new InetSocketAddress(hostname, port).toString(); 
            								  ////instead of Addressing.createHostAndPortStr(hostname, port);
 	server = this.servers.get(rsName);                                      
      if (server == null) {
        // create a unique lock for this RS (if necessary)
        this.connectionLock.putIfAbsent(rsName, rsName);
        // get the RS lock
        synchronized (this.connectionLock.get(rsName)) {
          // do one more lookup in case we were stalled above
          server = this.servers.get(rsName);
          if (server == null) {
            try {
              if (clusterId.hasId()) {
                conf.set(HConstants.CLUSTER_ID, clusterId.getId());
              }
              // Only create isa when we need to.
              InetSocketAddress address = isa != null ? isa
                  : new InetSocketAddress(hostname, port);
              // definitely a cache miss. establish an RPC for this RS
              server = (HRegionInterface) HBaseRPC.waitForProxy(
                  serverInterfaceClass, HRegionInterface.VERSION, address,
                  this.conf, this.maxRPCAttempts, this.rpcTimeout,
                  this.rpcTimeout);
              this.servers.put(address.toString(), server);              ////but here address.toString() send an address like "node41/10.61.2l.171:60010"
									 ////so this method can never get cached address and make client request very slow 									////due to it's synchronized.
	
                  
            } catch (RemoteException e) {
              LOG.warn("RemoteException connecting to RS", e);
              // Throw what the RemoteException was carrying.
              throw RemoteExceptionHandler.decodeRemoteException(e);
            }
          }
        }
///////////////////////


> HConnectionManager can't find cached HRegionInterface makes client very slow
> ----------------------------------------------------------------------------
>
>                 Key: HBASE-4181
>                 URL: https://issues.apache.org/jira/browse/HBASE-4181
>             Project: HBase
>          Issue Type: Bug
>          Components: client
>    Affects Versions: 0.90.4, 0.92.0
>            Reporter: Liu Jia
>            Priority: Critical
>              Labels: HConnectionManager
>
> HRegionInterface getHRegionConnection(final String hostname,
>         final int port, final InetSocketAddress isa, final boolean master)
>         throws IOException 
> /////////////////////////
> 	String rsName = isa != null ? isa.toString() : Addressing
>           .createHostAndPortStr(hostname, port); 
>                 
> ////here,if isa is null, the Addressing created a address like "node41:60010"
>                                                                  ////should use "isa.toString():new InetSocketAddress(hostname, port).toString();" 
>                                                                  ////instead of "Addressing.createHostAndPortStr(hostname, port);"
>  	server = this.servers.get(rsName);                                      
>       if (server == null) {
>         // create a unique lock for this RS (if necessary)
>         this.connectionLock.putIfAbsent(rsName, rsName);
>         // get the RS lock
>         synchronized (this.connectionLock.get(rsName)) {
>           // do one more lookup in case we were stalled above
>           server = this.servers.get(rsName);
>           if (server == null) {
>             try {
>               if (clusterId.hasId()) {
>                 conf.set(HConstants.CLUSTER_ID, clusterId.getId());
>               }
>               // Only create isa when we need to.
>               InetSocketAddress address = isa != null ? isa
>                   : new InetSocketAddress(hostname, port);
>               // definitely a cache miss. establish an RPC for this RS
>               server = (HRegionInterface) HBaseRPC.waitForProxy(
>                   serverInterfaceClass, HRegionInterface.VERSION, address,
>                   this.conf, this.maxRPCAttempts, this.rpcTimeout,
>                   this.rpcTimeout);
>               this.servers.put(address.toString(), server);    
>           
> ////but here address.toString() send an address like "node41/10.61.2l.171:60010
> ////so this method can never get cached address and make client request very slow due to it's synchronized.
> 	
>                   
>             } catch (RemoteException e) {
>               LOG.warn("RemoteException connecting to RS", e);
>               // Throw what the RemoteException was carrying.
>               throw RemoteExceptionHandler.decodeRemoteException(e);
>             }
>           }
>         }
> ///////////////////////

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira