[
https://issues.apache.org/jira/browse/HDFS-9371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15052080#comment-15052080
]
Tsz Wo Nicholas Sze commented on HDFS-9371:
-------------------------------------------
- clearPendingCachingCommands is not synchronized.
- change removeDecomNodeFromList to static and move the Iterator declaration
inside for(), i.e.
{code}
private static void removeDecomNodeFromList(
final List<DatanodeDescriptor> nodeList) {
for (Iterator<DatanodeDescriptor> it = nodeList.iterator(); it.hasNext();) {
{code}
- Why synchronized on datanodeMap but not DatanodeManager?
- How about moving the if-statement into updateHeartbeat and change
updateHeartbeat to return a boolean?
{code}
synchronized (heartbeatManager) {
if (nodeinfo == null || !nodeinfo.isAlive()) {
return new DatanodeCommand[]{RegisterCommand.REGISTER};
}
heartbeatManager.updateHeartbeat(nodeinfo, reports, cacheCapacity,
cacheUsed, xceiverCount, failedVolumes, volumeFailureSummary);
}
{code}
- handleHeartbeat is very long. How about refactor some code to individual
methods?
> Code cleanup for DatanodeManager
> --------------------------------
>
> Key: HDFS-9371
> URL: https://issues.apache.org/jira/browse/HDFS-9371
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Reporter: Jing Zhao
> Assignee: Jing Zhao
> Attachments: HDFS-9371.000.patch, HDFS-9371.001.patch,
> HDFS-9371.002.patch, HDFS-9371.003.patch
>
>
> Some code cleanup for DatanodeManager. The main changes include:
> # make the synchronization of {{datanodeMap}} and
> {{datanodesSoftwareVersions}} consistent
> # remove unnecessary lock in {{handleHeartbeat}}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)