ashishkumar50 commented on code in PR #10497:
URL: https://github.com/apache/ozone/pull/10497#discussion_r3429728645
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -1478,17 +1482,32 @@ static class NonWritableNodeFilter implements
Predicate<DatanodeInfo> {
ScmConfigKeys.OZONE_DATANODE_RATIS_VOLUME_FREE_SPACE_MIN,
ScmConfigKeys.OZONE_DATANODE_RATIS_VOLUME_FREE_SPACE_MIN_DEFAULT,
StorageUnit.BYTES);
- containerSize = (long) conf.getStorageSize(
- ScmConfigKeys.OZONE_SCM_CONTAINER_SIZE,
- ScmConfigKeys.OZONE_SCM_CONTAINER_SIZE_DEFAULT,
- StorageUnit.BYTES);
+ this.tracker = tracker;
}
@Override
public boolean test(DatanodeInfo dn) {
return !dn.getNodeStatus().isNodeWritable()
- || (!hasEnoughSpace(dn, minRatisVolumeSizeBytes, containerSize)
- && !hasEnoughCommittedVolumeSpace(dn));
+ || (!hasEnoughSpaceForNode(dn) &&
!hasEnoughCommittedVolumeSpace(dn));
+ }
+
+ /**
+ * Returns true if the datanode has both an available data slot (via
+ * {@link PendingContainerTracker}) and sufficient metadata volume space.
+ */
+ private boolean hasEnoughSpaceForNode(DatanodeInfo dn) {
+ if (!tracker.hasAvailableSpace(dn)) {
+ return false;
+ }
+ if (minRatisVolumeSizeBytes <= 0) {
+ return true;
+ }
+ for (StorageReportProto report : dn.getStorageReports()) {
+ if (report.getRemaining() > minRatisVolumeSizeBytes) {
+ return true;
+ }
+ }
+ return false;
}
Review Comment:
Not exactly this, but `StorageReportProto` need to update to
`MetadataStorageReportProto`
--
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]