[ 
https://issues.apache.org/jira/browse/HDFS-15362?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Íñigo Goiri updated HDFS-15362:
-------------------------------
    Fix Version/s: 3.4.0
     Hadoop Flags: Reviewed
       Resolution: Fixed
           Status: Resolved  (was: Patch Available)

> FileWithSnapshotFeature#updateQuotaAndCollectBlocks should collect all 
> distinct blocks
> --------------------------------------------------------------------------------------
>
>                 Key: HDFS-15362
>                 URL: https://issues.apache.org/jira/browse/HDFS-15362
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: hemanthboyina
>            Assignee: hemanthboyina
>            Priority: Major
>             Fix For: 3.4.0
>
>         Attachments: HDFS-15362.001.patch, HDFS-15362.002.patch
>
>
> FileWithSnapshotFeature#updateQuotaAndCollectBlocks uses list to collect 
> blocks 
> {code:java}
>  List<BlockInfo> allBlocks = new ArrayList<BlockInfo>();
>  if (file.getBlocks() != null) {
>     allBlocks.addAll(Arrays.asList(file.getBlocks()));
>   }{code}
>  INodeFile#storagespaceConsumedContiguous collects all distinct blocks by set
> {code:java}
> // Collect all distinct blocks
>  Set<BlockInfo> allBlocks = new HashSet<>(Arrays.asList(getBlocks()));
>  DiffList<FileDiff> diffs = sf.getDiffs().asList();
>  for(FileDiff diff : diffs) {
>    BlockInfo[] diffBlocks = diff.getBlocks();
>    if (diffBlocks != null) {
>      allBlocks.addAll(Arrays.asList(diffBlocks));
>  } {code}
> but on updating the reclaim context we subtract these both , so wrong quota 
> value can be updated
> {code:java}
> QuotaCounts current = file.storagespaceConsumed(bsp);
> reclaimContext.quotaDelta().add(oldCounts.subtract(current)); {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to