accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject git commit: ACCUMULO-1980 admin stop HOST now defaults to port.
Date Mon, 16 Dec 2013 22:10:54 GMT
Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 0e3fd3b3c -> 39b22d3eb


ACCUMULO-1980 admin stop HOST now defaults to port.

AddressUtil now supports a default port in general.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/39b22d3e
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/39b22d3e
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/39b22d3e

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 39b22d3eb5fb478376ebbf80a7d388baf5fd0338
Parents: 0e3fd3b
Author: John Vines <vines@apache.org>
Authored: Mon Dec 16 17:10:07 2013 -0500
Committer: John Vines <vines@apache.org>
Committed: Mon Dec 16 17:10:07 2013 -0500

----------------------------------------------------------------------
 .../core/client/admin/InstanceOperationsImpl.java         |  2 +-
 .../java/org/apache/accumulo/core/util/AddressUtil.java   | 10 +++++++++-
 .../org/apache/accumulo/core/util/ServerServices.java     |  2 +-
 .../org/apache/accumulo/server/master/LiveTServerSet.java |  2 +-
 .../accumulo/server/master/state/TServerInstance.java     |  4 ++--
 .../server/master/state/TabletStateChangeIterator.java    |  2 +-
 .../main/java/org/apache/accumulo/server/util/Admin.java  |  3 ++-
 .../apache/accumulo/gc/GarbageCollectWriteAheadLogs.java  |  2 +-
 .../apache/accumulo/monitor/servlets/MasterServlet.java   |  6 +++---
 .../test/randomwalk/concurrent/StopTabletServer.java      |  2 +-
 10 files changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/39b22d3e/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
index 85bc1a3..a16782f 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
@@ -193,7 +193,7 @@ public class InstanceOperationsImpl implements InstanceOperations {
   public void ping(String tserver) throws AccumuloException {
     TTransport transport = null;
     try {
-      transport = ThriftUtil.createTransport(AddressUtil.parseAddress(tserver), ServerConfigurationUtil.getConfiguration(instance));
+      transport = ThriftUtil.createTransport(AddressUtil.parseAddress(tserver, false), ServerConfigurationUtil.getConfiguration(instance));
       TabletClientService.Client client = ThriftUtil.createClient(new TabletClientService.Client.Factory(),
transport);
       client.getTabletServerStatus(Tracer.traceInfo(), credentials.toThrift(instance));
     } catch (TTransportException e) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/39b22d3e/core/src/main/java/org/apache/accumulo/core/util/AddressUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/AddressUtil.java b/core/src/main/java/org/apache/accumulo/core/util/AddressUtil.java
index e1e1dd4..46510ee 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/AddressUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/AddressUtil.java
@@ -22,11 +22,19 @@ public class AddressUtil {
 
 
   static public HostAndPort parseAddress(String address) throws NumberFormatException {
+    return parseAddress(address, false);
+  }
+
+  static public HostAndPort parseAddress(String address, boolean ignoreMissingPort) throws
NumberFormatException {
     address = address.replace('+', ':');
     HostAndPort hap = HostAndPort.fromString(address);
-    if (!hap.hasPort())
+    if (!ignoreMissingPort && !hap.hasPort())
       throw new IllegalArgumentException("Address was expected to contain port. address="
+ address);
     
     return hap;
   }
+
+  public static HostAndPort parseAddress(String address, int defaultPort) {
+    return parseAddress(address, true).withDefaultPort(defaultPort);
+  }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/39b22d3e/core/src/main/java/org/apache/accumulo/core/util/ServerServices.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/ServerServices.java b/core/src/main/java/org/apache/accumulo/core/util/ServerServices.java
index 2891cdb..88c4ebf 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/ServerServices.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/ServerServices.java
@@ -50,7 +50,7 @@ public class ServerServices implements Comparable<ServerServices>
{
   }
   
   public HostAndPort getAddress(Service service) {
-    return AddressUtil.parseAddress(getAddressString(service));
+    return AddressUtil.parseAddress(getAddressString(service), false);
   }
   
   // DON'T CHANGE THIS; WE'RE USING IT FOR SERIALIZATION!!!

http://git-wip-us.apache.org/repos/asf/accumulo/blob/39b22d3e/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
index 3eef065..6b81539 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
@@ -364,7 +364,7 @@ public class LiveTServerSet implements Watcher {
   }
   
   public synchronized TServerInstance find(String tabletServer) {
-    HostAndPort addr = AddressUtil.parseAddress(tabletServer);
+    HostAndPort addr = AddressUtil.parseAddress(tabletServer, false);
     for (Entry<String,TServerInfo> entry : current.entrySet()) {
       if (entry.getValue().instance.getLocation().equals(addr))
         return entry.getValue().instance;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/39b22d3e/server/base/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
b/server/base/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
index 4de64a8..54d7e71 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
@@ -50,11 +50,11 @@ public class TServerInstance implements Comparable<TServerInstance>,
Serializabl
   }
   
   public TServerInstance(String address, long session) {
-    this(AddressUtil.parseAddress(address), Long.toHexString(session));
+    this(AddressUtil.parseAddress(address, false), Long.toHexString(session));
   }
   
   public TServerInstance(Value address, Text session) {
-    this(AddressUtil.parseAddress(new String(address.get())), session.toString());
+    this(AddressUtil.parseAddress(new String(address.get()), false), session.toString());
   }
   
   public void putLocation(Mutation m) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/39b22d3e/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
b/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
index ddcdeea..d1cdd9d 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
@@ -81,7 +81,7 @@ public class TabletStateChangeIterator extends SkippingIterator {
         String instance = parts[1];
         if (instance != null && instance.endsWith("]"))
           instance = instance.substring(0, instance.length() - 1);
-        result.add(new TServerInstance(AddressUtil.parseAddress(hostport), instance));
+        result.add(new TServerInstance(AddressUtil.parseAddress(hostport, false), instance));
       }
     }
     return result;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/39b22d3e/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
index 2f5576c..698259b 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
@@ -49,6 +49,7 @@ import org.apache.accumulo.core.security.SystemPermission;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.accumulo.core.util.AddressUtil;
 import org.apache.accumulo.server.cli.ClientOpts;
+import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.security.SystemCredentials;
 import org.apache.accumulo.trace.instrument.Tracer;
 import org.apache.hadoop.conf.Configuration;
@@ -299,7 +300,7 @@ public class Admin {
   private static void stopTabletServer(final Instance instance, final Credentials creds,
List<String> servers, final boolean force) throws AccumuloException,
       AccumuloSecurityException {
     for (String server : servers) {
-      HostAndPort address = AddressUtil.parseAddress(server);
+      HostAndPort address = AddressUtil.parseAddress(server, ServerConfiguration.getDefaultConfiguration().getPort(Property.TSERV_CLIENTPORT));
       final String finalServer = address.toString();
       log.info("Stopping server " + finalServer);
       MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/39b22d3e/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java
----------------------------------------------------------------------
diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java
b/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java
index b311b77..c4c69b4 100644
--- a/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java
+++ b/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java
@@ -151,7 +151,7 @@ public class GarbageCollectWriteAheadLogs {
           }
         }
       } else {
-        HostAndPort address = AddressUtil.parseAddress(entry.getKey());
+        HostAndPort address = AddressUtil.parseAddress(entry.getKey(), false);
         if (!holdsLock(address)) {
           for (Path path : entry.getValue()) {
             log.debug("Removing WAL for offline server " + path);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/39b22d3e/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/MasterServlet.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/MasterServlet.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/MasterServlet.java
index 2b675e5..0466405 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/MasterServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/MasterServlet.java
@@ -55,7 +55,7 @@ public class MasterServlet extends BasicServlet {
   @Override
   protected String getTitle(HttpServletRequest req) {
     List<String> masters = Monitor.getInstance().getMasterLocations();
-    return "Master Server" + (masters.size() == 0 ? "" : ":" + AddressUtil.parseAddress(masters.get(0)).getHostText());
+    return "Master Server" + (masters.size() == 0 ? "" : ":" + AddressUtil.parseAddress(masters.get(0),
false).getHostText());
   }
   
   @Override
@@ -149,7 +149,7 @@ public class MasterServlet extends BasicServlet {
       masterStatus.addSortableColumn("OS&nbsp;Load", new NumberType<Double>(0.,
guessHighLoad * 1., 0., guessHighLoad * 3.),
           "The one-minute load average on the computer that runs the monitor web server.");
       TableRow row = masterStatus.prepareRow();
-      row.add(masters.size() == 0 ? "<div class='error'>Down</div>" : AddressUtil.parseAddress(masters.get(0)).getHostText());
+      row.add(masters.size() == 0 ? "<div class='error'>Down</div>" : AddressUtil.parseAddress(masters.get(0),
false).getHostText());
       row.add(Monitor.getMmi().tServerInfo.size());
       row.add(slaves.size());
       row.add("<a href='/gc'>" + gcStatus + "</a>");
@@ -182,7 +182,7 @@ public class MasterServlet extends BasicServlet {
         if (server.logSorts != null) {
           for (RecoveryStatus recovery : server.logSorts) {
             TableRow row = recoveryTable.prepareRow();
-            row.add(AddressUtil.parseAddress(server.name).getHostText());
+            row.add(AddressUtil.parseAddress(server.name, false).getHostText());
             row.add(recovery.name);
             row.add((long) recovery.runtime);
             row.add(recovery.progress);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/39b22d3e/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StopTabletServer.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StopTabletServer.java
b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StopTabletServer.java
index 337d318..9012c10 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StopTabletServer.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StopTabletServer.java
@@ -48,7 +48,7 @@ public class StopTabletServer extends Test {
           Stat stat = new Stat();
           byte[] data = rdr.getData(base + "/" + child + "/" + children.get(0), stat);
           if (!"master".equals(new String(data))) {
-            result.add(new TServerInstance(AddressUtil.parseAddress(child), stat.getEphemeralOwner()));
+            result.add(new TServerInstance(AddressUtil.parseAddress(child, false), stat.getEphemeralOwner()));
           }
         }
       } catch (KeeperException.NoNodeException ex) {


Mime
View raw message