incubator-accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1190503 - in /incubator/accumulo/trunk: ./ src/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java
Date Fri, 28 Oct 2011 19:08:29 GMT
Author: ecn
Date: Fri Oct 28 19:08:29 2011
New Revision: 1190503

URL: http://svn.apache.org/viewvc?rev=1190503&view=rev
Log:
ACCUMULO-93: tighten up the lock check, ensure lock checking does not throw NPE

Modified:
    incubator/accumulo/trunk/   (props changed)
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java

Propchange: incubator/accumulo/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 28 19:08:29 2011
@@ -1 +1 @@
-/incubator/accumulo/branches/1.3:1190280,1190413,1190420,1190427
+/incubator/accumulo/branches/1.3:1190280,1190413,1190420,1190427,1190500

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java?rev=1190503&r1=1190502&r2=1190503&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java
Fri Oct 28 19:08:29 2011
@@ -38,12 +38,19 @@ import org.apache.accumulo.core.tabletse
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.accumulo.core.util.ThriftUtil;
 import org.apache.accumulo.core.zookeeper.ZooCache;
+import org.apache.accumulo.core.zookeeper.ZooLock;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.log4j.Logger;
+import org.apache.thrift.TApplicationException;
+import org.apache.thrift.TException;
+import org.apache.thrift.TServiceClient;
+import org.apache.thrift.transport.TTransportException;
 
 /**
  * Provides a class for administering the accumulo instance
  */
 public class InstanceOperations {
+  private static final Logger log = Logger.getLogger(InstanceOperations.class);
   private Instance instance;
   private AuthInfo credentials;
   
@@ -132,9 +139,13 @@ public class InstanceOperations {
     String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
     List<String> results = new ArrayList<String>();
     for (String candidate : cache.getChildren(path)) {
-      List<String> lockEntries = cache.getChildren(path + "/" + candidate);
-      if (lockEntries != null && lockEntries.size() == 2) {
-        results.add(candidate);
+      try {
+        byte[] data = ZooLock.getLockData(cache, path + "/" + candidate);
+        if (data != null && !"master".equals(new String(data))) {
+          results.add(candidate);
+        }
+      } catch (Exception ex) {
+        log.error("Unable to read lock data:" + path);
       }
     }
     return results;



Mime
View raw message