accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1398286 - /accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
Date Mon, 15 Oct 2012 13:39:18 GMT
Author: ecn
Date: Mon Oct 15 13:39:17 2012
New Revision: 1398286

URL: http://svn.apache.org/viewvc?rev=1398286&view=rev
Log:
ACCUMULO-812 add a utility to find unhosted tablets

Added:
    accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
  (with props)

Added: accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java?rev=1398286&view=auto
==============================================================================
--- accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
(added)
+++ accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
Mon Oct 15 13:39:17 2012
@@ -0,0 +1,51 @@
+package org.apache.accumulo.server.util;
+
+import java.util.Set;
+
+import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.master.state.tables.TableState;
+import org.apache.accumulo.server.master.LiveTServerSet;
+import org.apache.accumulo.server.master.LiveTServerSet.Listener;
+import org.apache.accumulo.server.master.state.MetaDataTableScanner;
+import org.apache.accumulo.server.master.state.TServerInstance;
+import org.apache.accumulo.server.master.state.TabletLocationState;
+import org.apache.accumulo.server.master.state.TabletState;
+import org.apache.accumulo.server.master.state.tables.TableManager;
+import org.apache.accumulo.server.security.SecurityConstants;
+import org.apache.log4j.Logger;
+
+public class FindOfflineTablets {
+  private static final Logger log = Logger.getLogger(FindOfflineTablets.class);
+  
+  /**
+   * @param args
+   */
+  public static void main(String[] args) throws Exception {
+    if (args.length != 4) {
+      System.err.println("Usage: accumulo.server.util.FindOfflineTablets instance zookeepers");
+      System.exit(1);
+    }
+    String instance = args[0];
+    String keepers = args[1];
+    Instance zooInst = new ZooKeeperInstance(instance, keepers);
+    MetaDataTableScanner scanner = new MetaDataTableScanner(zooInst, SecurityConstants.getSystemCredentials(),
new Range());
+    LiveTServerSet tservers = new LiveTServerSet(zooInst, new Listener() {
+      @Override
+      public void update(LiveTServerSet current, Set<TServerInstance> deleted, Set<TServerInstance>
added) {
+        if (!deleted.isEmpty())
+          log.warn("Tablet servers deleted while scanning: " + deleted);
+        if (!added.isEmpty())
+          log.warn("Tablet servers added while scanning: " + added);
+      }
+    });
+    while (scanner.hasNext()) {
+      TabletLocationState locationState = scanner.next();
+      TabletState state = locationState.getState(tservers.getCurrentServers());
+      if (state != TabletState.HOSTED && TableManager.getInstance().getTableState(locationState.extent.getTableId().toString())
!= TableState.OFFLINE)
+        System.out.println(locationState + " is " + state);
+    }
+  }
+  
+}

Propchange: accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message