Disk failures are hard to handle. This JIRA is created to discuss/improve disk failure handling in a better/consistent manner.
For one thing, disks can fail in multiple different ways: the hardware might be failing, disk space is full, checksum error ... For others, hardware abstracts out the details, so it's hard for software to handle them.
There are currently three disk check mechanisms in HDFS, as far as I know: BlockScanner, BlockPoolSlice#checkDirs and DU. Disk errors are handled differently.
This JIRA is more focused on DU error handling. DU may emit errors like this:
I found DU errors are not handled consistently while working on
HDFS-9908 (Datanode should tolerate disk scan failure during NN handshake), and it all depends on who catches the exception.
- if DU returns error during NN handshake, DN will not be able to join the cluster at all(
- however, if the same exception is caught in BlockPoolSlice#saveDfsUsed, data node will only log a warning and do nothing (
- in some cases, the exception handler invokes BlockPoolSlice#checkDirs, but since it only checks three directories, it is very unlikely to find the files that have the error. BlockReceiver#(constructor)
So my ask is: should the error be handled in a consistent manner? Should data node report to the name nodes about the disk failures (this is the BlockScanner approach), and should data node takes this volume offline automatically if DU returns an error? (this is the checkDirs approach)