[ https://issues.apache.org/jira/browse/HDFS-15362?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
hemanthboyina updated HDFS-15362: --------------------------------- Description: 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} > 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 > Attachments: HDFS-15362.001.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