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

Tsz Wo Nicholas Sze commented on HDFS-8681:
-------------------------------------------

I suggest to just disable BlockScanner for the mockito test as below since it 
is the behavior before the patch and testChangeVolumeWithRunningCheckDirs() is 
not testing BlockScanner.
{code}
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestFsDatasetImpl.java
@@ -274,6 +274,7 @@ public void testRemoveNewlyAddedVolume() throws IOException 
{
   public void testChangeVolumeWithRunningCheckDirs() throws IOException {
     RoundRobinVolumeChoosingPolicy<FsVolumeImpl> blockChooser =
         new RoundRobinVolumeChoosingPolicy<>();
+    conf.setLong(DFSConfigKeys.DFS_DATANODE_SCAN_PERIOD_HOURS_KEY, -1);
     final BlockScanner blockScanner = new BlockScanner(datanode, conf);
     final FsVolumeList volumeList = new FsVolumeList(
         Collections.<VolumeFailureInfo>emptyList(), blockScanner, 
blockChooser);
{code}


> BlockScanner is incorrectly disabled by default
> -----------------------------------------------
>
>                 Key: HDFS-8681
>                 URL: https://issues.apache.org/jira/browse/HDFS-8681
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: datanode
>    Affects Versions: 2.7.0
>            Reporter: Andrew Wang
>            Assignee: Arpit Agarwal
>            Priority: Blocker
>         Attachments: HDFS-8681.01.patch, HDFS-8681.02.patch, 
> HDFS-8681.03.patch
>
>
> This code is used to check whether the block scanner is enabled:
> {noformat}
>   public boolean isEnabled() {
>     return (conf.scanPeriodMs) > 0 && (conf.targetBytesPerSec > 0);
>   }
> {noformat}
> Unfortunately, when this was introduced, we did not change the default scan 
> period's value of 0, which means by default the BlockScanner is disabled.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to