Repository: hive Updated Branches: refs/heads/master 517848f0b -> 39d46a0f3
HIVE-14197: LLAP service driver precondition failure should include the values (Prasanth Jayachandran reviewed by Siddharth Seth) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/39d46a0f Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/39d46a0f Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/39d46a0f Branch: refs/heads/master Commit: 39d46a0f3e37636e102e67ac11ad08348bf4ccc5 Parents: 517848f Author: Prasanth Jayachandran <prasan...@apache.org> Authored: Fri Jul 8 14:04:15 2016 -0700 Committer: Prasanth Jayachandran <prasan...@apache.org> Committed: Fri Jul 8 14:04:15 2016 -0700 ---------------------------------------------------------------------- .../hadoop/hive/llap/cli/LlapServiceDriver.java | 25 ++++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/39d46a0f/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapServiceDriver.java ---------------------------------------------------------------------- diff --git a/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapServiceDriver.java b/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapServiceDriver.java index 98faa2c..0edbe7c 100644 --- a/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapServiceDriver.java +++ b/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapServiceDriver.java @@ -204,7 +204,8 @@ public class LlapServiceDriver { if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.LLAP_ALLOCATOR_MAPPED) == false) { // direct heap allocations need to be safer Preconditions.checkArgument(options.getCache() < options.getSize(), - "Cache has to be smaller than the container sizing"); + "Cache size (" + humanReadableByteCount(options.getCache()) + ") has to be smaller" + + " than the container sizing (" + humanReadableByteCount(options.getSize()) + ")"); } else if (options.getCache() < options.getSize()) { LOG.warn("Note that this might need YARN physical memory monitoring to be turned off " + "(yarn.nodemanager.pmem-check-enabled=false)"); @@ -212,13 +213,18 @@ public class LlapServiceDriver { } if (options.getXmx() != -1) { Preconditions.checkArgument(options.getXmx() < options.getSize(), - "Working memory has to be smaller than the container sizing"); + "Working memory (Xmx=" + humanReadableByteCount(options.getXmx()) + ") has to be" + + " smaller than the container sizing (" + + humanReadableByteCount(options.getSize()) + ")"); } if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.LLAP_ALLOCATOR_DIRECT) && false == HiveConf.getBoolVar(conf, HiveConf.ConfVars.LLAP_ALLOCATOR_MAPPED)) { // direct and not memory mapped Preconditions.checkArgument(options.getXmx() + options.getCache() < options.getSize(), - "Working memory + cache has to be smaller than the container sizing "); + "Working memory + cache (Xmx="+ humanReadableByteCount(options.getXmx()) + + " + cache=" + humanReadableByteCount(options.getCache()) + ")" + + " has to be smaller than the container sizing (" + + humanReadableByteCount(options.getSize()) + ")"); } } @@ -228,7 +234,8 @@ public class LlapServiceDriver { if (options.getSize() != -1) { containerSize = options.getSize() / (1024 * 1024); Preconditions.checkArgument(containerSize >= minAlloc, - "Container size should be greater than minimum allocation(%s)", minAlloc + "m"); + "Container size (" + humanReadableByteCount(options.getSize()) + ") should be greater" + + " than minimum allocation(" + humanReadableByteCount(minAlloc * 1024L * 1024L) + ")"); conf.setLong(ConfVars.LLAP_DAEMON_YARN_CONTAINER_MB.varname, containerSize); propsDirectOptions.setProperty(ConfVars.LLAP_DAEMON_YARN_CONTAINER_MB.varname, String.valueOf(containerSize)); } @@ -582,5 +589,13 @@ public class LlapServiceDriver { lfs.copyFromLocalFile(new Path(conf.getResource(f).toString()), confPath); } - + private String humanReadableByteCount(long bytes) { + int unit = 1024; + if (bytes < unit) { + return bytes + "B"; + } + int exp = (int) (Math.log(bytes) / Math.log(unit)); + String suffix = "KMGTPE".charAt(exp-1) + ""; + return String.format("%.2f%sB", bytes / Math.pow(unit, exp), suffix); + } }