HDFS-10448. CacheManager#addInternal tracks bytesNeeded incorrectly when dealing with replication factors other than 1 (Yiqun Lin via cmccabe)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/46f1602e Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/46f1602e Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/46f1602e Branch: refs/heads/HDFS-1312 Commit: 46f1602e896273b308fbd5df6c75f6c142828227 Parents: 7adc4d1 Author: Colin Patrick Mccabe <cmcc...@cloudera.com> Authored: Mon Jun 20 18:25:09 2016 -0700 Committer: Colin Patrick Mccabe <cmcc...@cloudera.com> Committed: Mon Jun 20 18:25:09 2016 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hdfs/server/namenode/CacheManager.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/46f1602e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CacheManager.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CacheManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CacheManager.java index cd57c56..366dd9b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CacheManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CacheManager.java @@ -396,8 +396,7 @@ public final class CacheManager { if (pool.getLimit() == CachePoolInfo.LIMIT_UNLIMITED) { return; } - if (pool.getBytesNeeded() + (stats.getBytesNeeded() * replication) > pool - .getLimit()) { + if (pool.getBytesNeeded() + stats.getBytesNeeded() > pool.getLimit()) { throw new InvalidRequestException("Caching path " + path + " of size " + stats.getBytesNeeded() / replication + " bytes at replication " + replication + " would exceed pool " + pool.getPoolName() @@ -441,7 +440,7 @@ public final class CacheManager { } } return new CacheDirectiveStats.Builder() - .setBytesNeeded(requestedBytes) + .setBytesNeeded(requestedBytes * replication) .setFilesCached(requestedFiles) .build(); } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org