hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Mollitor (Jira)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-14798) Synchronize invalidateBlocks in DatanodeDescriptor
Date Thu, 29 Aug 2019 18:52:00 GMT

    [ https://issues.apache.org/jira/browse/HDFS-14798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16918888#comment-16918888
] 

David Mollitor commented on HDFS-14798:
---------------------------------------

Ya, I don't know if it's being used in a multi-threaded way currently that may cause a problem,
but it is a very small cost to add in the synchronization.  Even if it's not a problem now,
adding synchronization protects against future changes that may try to access this method
in a multi-threaded way and becomes a nasty surprise.

> Synchronize invalidateBlocks in DatanodeDescriptor
> --------------------------------------------------
>
>                 Key: HDFS-14798
>                 URL: https://issues.apache.org/jira/browse/HDFS-14798
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 3.2.0
>            Reporter: David Mollitor
>            Assignee: hemanthboyina
>            Priority: Minor
>              Labels: n00b, newbie
>         Attachments: HDFS-14798.001.patch
>
>
> {code:java|title=DatanodeDescriptor.java}
> public void resetBlocks() {
>   ...
>   this.invalidateBlocks.clear();
>   ...
> }
> public void clearBlockQueues() {
>   synchronized (invalidateBlocks) {
>     this.invalidateBlocks.clear();
>   }
>   ...
> }
> {code}
> It may not be strictly necessary, but why risk it? The invalidateBlocks should be protected
in {{resetBlocks()}} just like it is in {{clearBlockQueues()}}/



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message