JHSUYU opened a new pull request, #8965:
URL: https://github.com/apache/hadoop/pull/8965
JIRA: HDFS-18026
### Description
`dfs.datanode.max.slowdisks.to.exclude` is reconfigurable, and its
documented value 0
disables slow-disk exclusion. However, `DataNodeDiskMetrics` keeps the limit
and the
published slow-disk list as two separate fields:
- `setMaxSlowDisksToExclude()` only updates the limit.
- The detector thread only assigns the list while the limit is positive, so
it is never
cleared after the limit becomes 0.
- `FsVolumeList#chooseVolume` filters volumes by the list without checking
the limit.
As a result, after reconfiguring the value from N > 0 to 0, previously
published slow
disks keep being excluded until the DataNode restarts. If they are all the
volumes of the
requested storage type (e.g. a single SSD), volume choosing fails with
`DiskOutOfSpaceException("No more available volumes")`.
Changes in `DataNodeDiskMetrics`:
- `getSlowDisksToExclude()` returns an empty list whenever the limit is not
positive, so
disabling takes effect immediately and does not race with the detector
thread (which may
have read a positive limit just before the reconfiguration and publish a
list after it).
- The detector thread clears the list when the limit is not positive, so
re-enabling starts
from a fresh detection.
- `slowDisksToExclude` is now `volatile`, since it is written by the
detector thread and
read by writer threads.
### Test
Added `TestFsVolumeList#testReconfigureMaxSlowDisksToExcludeToZero`, which:
1. injects a slow disk with the limit set to 1 and verifies no block is
placed on it;
2. reconfigures the limit to 0 and asserts the exclusion list is empty
immediately;
3. writes a new file and verifies the former slow disk receives blocks again;
4. reconfigures the limit back to 1 and verifies the slow disk is excluded
again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]