You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by el...@apache.org on 2010/09/04 07:17:22 UTC
svn commit: r992539 - in /hadoop/hdfs/trunk: CHANGES.txt
src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetAsyncDiskService.java
Author: eli
Date: Sat Sep 4 05:17:21 2010
New Revision: 992539
URL: http://svn.apache.org/viewvc?rev=992539&view=rev
Log:
HDFS-1205. FSDatasetAsyncDiskService should name its threads. Contributed by Todd Lipcon.
Modified:
hadoop/hdfs/trunk/CHANGES.txt
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetAsyncDiskService.java
Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=992539&r1=992538&r2=992539&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Sat Sep 4 05:17:21 2010
@@ -27,7 +27,7 @@ Trunk (unreleased changes)
HDFS-1150. Verify datanodes' identities to clients in secure clusters.
(jghoman)
- HDFS-1330. Make RPCs to DataNodes timeout. (hairong)
+ aHDFS-1330. Make RPCs to DataNodes timeout. (hairong)
HDFS-202. HDFS support of listLocatedStatus introduced in HADOOP-6870.
HDFS piggyback block locations to each file status when listing a
@@ -116,6 +116,9 @@ Trunk (unreleased changes)
HDFS-1356. Provide information as to whether or not security is
enabled on web interface for NameNode (boryas)
+ HDFS-1205. FSDatasetAsyncDiskService should name its threads.
+ (Todd Lipcon via eli)
+
OPTIMIZATIONS
HDFS-1140. Speedup INode.getPathComponents. (Dmytro Molkov via shv)
Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetAsyncDiskService.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetAsyncDiskService.java?rev=992539&r1=992538&r2=992539&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetAsyncDiskService.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetAsyncDiskService.java Sat Sep 4 05:17:21 2010
@@ -58,8 +58,6 @@ class FSDatasetAsyncDiskService {
private final ThreadGroup threadGroup = new ThreadGroup("async disk service");
- private ThreadFactory threadFactory;
-
private HashMap<File, ThreadPoolExecutor> executors
= new HashMap<File, ThreadPoolExecutor>();
@@ -73,15 +71,26 @@ class FSDatasetAsyncDiskService {
* @param volumes The roots of the data volumes.
*/
FSDatasetAsyncDiskService(File[] volumes) {
-
- threadFactory = new ThreadFactory() {
- public Thread newThread(Runnable r) {
- return new Thread(threadGroup, r);
- }
- };
-
+
// Create one ThreadPool per volume
for (int v = 0 ; v < volumes.length; v++) {
+ final File vol = volumes[v];
+ ThreadFactory threadFactory = new ThreadFactory() {
+ int counter = 0;
+
+ @Override
+ public Thread newThread(Runnable r) {
+ int thisIndex;
+ synchronized (this) {
+ thisIndex = counter++;
+ }
+ Thread t = new Thread(threadGroup, r);
+ t.setName("Async disk worker #" + thisIndex +
+ " for volume " + vol);
+ return t;
+ }
+ };
+
ThreadPoolExecutor executor = new ThreadPoolExecutor(
CORE_THREADS_PER_VOLUME, MAXIMUM_THREADS_PER_VOLUME,
THREADS_KEEP_ALIVE_SECONDS, TimeUnit.SECONDS,
@@ -89,7 +98,7 @@ class FSDatasetAsyncDiskService {
// This can reduce the number of running threads
executor.allowCoreThreadTimeOut(true);
- executors.put(volumes[v], executor);
+ executors.put(vol, executor);
}
}