accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1336819 - /accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
Date Thu, 10 May 2012 18:13:17 GMT
Author: vines
Date: Thu May 10 18:13:17 2012
New Revision: 1336819

URL: http://svn.apache.org/viewvc?rev=1336819&view=rev
Log:
ACCUMULO-510 - We now temporarily change the thread to have the user name, scan start time,
client IP:port pair, and key extent while the scan is taking place


Modified:
    accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java

Modified: accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1336819&r1=1336818&r2=1336819&view=diff
==============================================================================
--- accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
(original)
+++ accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
Thu May 10 18:13:17 2012
@@ -201,12 +201,11 @@ import org.apache.thrift.server.TServer;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.KeeperException.NoNodeException;
 
-
 enum ScanRunState {
   QUEUED, RUNNING, FINISHED
 }
 
-public class TabletServer extends AbstractMetricsImpl implements org.apache.accumulo.server.tabletserver.metrics.TabletServerMBean
 {
+public class TabletServer extends AbstractMetricsImpl implements org.apache.accumulo.server.tabletserver.metrics.TabletServerMBean
{
   private static final Logger log = Logger.getLogger(TabletServer.class);
   
   private static HashMap<String,Long> prevGcTime = new HashMap<String,Long>();
@@ -891,9 +890,13 @@ public class TabletServer extends Abstra
       public void run() {
         
         ScanSession scanSession = (ScanSession) sessionManager.getSession(scanID);
-        
+        String oldThreadName = Thread.currentThread().getName();
+
         try {
           runState.set(ScanRunState.RUNNING);
+          Thread.currentThread().setName(
+              "User: " + scanSession.user + " Start: " + scanSession.startTime + " Client:
" + scanSession.client + " Tablet: " + scanSession.extent);
+
           if (isCancelled() || scanSession == null)
             return;
           
@@ -929,6 +932,7 @@ public class TabletServer extends Abstra
           addResult(e);
         } finally {
           runState.set(ScanRunState.FINISHED);
+          Thread.currentThread().setName(oldThreadName);
         }
         
       }
@@ -945,12 +949,14 @@ public class TabletServer extends Abstra
       @Override
       public void run() {
         MultiScanSession session = (MultiScanSession) sessionManager.getSession(scanID);
+        String oldThreadName = Thread.currentThread().getName();
         
         try {
           runState.set(ScanRunState.RUNNING);
+          Thread.currentThread().setName("Client: " + session.client + " User: " + session.user
+ " Start: " + session.startTime + " Table: ");
           if (isCancelled() || session == null)
             return;
-          
+
           long maxResultsSize = acuConf.getMemoryInBytes(Property.TABLE_SCAN_MAXMEM);
           long bytesAdded = 0;
           long maxScanTime = 4000;
@@ -966,8 +972,7 @@ public class TabletServer extends Abstra
           
           Iterator<Entry<KeyExtent,List<Range>>> iter = session.queries.entrySet().iterator();
           
-          // check the time so that the read ahead thread is not
-          // monopolized
+          // check the time so that the read ahead thread is not monopolized
           while (iter.hasNext() && bytesAdded < maxResultsSize && (System.currentTimeMillis()
- startTime) < maxScanTime) {
             Entry<KeyExtent,List<Range>> entry = iter.next();
             
@@ -979,6 +984,8 @@ public class TabletServer extends Abstra
               failures.put(entry.getKey(), entry.getValue());
               continue;
             }
+            Thread.currentThread().setName(
+                "Client: " + session.client + " User: " + session.user + " Start: " + session.startTime
+ " Tablet: " + entry.getKey().toString());
             
             LookupResult lookupResult;
             try {
@@ -1046,6 +1053,7 @@ public class TabletServer extends Abstra
           log.warn("exception while doing multi-scan ", e);
           addResult(e);
         } finally {
+          Thread.currentThread().setName(oldThreadName);
           runState.set(ScanRunState.FINISHED);
         }
       }



Mime
View raw message