[
https://issues.apache.org/jira/browse/HDFS-7758?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14351259#comment-14351259
]
Lei (Eddy) Xu commented on HDFS-7758:
-------------------------------------
[~jpallas] What I am going to do is something like the this:
{code}
public static interface ReferredFsVolumeList extends Iterable<FsVolumeSpi>,
Closeable {
}
/**
* Returns a list of volume references.
*
* The caller must release the reference of each volume by calling
* {@link FsVolumeReference#close}.
*/
public ReferredFsVolumeList getReferredVolumes();
{code}
In this way, findbugs should be able to capture it?
> Retire FsDatasetSpi#getVolumes() and use FsDatasetSpi#getVolumeRefs() instead
> -----------------------------------------------------------------------------
>
> Key: HDFS-7758
> URL: https://issues.apache.org/jira/browse/HDFS-7758
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: datanode
> Affects Versions: 2.6.0
> Reporter: Lei (Eddy) Xu
> Assignee: Lei (Eddy) Xu
> Attachments: HDFS-7758.000.patch, HDFS-7758.001.patch
>
>
> HDFS-7496 introduced reference-counting the volume instances being used to
> prevent race condition when hot swapping a volume.
> However, {{FsDatasetSpi#getVolumes()}} can still leak the volume instance
> without increasing its reference count. In this JIRA, we retire the
> {{FsDatasetSpi#getVolumes()}} and propose {{FsDatasetSpi#getVolumeRefs()}}
> and etc. method to access {{FsVolume}}. Thus it makes sure that the consumer
> of {{FsVolume}} always has correct reference count.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)