cxzl25 opened a new pull request, #9000:
URL: https://github.com/apache/hadoop/pull/9000
### Description of PR
The NameNode exposes the number of decommissioning DataNodes
(`NumDecommissioningDataNodes`), but the number of blocks that still have to be
replicated before those DataNodes can be decommissioned is only available per
node, inside the `DecomNodes` JSON string of the `NameNodeInfo` MXBean
(`underReplicatedBlocks`). Monitoring systems that only collect numeric metrics
cannot plot or alert on the decommission progress.
With `DatanodeAdminDefaultMonitor` the progress can be roughly inferred from
`LowRedundancyBlocks`, because all the blocks of a decommissioning DataNode are
added to the reconstruction queue at once. With `DatanodeAdminBackoffMonitor`
the number of blocks in the reconstruction queue is limited by
`dfs.namenode.decommission.backoff.monitor.pending.limit`, so
`LowRedundancyBlocks` no longer reflects the remaining work.
This PR adds a new `FSNamesystem` metric,
`DecommissioningLowRedundancyBlocks`: the sum of
`LeavingServiceStatus#getUnderReplicatedBlocks()` over the DataNodes in
decommissioning state, i.e. the total of the per node `underReplicatedBlocks`
value reported in `DecomNodes`.
- `FSNamesystem`: add the `DecommissioningLowRedundancyBlocks` gauge.
- `Metrics.md`: document the new metric.
The metric is only added with `@Metric`, like `ExcessBlocks` or
`PostponedMisreplicatedBlocks`. It is not added to `FSNamesystemMBean`, so RBF
(`NamenodeBeanMetrics`) is not affected.
### How was this patch tested?
Added `TestNameNodeMetrics#testDecommissioningLowRedundancyBlocks`: with the
RedundancyMonitor stopped, a DataNode holding the only replica of some blocks
is decommissioned; the metric equals the number of blocks on that DataNode
while it is decommissioning, and goes back to 0 once the decommission is
stopped.
```
mvn test -pl hadoop-hdfs-project/hadoop-hdfs
-Dtest='TestNameNodeMetrics#testDecommissioningLowRedundancyBlocks+testDataNodeLivenessAndDecom'
```
The new test was also run once locally with
`dfs.namenode.decommission.monitor.class` set to `DatanodeAdminBackoffMonitor`.
There the metric is updated from the second monitor tick on, since the per node
status is refreshed when the pending blocks are processed.
### For code changes:
- [ ] Does the title of this PR start with the corresponding JIRA issue id
(e.g. 'HADOOP-17799. Your PR title ...')?
- [ ] Object storage: Have the integration tests been executed and the
endpoint
declared according to the connector-specific documentation? *Note:
Automated CI
testing doesn't cover all cases so manual testing with cloud storage
is still
required.*
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`,
`NOTICE-binary` files?
### AI Tooling
If an AI tool was used:
- [ ] The PR includes the phrase "Contains content generated by <tool>"
where <tool> is the name of the AI tool used.
- [ ] My use of AI contributions follows the ASF legal policy
https://www.apache.org/legal/generative-tooling.html
--
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]