Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/235#discussion_r107798096
  
    --- 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 --
    
    Also keep in mind, that we do have a PERCENTAGE type already, with an 
appropriate error message. I realize this new type is a bit more narrow than 
the existing PERCENTAGE type, though.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to