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 2012/01/28 01:26:37 UTC

svn commit: r1236941 - in /incubator/accumulo/trunk: ./ src/core/ src/server/ src/server/src/main/java/org/apache/accumulo/server/master/ src/server/src/main/java/org/apache/accumulo/server/master/state/

Author: kturner
Date: Sat Jan 28 00:26:37 2012
New Revision: 1236941

URL: http://svn.apache.org/viewvc?rev=1236941&view=rev
Log:
ACCUMULO-315 ACCUMULO-327 merge fixes from 1.4

Modified:
    incubator/accumulo/trunk/   (props changed)
    incubator/accumulo/trunk/src/core/   (props changed)
    incubator/accumulo/trunk/src/server/   (props changed)
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java

Propchange: incubator/accumulo/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jan 28 00:26:37 2012
@@ -1,3 +1,3 @@
 /incubator/accumulo/branches/1.3:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611,1228195,1230180,1230736,1231043,1236873
 /incubator/accumulo/branches/1.3.5rc:1209938
-/incubator/accumulo/branches/1.4:1201902-1236877
+/incubator/accumulo/branches/1.4:1201902-1236940

Propchange: incubator/accumulo/trunk/src/core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jan 28 00:26:37 2012
@@ -1,3 +1,3 @@
-/incubator/accumulo/branches/1.3/src/core:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215
 /incubator/accumulo/branches/1.3.5rc/src/core:1209938
-/incubator/accumulo/branches/1.4/src/core:1201902-1236877
+/incubator/accumulo/branches/1.3/src/core:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215
+/incubator/accumulo/branches/1.4/src/core:1201902-1236940

Propchange: incubator/accumulo/trunk/src/server/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jan 28 00:26:37 2012
@@ -1,3 +1,3 @@
-/incubator/accumulo/branches/1.3/src/server:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611
 /incubator/accumulo/branches/1.3.5rc/src/server:1209938
-/incubator/accumulo/branches/1.4/src/server:1201902-1236877
+/incubator/accumulo/branches/1.3/src/server:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611
+/incubator/accumulo/branches/1.4/src/server:1201902-1236940

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java?rev=1236941&r1=1236940&r2=1236941&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java Sat Jan 28 00:26:37 2012
@@ -69,87 +69,123 @@ public class LiveTServerSet implements W
   public class TServerConnection {
     private final InetSocketAddress address;
     
-    TabletClientService.Iface client = null;
-    
     public TServerConnection(InetSocketAddress addr) throws TException {
       address = addr;
     }
     
-    synchronized private TabletClientService.Iface connect() {
-      if (client == null) {
-        try {
-          client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
-        } catch (Exception ex) {
-          client = null;
-          log.error(ex, ex);
-        }
-      }
-      return client;
-    }
-    
     private String lockString(ZooLock mlock) {
       return mlock.getLockID().serialize(ZooUtil.getRoot(instance) + Constants.ZMASTER_LOCK);
     }
     
-    synchronized public void close() {
-      if (client != null) {
+    public void assignTablet(ZooLock lock, KeyExtent extent) throws TException {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
+        client.loadTablet(null, SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift());
+      } finally {
         ThriftUtil.returnClient(client);
-        client = null;
       }
     }
     
-    synchronized public void assignTablet(ZooLock lock, KeyExtent extent) throws TException {
-      connect().loadTablet(null, SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift());
-    }
-    
-    synchronized public void unloadTablet(ZooLock lock, KeyExtent extent, boolean save) throws TException {
-      connect().unloadTablet(null, SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift(), save);
+    public void unloadTablet(ZooLock lock, KeyExtent extent, boolean save) throws TException {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
+        client.unloadTablet(null, SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift(), save);
+      } finally {
+        ThriftUtil.returnClient(client);
+      }
     }
     
-    synchronized public TabletServerStatus getTableMap() throws TException, ThriftSecurityException {
-      return connect().getTabletServerStatus(null, SecurityConstants.getSystemCredentials());
+    public TabletServerStatus getTableMap() throws TException, ThriftSecurityException {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
+        return client.getTabletServerStatus(null, SecurityConstants.getSystemCredentials());
+      } finally {
+        ThriftUtil.returnClient(client);
+      }
     }
     
-    synchronized public void halt(ZooLock lock) throws TException, ThriftSecurityException {
-      if (client != null) {
+    public void halt(ZooLock lock) throws TException, ThriftSecurityException {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
         client.halt(null, SecurityConstants.getSystemCredentials(), lockString(lock));
+      } finally {
+        ThriftUtil.returnClient(client);
       }
     }
     
     public void fastHalt(ZooLock lock) throws TException {
-      if (client != null) {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
         client.fastHalt(null, SecurityConstants.getSystemCredentials(), lockString(lock));
+      } finally {
+        ThriftUtil.returnClient(client);
       }
     }
     
-    synchronized public void flush(ZooLock lock, String tableId, byte[] startRow, byte[] endRow) throws TException {
-      connect().flush(null, SecurityConstants.getSystemCredentials(), lockString(lock), tableId, startRow == null ? null : ByteBuffer.wrap(startRow),
-          endRow == null ? null : ByteBuffer.wrap(endRow));
+    public void flush(ZooLock lock, String tableId, byte[] startRow, byte[] endRow) throws TException {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
+        client.flush(null, SecurityConstants.getSystemCredentials(), lockString(lock), tableId, startRow == null ? null : ByteBuffer.wrap(startRow),
+            endRow == null ? null : ByteBuffer.wrap(endRow));
+      } finally {
+        ThriftUtil.returnClient(client);
+      }
     }
     
-    synchronized public void useLoggers(Set<String> loggers) throws TException {
-      connect().useLoggers(null, SecurityConstants.getSystemCredentials(), loggers);
+    public void useLoggers(Set<String> loggers) throws TException {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
+        client.useLoggers(null, SecurityConstants.getSystemCredentials(), loggers);
+      } finally {
+        ThriftUtil.returnClient(client);
+      }
     }
     
-    synchronized public void chop(ZooLock lock, KeyExtent extent) throws TException {
-      connect().chop(null, SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift());
+    public void chop(ZooLock lock, KeyExtent extent) throws TException {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
+        client.chop(null, SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift());
+      } finally {
+        ThriftUtil.returnClient(client);
+      }
     }
     
-    synchronized public void splitTablet(ZooLock lock, KeyExtent extent, Text splitPoint) throws TException, ThriftSecurityException, NotServingTabletException {
-      connect().splitTablet(null, SecurityConstants.getSystemCredentials(), extent.toThrift(), ByteBuffer.wrap(splitPoint.getBytes(), 0, splitPoint.getLength()));
+    public void splitTablet(ZooLock lock, KeyExtent extent, Text splitPoint) throws TException, ThriftSecurityException, NotServingTabletException {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
+        client
+            .splitTablet(null, SecurityConstants.getSystemCredentials(), extent.toThrift(), ByteBuffer.wrap(splitPoint.getBytes(), 0, splitPoint.getLength()));
+      } finally {
+        ThriftUtil.returnClient(client);
+      }
     }
     
-    synchronized public void flushTablet(ZooLock lock, KeyExtent extent) throws TException {
-      connect().flushTablet(null, SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift());
+    public void flushTablet(ZooLock lock, KeyExtent extent) throws TException {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
+        client.flushTablet(null, SecurityConstants.getSystemCredentials(), lockString(lock), extent.toThrift());
+      } finally {
+        ThriftUtil.returnClient(client);
+      }
     }
     
-    synchronized public void compact(ZooLock lock, String tableId, byte[] startRow, byte[] endRow) throws TException {
-      connect().compact(null, SecurityConstants.getSystemCredentials(), lockString(lock), tableId, startRow == null ? null : ByteBuffer.wrap(startRow),
-          endRow == null ? null : ByteBuffer.wrap(endRow));
+    public void compact(ZooLock lock, String tableId, byte[] startRow, byte[] endRow) throws TException {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
+        client.compact(null, SecurityConstants.getSystemCredentials(), lockString(lock), tableId, startRow == null ? null : ByteBuffer.wrap(startRow),
+            endRow == null ? null : ByteBuffer.wrap(endRow));
+      } finally {
+        ThriftUtil.returnClient(client);
+      }
     }
     
-    synchronized public boolean isActive(long tid) throws TException {
-      return connect().isActive(null, tid);
+    public boolean isActive(long tid) throws TException {
+      TabletClientService.Iface client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
+      try {
+        return client.isActive(null, tid);
+      } finally {
+        ThriftUtil.returnClient(client);
+      }
     }
     
   }
@@ -169,7 +205,6 @@ public class LiveTServerSet implements W
     
     void cleanup() throws InterruptedException, KeeperException {
       lock.tryToCancelAsyncLockOrUnlock();
-      connection.close();
     }
   };
   

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1236941&r1=1236940&r2=1236941&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java Sat Jan 28 00:26:37 2012
@@ -1979,8 +1979,10 @@ public class Master implements LiveTServ
       try {
         TabletServerStatus status = tserverSet.getConnection(server).getTableMap();
         result.put(server, status);
+        // TODO maybe remove from bad servers
       } catch (Exception ex) {
-        log.error("unable to get tablet server status " + server);
+        log.error("unable to get tablet server status " + server + " " + ex.getMessage());
+        log.debug("unable to get tablet server status " + server, ex);
         if (badServers.get(server).incrementAndGet() > MAX_BAD_STATUS_COUNT) {
           log.warn("attempting to stop " + server);
           try {

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java?rev=1236941&r1=1236940&r2=1236941&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java Sat Jan 28 00:26:37 2012
@@ -159,11 +159,14 @@ public class MergeStats {
     Text pr = null;
     for (Entry<Key,Value> entry : scanner) {
       TabletLocationState tls = MetaDataTableScanner.createTabletLocationState(entry.getKey(), entry.getValue());
+      if (!tls.extent.getTableId().equals(tableId)) {
+        break;
+      }
       verify.update(tls.extent, tls.getState(master.onlineTabletServers()), tls.chopped);
-      if (pr != null && !tls.extent.getPrevEndRow().equals(pr))
+      if (pr != null && (tls.extent.getPrevEndRow() == null || !tls.extent.getPrevEndRow().equals(pr)))
         return false;
       pr = tls.extent.getEndRow();
-      if (tls.extent.getPrevEndRow().compareTo(extent.getEndRow()) > 0) {
+      if (tls.extent.getPrevEndRow() != null && extent.getEndRow() != null && tls.extent.getPrevEndRow().compareTo(extent.getEndRow()) > 0) {
         break;
       }
     }