Class DirectoryScanner
java.lang.Object
org.apache.hadoop.hdfs.server.datanode.DirectoryScanner
- All Implemented Interfaces:
Runnable
Periodically scans the data directories for block and block metadata files.
Reconciles the differences with block information maintained in the dataset.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHelper class for compiling block info reports per block pool.classThe ReportCompiler class encapsulates the process of searching a datanode's disks for block information.static classHelper class for compiling block info reports from report compiler threads. -
Constructor Summary
ConstructorsConstructorDescriptionDirectoryScanner(FsDatasetSpi<?> dataset, org.apache.hadoop.conf.Configuration conf) Create a new directory scanner, but don't cycle it running yet. -
Method Summary
Modifier and TypeMethodDescriptionGet the lists of blocks on the disks in the data set.voidReconcile differences between disk and in-memory blocksvoidrun()Main program loop for DirectoryScanner.voidsetRetainDiffs(boolean b) Allow retaining diffs for unit test and analysis.voidstart()Start the scanner.
-
Constructor Details
-
DirectoryScanner
Create a new directory scanner, but don't cycle it running yet.- Parameters:
dataset- the dataset to scanconf- the Configuration object
-
-
Method Details
-
setRetainDiffs
@VisibleForTesting public void setRetainDiffs(boolean b) Allow retaining diffs for unit test and analysis. Defaults to false (off).- Parameters:
b- whether to retain diffs
-
start
@VisibleForTesting public void start()Start the scanner. The scanner will run everyDFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_INTERVAL_KEYseconds. -
run
public void run()Main program loop for DirectoryScanner. Runsreconcile()and handles any exceptions. -
reconcile
Reconcile differences between disk and in-memory blocks- Throws:
IOException
-
getVolumeReports
Get the lists of blocks on the disks in the data set.
-