cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sn...@apache.org
Subject [1/2] cassandra git commit: When SEPWorker assigned work, set thread name to match pool
Date Sun, 19 Jun 2016 11:19:16 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk ea1739f72 -> 471552e04


When SEPWorker assigned work, set thread name to match pool

patch by Chris Lohfink; reviewed by Robert Stupp for CASSANDRA-11966


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7ede582f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7ede582f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7ede582f

Branch: refs/heads/trunk
Commit: 7ede582fbd55dc959c3d3d26b4634b7472451e74
Parents: ea1739f
Author: Chris Lohfink <clohfink85@gmail.com>
Authored: Sat Jun 18 12:25:05 2016 +0200
Committer: Robert Stupp <snazy@snazy.de>
Committed: Sun Jun 19 13:18:14 2016 +0200

----------------------------------------------------------------------
 CHANGES.txt                                               | 1 +
 NEWS.txt                                                  | 2 ++
 src/java/org/apache/cassandra/concurrent/SEPExecutor.java | 2 ++
 src/java/org/apache/cassandra/concurrent/SEPWorker.java   | 3 +++
 4 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7ede582f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a74799c..3d8d511 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.8
+ * When SEPWorker assigned work, set thread name to match pool (CASSANDRA-11966)
  * Add cross-DC latency metrics (CASSANDRA-11596)
  * Allow terms in selection clause (CASSANDRA-10783)
  * Add bind variables to trace (CASSANDRA-11719)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7ede582f/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index aa2612d..d34613c 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -19,6 +19,8 @@ using the provided 'sstableupgrade' tool.
 
 New features
 ------------
+   - Shared pool threads are now named according to the stage they are executing
+     tasks for. Thread names mentioned in traced queries change accordingly.
    - A new option has been added to cassandra-stress "-rate fixed={number}/s"
      that forces a scheduled rate of operations/sec over time. Using this, stress can
      accurately account for coordinated ommission from the stress process.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7ede582f/src/java/org/apache/cassandra/concurrent/SEPExecutor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/concurrent/SEPExecutor.java b/src/java/org/apache/cassandra/concurrent/SEPExecutor.java
index 8b12b82..c87614b 100644
--- a/src/java/org/apache/cassandra/concurrent/SEPExecutor.java
+++ b/src/java/org/apache/cassandra/concurrent/SEPExecutor.java
@@ -34,6 +34,7 @@ public class SEPExecutor extends AbstractLocalAwareExecutorService
     private final SharedExecutorPool pool;
 
     public final int maxWorkers;
+    public final String name;
     private final int maxTasksQueued;
     private final SEPMetrics metrics;
 
@@ -55,6 +56,7 @@ public class SEPExecutor extends AbstractLocalAwareExecutorService
     SEPExecutor(SharedExecutorPool pool, int maxWorkers, int maxTasksQueued, String jmxPath,
String name)
     {
         this.pool = pool;
+        this.name = name;
         this.maxWorkers = maxWorkers;
         this.maxTasksQueued = maxTasksQueued;
         this.permits.set(combine(0, maxWorkers));

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7ede582f/src/java/org/apache/cassandra/concurrent/SEPWorker.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/concurrent/SEPWorker.java b/src/java/org/apache/cassandra/concurrent/SEPWorker.java
index d7c21bc..b3f817a 100644
--- a/src/java/org/apache/cassandra/concurrent/SEPWorker.java
+++ b/src/java/org/apache/cassandra/concurrent/SEPWorker.java
@@ -30,6 +30,7 @@ import org.apache.cassandra.utils.JVMStabilityInspector;
 final class SEPWorker extends AtomicReference<SEPWorker.Work> implements Runnable
 {
     private static final Logger logger = LoggerFactory.getLogger(SEPWorker.class);
+    private static final boolean SET_THREAD_NAME = Boolean.parseBoolean(System.getProperty("cassandra.set_sep_thread_name",
"true"));
 
     final Long workerId;
     final Thread thread;
@@ -89,6 +90,8 @@ final class SEPWorker extends AtomicReference<SEPWorker.Work> implements
Runnabl
                 assigned = get().assigned;
                 if (assigned == null)
                     continue;
+                if (SET_THREAD_NAME)
+                    Thread.currentThread().setName(assigned.name + "-" + workerId);
                 task = assigned.tasks.poll();
 
                 // if we do have tasks assigned, nobody will change our state so we can simply
set it to WORKING


Mime
View raw message