[ 
https://issues.apache.org/jira/browse/HDFS-12196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16122780#comment-16122780
 ] 

Weiwei Yang commented on HDFS-12196:
------------------------------------

Thanks [~anu] for the comments. Per offline discussion, since we will reuse 
background service for multiple components, KSM, SCM as well as datanode, lets 
use separate thread pools. For rest of your comments

bq. Generally we expect the background service to be a deamon thread.

Fixed. Now it is constructed like following way

{code}
ThreadFactory tf = r -> new Thread(threadGroup, r);
threadFactory = new ThreadFactoryBuilder()
        .setThreadFactory(tf)
        .setDaemon(true)
        .setNameFormat(serviceName + "#%d")
        .build();
{code}

this is to ensure we have all threads contained in a thread group, to manage 
them all together. So we can get # of running threads for this service if 
necessary.

bq. Question : Why do we need the testing flag and testing Thread?
I have refactor that to a single-test-purpose class 
{{ContainerRecyclingServicetTestImpl}}, instead of waiting for intervals, the 
test class run each cycle by a function call, so that I can write more 
finer-grained UT cases.

bq. BackgroundTaskQueue.java is not thread safe, is it by design?
This class doesn't have to be thread safe as there is only 1 thread to fetch 
the tasks. But I use a thread safe implementation in the new patch, in case in 
future we need to access it in multiple threads.

bq. Should we create a new package called background tasks ...
Fixed.

Thank you!

> Ozone: DeleteKey-2: Implement container recycling service to delete stale 
> blocks at background
> ----------------------------------------------------------------------------------------------
>
>                 Key: HDFS-12196
>                 URL: https://issues.apache.org/jira/browse/HDFS-12196
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: ozone
>            Reporter: Weiwei Yang
>            Assignee: Weiwei Yang
>         Attachments: HDFS-12196-HDFS-7240.001.patch, 
> HDFS-12196-HDFS-7240.002.patch, HDFS-12196-HDFS-7240.003.patch, 
> HDFS-12196-HDFS-7240.004.patch, HDFS-12196-HDFS-7240.005.patch
>
>
> Implement a recycling service running on datanode to delete stale blocks.  
> The recycling service scans staled blocks for each container and delete 
> chunks and references periodically.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to