You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2013/03/21 16:59:47 UTC
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...
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