accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1331459 - in /accumulo/trunk: ./ core/ core/src/main/java/org/apache/accumulo/core/client/admin/ core/src/main/java/org/apache/accumulo/core/client/impl/ server/ server/src/main/java/org/apache/accumulo/server/monitor/ server/src/main/java...
Date Fri, 27 Apr 2012 15:05:48 GMT
Author: ecn
Date: Fri Apr 27 15:05:47 2012
New Revision: 1331459

URL: http://svn.apache.org/viewvc?rev=1331459&view=rev
Log:
ACCUMULO-554, ACCUMULO-553 merge to trunk

Modified:
    accumulo/trunk/   (props changed)
    accumulo/trunk/core/   (props changed)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
    accumulo/trunk/server/   (props changed)
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TServersServlet.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/GetMasterStats.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousStatsCollector.java

Propchange: accumulo/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/src:r1331456
  Merged /accumulo/branches/1.4:r1331456

Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/core:r1331456
  Merged /accumulo/branches/1.4/src/core:r1331456

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java?rev=1331459&r1=1331458&r2=1331459&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
Fri Apr 27 15:05:47 2012
@@ -198,7 +198,7 @@ public class TableOperationsImpl extends
     while (true) {
       MasterClientService.Iface client = null;
       try {
-        client = MasterClient.getConnection(instance);
+        client = MasterClient.getConnectionWithRetry(instance);
         return client.beginTableOperation(null, credentials);
       } catch (TTransportException tte) {
         log.debug("Failed to call beginTableOperation(), retrying ... ", tte);
@@ -214,7 +214,7 @@ public class TableOperationsImpl extends
     while (true) {
       MasterClientService.Iface client = null;
       try {
-        client = MasterClient.getConnection(instance);
+        client = MasterClient.getConnectionWithRetry(instance);
         client.executeTableOperation(null, credentials, opid, op, args, opts, autoCleanUp);
         break;
       } catch (TTransportException tte) {
@@ -230,7 +230,7 @@ public class TableOperationsImpl extends
     while (true) {
       MasterClientService.Iface client = null;
       try {
-        client = MasterClient.getConnection(instance);
+        client = MasterClient.getConnectionWithRetry(instance);
         return client.waitForTableOperation(null, credentials, opid);
       } catch (TTransportException tte) {
         log.debug("Failed to call waitForTableOperation(), retrying ... ", tte);
@@ -245,7 +245,7 @@ public class TableOperationsImpl extends
     while (true) {
       MasterClientService.Iface client = null;
       try {
-        client = MasterClient.getConnection(instance);
+        client = MasterClient.getConnectionWithRetry(instance);
         client.finishTableOperation(null, credentials, opid);
         break;
       } catch (TTransportException tte) {
@@ -622,7 +622,7 @@ public class TableOperationsImpl extends
       while (true) {
         MasterClientService.Iface client = null;
         try {
-          client = MasterClient.getConnection(instance);
+          client = MasterClient.getConnectionWithRetry(instance);
           flushID = client.initiateFlush(null, credentials, tableId);
           break;
         } catch (TTransportException tte) {
@@ -636,7 +636,7 @@ public class TableOperationsImpl extends
       while (true) {
         MasterClientService.Iface client = null;
         try {
-          client = MasterClient.getConnection(instance);
+          client = MasterClient.getConnectionWithRetry(instance);
           client.waitForFlush(null, credentials, tableId, TextUtil.getByteBuffer(start),
TextUtil.getByteBuffer(end), flushID, wait ? Long.MAX_VALUE : 1);
           break;
         } catch (TTransportException tte) {
@@ -1051,7 +1051,7 @@ public class TableOperationsImpl extends
     ArgumentChecker.notNull(tableName, aggregators);
     MasterClientService.Iface client = null;
     try {
-      client = MasterClient.getConnection(instance);
+      client = MasterClient.getConnectionWithRetry(instance);
       for (Entry<String,String> entry : IteratorUtil.generateAggTableProperties(aggregators).entrySet())
{
         client.setTableProperty(null, credentials, tableName, entry.getKey(), entry.getValue());
       }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java?rev=1331459&r1=1331458&r2=1331459&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
Fri Apr 27 15:05:47 2012
@@ -34,36 +34,41 @@ import org.apache.thrift.transport.TTran
 public class MasterClient {
   private static final Logger log = Logger.getLogger(MasterClient.class);
   
-  public static MasterClientService.Iface getConnection(Instance instance) throws TTransportException
{
+  public static MasterClientService.Iface getConnectionWithRetry(Instance instance) throws
TTransportException {
     ArgumentChecker.notNull(instance);
     
     while (true) {
       
-      List<String> locations = instance.getMasterLocations();
-      
-      while (locations.size() == 0) {
-        log.debug("No masters, will retry...");
-        UtilWaitThread.sleep(250);
-        locations = instance.getMasterLocations();
-      }
-      
-      String master = locations.get(0);
-      int portHint = instance.getConfiguration().getPort(Property.MASTER_CLIENTPORT);
-      
-      try {
-        // Master requests can take a long time: don't ever time out
-        MasterClientService.Iface client = ThriftUtil.getClient(new MasterClientService.Client.Factory(),
master, Property.MASTER_CLIENTPORT,
-            instance.getConfiguration());
-        return client;
-      } catch (TTransportException tte) {
-        log.debug("Failed to connect to master=" + master + " portHint=" + portHint + ",
will retry... ", tte);
-      }
-      
+      MasterClientService.Iface result = getConnection(instance);
+      if (result != null)
+        return result;
       UtilWaitThread.sleep(250);
     }
     
   }
   
+  public static MasterClientService.Iface getConnection(Instance instance) {
+    List<String> locations = instance.getMasterLocations();
+    
+    if (locations.size() == 0) {
+      log.debug("No masters...");
+      return null;
+    }
+    
+    String master = locations.get(0);
+    int portHint = instance.getConfiguration().getPort(Property.MASTER_CLIENTPORT);
+    
+    try {
+      // Master requests can take a long time: don't ever time out
+      MasterClientService.Iface client = ThriftUtil.getClient(new MasterClientService.Client.Factory(),
master, Property.MASTER_CLIENTPORT,
+          instance.getConfiguration());
+      return client;
+    } catch (TTransportException tte) {
+      log.debug("Failed to connect to master=" + master + " portHint=" + portHint + ", will
retry... ", tte);
+      return null;
+    }
+  }
+  
   public static void close(MasterClientService.Iface iface) {
     TServiceClient client = (TServiceClient) iface;
     if (client != null && client.getInputProtocol() != null && client.getInputProtocol().getTransport()
!= null) {
@@ -77,7 +82,7 @@ public class MasterClient {
     MasterClientService.Iface client = null;
     while (true) {
       try {
-        client = getConnection(instance);
+        client = getConnectionWithRetry(instance);
         return exec.execute(client);
       } catch (TTransportException tte) {
         log.debug("MasterClient request failed, retrying ... ", tte);
@@ -99,7 +104,7 @@ public class MasterClient {
     MasterClientService.Iface client = null;
     while (true) {
       try {
-        client = getConnection(instance);
+        client = getConnectionWithRetry(instance);
         exec.execute(client);
         break;
       } catch (TTransportException tte) {

Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/server:r1331456
  Merged /accumulo/branches/1.4/src/server:r1331456

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java?rev=1331459&r1=1331458&r2=1331459&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java Fri
Apr 27 15:05:47 2012
@@ -287,17 +287,23 @@ public class Monitor {
         MasterClientService.Iface client = null;
         try {
           client = MasterClient.getConnection(HdfsZooInstance.getInstance());
-          mmi = client.getMasterStats(null, SecurityConstants.getSystemCredentials());
+          if (client != null) {
+            mmi = client.getMasterStats(null, SecurityConstants.getSystemCredentials());
+          } else {
+            mmi = null;
+          }
           Monitor.gcStatus = fetchGcStatus();
           retry = false;
         } catch (Exception e) {
           mmi = null;
           log.info("Error fetching stats: " + e);
-          UtilWaitThread.sleep(1000);
         } finally {
-          if (client != null)
+          if (client != null) {
             MasterClient.close(client);
+          }
         }
+        if (mmi == null)
+          UtilWaitThread.sleep(1000);
       }
       
       int majorCompactions = 0;

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TServersServlet.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TServersServlet.java?rev=1331459&r1=1331458&r2=1331459&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TServersServlet.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TServersServlet.java
Fri Apr 27 15:05:47 2012
@@ -314,10 +314,10 @@ public class TServersServlet extends Bas
     for (TabletServerStatus status : tservers) {
       avgLastContact += (now - status.lastContact);
     }
-    
+    final long MINUTES = 3 * 60 * 1000;
     tServerList.addSortableColumn("Server", new TServerLinkType(), null);
     tServerList.addSortableColumn("Hosted&nbsp;Tablets", new NumberType<Integer>(0,
Integer.MAX_VALUE), null);
-    tServerList.addSortableColumn("Last&nbsp;Contact", new DurationType(0l, (long) avgLastContact
* 4), null);
+    tServerList.addSortableColumn("Last&nbsp;Contact", new DurationType(0l, (long) Math.min(avgLastContact
* 4, MINUTES)), null);
     tServerList.addSortableColumn("Entries", new NumberType<Long>(), "The number of
key/value pairs.");
     tServerList.addSortableColumn("Ingest", new NumberType<Long>(), "The number of
key/value pairs inserted. (Note that deletes are also 'inserted')");
     tServerList.addSortableColumn("Query", new NumberType<Long>(), "The number of key/value
pairs returned to clients. (Not the number of scans)");

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/GetMasterStats.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/GetMasterStats.java?rev=1331459&r1=1331458&r2=1331459&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/GetMasterStats.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/GetMasterStats.java
Fri Apr 27 15:05:47 2012
@@ -42,7 +42,7 @@ public class GetMasterStats {
     MasterClientService.Iface client = null;
     MasterMonitorInfo stats = null;
     try {
-      client = MasterClient.getConnection(HdfsZooInstance.getInstance());
+      client = MasterClient.getConnectionWithRetry(HdfsZooInstance.getInstance());
       stats = client.getMasterStats(null, SecurityConstants.getSystemCredentials());
     } finally {
       if (client != null)

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousStatsCollector.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousStatsCollector.java?rev=1331459&r1=1331458&r2=1331459&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousStatsCollector.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousStatsCollector.java
Fri Apr 27 15:05:47 2012
@@ -125,7 +125,7 @@ public class ContinuousStatsCollector {
       
       MasterClientService.Iface client = null;
       try {
-        client = MasterClient.getConnection(HdfsZooInstance.getInstance());
+        client = MasterClient.getConnectionWithRetry(HdfsZooInstance.getInstance());
         MasterMonitorInfo stats = client.getMasterStats(null, SecurityConstants.getSystemCredentials());
         
         TableInfo all = new TableInfo();



Mime
View raw message