Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D722E200C40 for ; Thu, 23 Mar 2017 15:48:58 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D5F1D160B9B; Thu, 23 Mar 2017 14:48:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5376D160B75 for ; Thu, 23 Mar 2017 15:48:58 +0100 (CET) Received: (qmail 81551 invoked by uid 500); 23 Mar 2017 14:48:57 -0000 Mailing-List: contact dev-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list dev@accumulo.apache.org Received: (qmail 80886 invoked by uid 99); 23 Mar 2017 14:48:54 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Mar 2017 14:48:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0DBD2DFE1E; Thu, 23 Mar 2017 14:48:54 +0000 (UTC) From: keith-turner To: dev@accumulo.apache.org Reply-To: dev@accumulo.apache.org References: In-Reply-To: Subject: [GitHub] accumulo pull request #235: ACCUMULO-4612 - Simplify Accumulo memory configu... Content-Type: text/plain Message-Id: <20170323144854.0DBD2DFE1E@git1-us-west.apache.org> Date: Thu, 23 Mar 2017 14:48:54 +0000 (UTC) archived-at: Thu, 23 Mar 2017 14:48:59 -0000 Github user keith-turner commented on a diff in the pull request: https://github.com/apache/accumulo/pull/235#discussion_r107686386 --- Diff: core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java --- @@ -209,13 +209,19 @@ static public long getMemoryInBytes(String str) { case 'B': multiplier = 0; break; + case '%': + int percent = Integer.parseInt(str.substring(0, str.length() - 1)); + if (percent <= 0 || percent >= 100) { + throw new IllegalArgumentException("The value of '" + str + "' is not a valid memory percentage setting."); + } + return Runtime.getRuntime().maxMemory() * percent / 100; default: return Long.parseLong(str); } return Long.parseLong(str.substring(0, str.length() - 1)) << multiplier; } catch (Exception ex) { throw new IllegalArgumentException("The value '" + str + "' is not a valid memory setting. A valid value would a number " - + "possibily followed by an optional 'G', 'M', 'K', or 'B'."); + + "possibly followed by an optional 'G', 'M', 'K', or 'B'."); --- End diff -- Since this is catching exception, it possible that something could go wrong parsing a `%`. So error message should include `%` as valid suffix. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---