You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2014/01/07 00:34:11 UTC
[10/10] git commit: Merge branch '1.6.0-SNAPSHOT'
Merge branch '1.6.0-SNAPSHOT'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e2e7d2e5
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e2e7d2e5
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e2e7d2e5
Branch: refs/heads/master
Commit: e2e7d2e5c7376f9ddd3fd261508034f512675139
Parents: b7d15fc d1f3dfe
Author: John Vines <vi...@apache.org>
Authored: Mon Jan 6 18:29:42 2014 -0500
Committer: John Vines <vi...@apache.org>
Committed: Mon Jan 6 18:29:42 2014 -0500
----------------------------------------------------------------------
.../apache/accumulo/core/client/Instance.java | 8 +-
.../accumulo/core/client/ZooKeeperInstance.java | 51 +---
.../core/client/impl/ThriftTransportPool.java | 16 +-
.../client/mapreduce/AbstractInputFormat.java | 254 +++++++++----------
.../client/mapreduce/AccumuloOutputFormat.java | 5 +-
.../mapreduce/lib/util/InputConfigurator.java | 6 +-
.../accumulo/core/client/mock/MockInstance.java | 5 -
.../core/conf/AccumuloConfiguration.java | 35 ++-
.../apache/accumulo/core/util/ThriftUtil.java | 4 -
.../core/client/impl/TabletLocatorImplTest.java | 5 -
.../core/conf/AccumuloConfigurationTest.java | 48 ++++
.../accumulo/fate/zookeeper/ZooCache.java | 7 -
.../accumulo/fate/zookeeper/ZooReader.java | 12 -
.../accumulo/server/client/HdfsZooInstance.java | 6 -
.../main/resources/docs/examples/README.dirlist | 2 +-
15 files changed, 209 insertions(+), 255 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/e2e7d2e5/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
index b3b82d3,8685d43..9ffe065
--- a/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
@@@ -153,27 -101,32 +153,40 @@@ public abstract class AccumuloConfigura
return getMemoryInBytes(memString);
}
+ /**
+ * Interprets a string specifying a memory size. A memory size is specified
+ * as a long integer followed by an optional B (bytes), K (KB), M (MB), or
+ * G (GB).
+ *
+ * @param str string value
+ * @return interpreted memory size
+ */
static public long getMemoryInBytes(String str) {
int multiplier = 0;
- switch (str.charAt(str.length() - 1)) {
- case 'G':
- multiplier += 10;
- case 'M':
- multiplier += 10;
- case 'K':
- multiplier += 10;
- case 'B':
- return Long.parseLong(str.substring(0, str.length() - 1)) << multiplier;
- default:
- return Long.parseLong(str);
+ char lastChar = str.charAt(str.length() - 1);
+
+ if (lastChar == 'b') {
+ log.warn("The 'b' in " + str +
+ " is being considered as bytes. " +
+ "Setting memory by bits is not supported");
+ }
+ try {
+ switch (Character.toUpperCase(lastChar)) {
+ case 'G':
+ multiplier += 10;
+ case 'M':
+ multiplier += 10;
+ case 'K':
+ multiplier += 10;
+ case 'B':
+ return Long.parseLong(str.substring(0, str.length() - 1)) << multiplier;
+ default:
+ return Long.parseLong(str);
+ }
+ } 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'.");
}
}