[
https://issues.apache.org/jira/browse/HDFS-9038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15051894#comment-15051894
]
Chris Nauroth commented on HDFS-9038:
-------------------------------------
I took patch v006 for a more thorough test run. Unfortunately, I'm still
seeing the bug that was introduced by HDFS-5215. Even though non-DFS used is
now calculated explicitly by the DataNode and sent in a dedicated RPC field,
it's still using an incorrect calculation.
To help illustrate the problem better, I'd like to walk through the math for
calculating non-DFS used, both before HDFS-5215 and after HDFS-5215. Here is a
bit of pseudo-code, prefixed with line numbers.
*Before HDFS-5215:*
{code}
1: nonDfsUsed = capacity - dfsUsed - available
2: = (File#getTotalSpace - dfs.datanode.du.reserved) - dfsUsed -
available
3: = (File#getTotalSpace - dfs.datanode.du.reserved) - dfsUsed -
File#getUsableSpace
4: = File#getTotalSpace - dfs.datanode.du.reserved - dfsUsed -
File#getUsableSpace
{code}
*After HDFS-5215*
{code}
1: nonDfsUsed = capacity - dfsUsed - available
2: = (File#getTotalSpace - dfs.datanode.du.reserved) - dfsUsed -
available
3: = (File#getTotalSpace - dfs.datanode.du.reserved) - dfsUsed -
(File#getUsableSpace - dfs.datanode.du.reserved)
4: = File#getTotalSpace - dfs.datanode.du.reserved - dfsUsed -
File#getUsableSpace + dfs.datanode.du.reserved
5: = File#getTotalSpace - dfsUsed - File#getUsableSpace
{code}
The most important point to note is the difference in line 3 of the expansions.
After HDFS-5215, the definition of {{available}} removes
{{dfs.datanode.du.reserved}}. However, the definition of {{capacity}} already
removed {{dfs.datanode.du.reserved}}. Carrying out the expansion further in
lines 4 and 5, we see that the 2 occurrences of {{dfs.datanode.du.reserved}}
cancel each other out. That means implicitly that {{nonDfsUsed}} now includes
(instead of excludes) {{dfs.datanode.du.reserved}}.
Patch v006 still has the same fundamental problem in the logic, because
{{FsVolumeImpl#getNonDfsUsed}} still reuses the implementation of
{{FsVolumeImpl#getAvailable}}, which in turn removes
{{dfs.datanode.du.reserved}}.
I think {{FsVolumeImpl#getNonDfsUsed}} essentially needs to go back to the old
pre-HDFS-5215 calculation of {{remaining}} instead of calling
{{FsVolumeImpl#getAvailable}}.
> DFS reserved space is erroneously counted towards non-DFS used.
> ---------------------------------------------------------------
>
> Key: HDFS-9038
> URL: https://issues.apache.org/jira/browse/HDFS-9038
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: datanode
> Affects Versions: 2.7.1
> Reporter: Chris Nauroth
> Assignee: Brahma Reddy Battula
> Attachments: HDFS-9038-002.patch, HDFS-9038-003.patch,
> HDFS-9038-004.patch, HDFS-9038-005.patch, HDFS-9038-006.patch, HDFS-9038.patch
>
>
> HDFS-5215 changed the DataNode volume available space calculation to consider
> the reserved space held by the {{dfs.datanode.du.reserved}} configuration
> property. As a side effect, reserved space is now counted towards non-DFS
> used. I don't believe it was intentional to change the definition of non-DFS
> used. This issue proposes restoring the prior behavior: do not count
> reserved space towards non-DFS used.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)