HDFS-12718. Ozone: fix thread number calculation in CBlockManager. Contributed by Elek, Marton.

This commit is contained in:
Mukul Kumar Singh 2017-10-31 20:16:03 +05:30 committed by Owen O'Malley
parent 76d34bca62
commit b687902590
2 changed files with 7 additions and 4 deletions

View File

@ -209,7 +209,8 @@ public void run() {
private boolean createVolumeContainers(VolumeDescriptor volume) { private boolean createVolumeContainers(VolumeDescriptor volume) {
ArrayList<String> containerIds = new ArrayList<>(); ArrayList<String> containerIds = new ArrayList<>();
ThreadPoolExecutor executor = new ThreadPoolExecutor(numThreads, ThreadPoolExecutor executor = new ThreadPoolExecutor(
Math.min(numThreads, MAX_THREADS),
MAX_THREADS, 1, TimeUnit.SECONDS, MAX_THREADS, 1, TimeUnit.SECONDS,
new ArrayBlockingQueue<>(MAX_QUEUE_CAPACITY), new ArrayBlockingQueue<>(MAX_QUEUE_CAPACITY),
new ThreadPoolExecutor.CallerRunsPolicy()); new ThreadPoolExecutor.CallerRunsPolicy());
@ -254,7 +255,8 @@ private void deleteContainer(String containerID, boolean force) {
private void deleteVolumeContainers(List<String> containers, boolean force) private void deleteVolumeContainers(List<String> containers, boolean force)
throws CBlockException { throws CBlockException {
ThreadPoolExecutor executor = new ThreadPoolExecutor(numThreads, ThreadPoolExecutor executor = new ThreadPoolExecutor(
Math.min(numThreads, MAX_THREADS),
MAX_THREADS, 1, TimeUnit.SECONDS, MAX_THREADS, 1, TimeUnit.SECONDS,
new ArrayBlockingQueue<>(MAX_QUEUE_CAPACITY), new ArrayBlockingQueue<>(MAX_QUEUE_CAPACITY),
new ThreadPoolExecutor.CallerRunsPolicy()); new ThreadPoolExecutor.CallerRunsPolicy());

View File

@ -185,8 +185,9 @@
<value>16</value> <value>16</value>
<tag>CBLOCK, PERFORMANCE</tag> <tag>CBLOCK, PERFORMANCE</tag>
<description> <description>
Number of threads that cblock manager will use for container Number of active threads that cblock manager will use for container
operations. operations. The maximum number of the threads are limited to the
processor count * 2.
</description> </description>
</property> </property>
<property> <property>