protected void checkDiskError ( ) throws IOException { // We disallow concurrent disk checks as it doesn't help // but can significantly impact performance and reliability of // the system. // boolean setSuccess = checkingDisk . compareAndSet ( false , true ) ; if ( ! setSuccess ) { LOG . info ( "checkDiskError is already running." ) ; return ; } try { // We don't check disks if it's not long since last check. // long curTime = System . currentTimeMillis ( ) ; if ( curTime - timeLastCheckDisk < minDiskCheckIntervalMsec ) { LOG . info ( "checkDiskError finished within " + minDiskCheckIntervalMsec + " mses. Skip this one." ) ; return ; } data . checkDataDir ( ) ; timeLastCheckDisk = System . currentTimeMillis ( ) ; } catch ( DiskErrorException de ) { handleDiskError ( de . getMessage ( ) ) ; } finally { checkingDisk . set ( false ) ; } }
Check if there is a disk failure and if so handle the error