Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6C48DF66E for ; Thu, 21 Mar 2013 16:00:25 +0000 (UTC) Received: (qmail 2448 invoked by uid 500); 21 Mar 2013 16:00:25 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 2420 invoked by uid 500); 21 Mar 2013 16:00:25 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 2413 invoked by uid 99); 21 Mar 2013 16:00:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Mar 2013 16:00:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Mar 2013 16:00:21 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4B6552388962; Thu, 21 Mar 2013 15:59:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1459375 - in /accumulo/trunk: ./ assemble/ core/ core/src/main/java/org/apache/accumulo/core/client/admin/ core/src/main/java/org/apache/accumulo/core/util/ examples/ fate/src/main/java/org/apache/accumulo/fate/ fate/src/main/java/org/apac... Date: Thu, 21 Mar 2013 15:59:47 -0000 To: commits@accumulo.apache.org From: kturner@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130321155948.4B6552388962@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kturner Date: Thu Mar 21 15:59:47 2013 New Revision: 1459375 URL: http://svn.apache.org/r1459375 Log: ACCUMULO-513 made master always form a new connection when getting tserver status info Modified: accumulo/trunk/ (props changed) accumulo/trunk/assemble/ (props changed) accumulo/trunk/core/ (props changed) accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java accumulo/trunk/examples/ (props changed) accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java (props changed) accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java (props changed) accumulo/trunk/server/ (props changed) accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java accumulo/trunk/src/ (props changed) Propchange: accumulo/trunk/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5:r1459090-1459374 Propchange: accumulo/trunk/assemble/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/assemble:r1459090-1459374 Propchange: accumulo/trunk/core/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/core:r1459090-1459374 Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java?rev=1459375&r1=1459374&r2=1459375&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java Thu Mar 21 15:59:47 2013 @@ -33,8 +33,10 @@ import org.apache.accumulo.core.client.i import org.apache.accumulo.core.client.impl.thrift.ClientService; import org.apache.accumulo.core.client.impl.thrift.ConfigurationType; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; +import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.master.thrift.MasterClientService; import org.apache.accumulo.core.security.thrift.TCredentials; +import org.apache.accumulo.core.tabletserver.thrift.TabletClientService; import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client; import org.apache.accumulo.core.util.ArgumentChecker; import org.apache.accumulo.core.util.ThriftUtil; @@ -42,6 +44,7 @@ import org.apache.accumulo.core.zookeepe import org.apache.accumulo.fate.zookeeper.ZooCache; import org.apache.accumulo.trace.instrument.Tracer; import org.apache.thrift.TException; +import org.apache.thrift.transport.TTransport; import org.apache.thrift.transport.TTransportException; /** @@ -219,9 +222,10 @@ public class InstanceOperationsImpl impl */ @Override public void ping(String tserver) throws AccumuloException { - Client client = null; + TTransport transport = null; try { - client = ThriftUtil.getTServerClient(tserver, instance.getConfiguration()); + transport = ThriftUtil.createTransport(tserver, instance.getConfiguration().getPort(Property.TSERV_CLIENTPORT), instance.getConfiguration()); + TabletClientService.Client client = ThriftUtil.createClient(new TabletClientService.Client.Factory(), transport); client.getTabletServerStatus(Tracer.traceInfo(), credentials); } catch (TTransportException e) { throw new AccumuloException(e); @@ -230,8 +234,8 @@ public class InstanceOperationsImpl impl } catch (TException e) { throw new AccumuloException(e); } finally { - if (client != null) { - ThriftUtil.returnClient(client); + if (transport != null) { + transport.close(); } } } Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java?rev=1459375&r1=1459374&r2=1459375&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java Thu Mar 21 15:59:47 2013 @@ -16,6 +16,7 @@ */ package org.apache.accumulo.core.util; +import java.io.IOException; import java.net.InetSocketAddress; import java.util.HashMap; import java.util.Map; @@ -164,6 +165,37 @@ public class ThriftUtil { } } + /** + * create a transport that is not pooled + */ + public static TTransport createTransport(String address, int port, AccumuloConfiguration conf) throws TException { + TTransport transport = null; + + try { + transport = TTimeoutTransport.create(org.apache.accumulo.core.util.AddressUtil.parseAddress(address, port), + conf.getTimeInMillis(Property.GENERAL_RPC_TIMEOUT)); + transport = ThriftUtil.transportFactory().getTransport(transport); + transport.open(); + TTransport tmp = transport; + transport = null; + return tmp; + } catch (IOException ex) { + throw new TTransportException(ex); + } finally { + if (transport != null) + transport.close(); + } + + + } + + /** + * create a transport that is not pooled + */ + public static TTransport createTransport(InetSocketAddress address, AccumuloConfiguration conf) throws TException { + return createTransport(address.getAddress().getHostAddress(), address.getPort(), conf); + } + public static TTransportFactory transportFactory() { return transportFactory; } Propchange: accumulo/trunk/examples/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/examples:r1459090-1459374 Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1459090-1459374 Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1459090-1459374 Propchange: accumulo/trunk/server/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/server:r1459090-1459374 Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java?rev=1459375&r1=1459374&r2=1459375&view=diff ============================================================================== --- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java (original) +++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java Thu Mar 21 15:59:47 2013 @@ -49,6 +49,7 @@ import org.apache.accumulo.trace.instrum import org.apache.hadoop.io.Text; import org.apache.log4j.Logger; import org.apache.thrift.TException; +import org.apache.thrift.transport.TTransport; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.KeeperException.NoNodeException; import org.apache.zookeeper.KeeperException.NotEmptyException; @@ -98,12 +99,19 @@ public class LiveTServerSet implements W } } - public TabletServerStatus getTableMap() throws TException, ThriftSecurityException { - TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf); + public TabletServerStatus getTableMap(boolean usePooledConnection) throws TException, ThriftSecurityException { + + if (usePooledConnection == true) + throw new UnsupportedOperationException(); + + TTransport transport = ThriftUtil.createTransport(address, conf); + try { + TabletClientService.Client client = ThriftUtil.createClient(new TabletClientService.Client.Factory(), transport); return client.getTabletServerStatus(Tracer.traceInfo(), SecurityConstants.getSystemCredentials()); } finally { - ThriftUtil.returnClient(client); + if (transport != null) + transport.close(); } } Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1459375&r1=1459374&r2=1459375&view=diff ============================================================================== --- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java (original) +++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java Thu Mar 21 15:59:47 2013 @@ -2005,7 +2005,7 @@ public class Master implements LiveTServ TServerConnection connection = tserverSet.getConnection(server); if (connection == null) throw new IOException("No connection to " + server); - TabletServerStatus status = connection.getTableMap(); + TabletServerStatus status = connection.getTableMap(false); result.put(server, status); } finally { t.setName(oldName); Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java?rev=1459375&r1=1459374&r2=1459375&view=diff ============================================================================== --- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java (original) +++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java Thu Mar 21 15:59:47 2013 @@ -70,7 +70,7 @@ public class ShutdownTServer extends Mas TServerConnection connection = master.getConnection(server); if (connection != null) { try { - TabletServerStatus status = connection.getTableMap(); + TabletServerStatus status = connection.getTableMap(false); if (status.tableMap != null && status.tableMap.isEmpty()) { log.info("tablet server hosts no tablets " + server); connection.halt(master.getMasterLock()); Propchange: accumulo/trunk/src/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/src:r1459090-1459374