You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2015/02/14 02:51:06 UTC
accumulo git commit: ACCUMULO-3586 Clean up build warnings
Repository: accumulo
Updated Branches:
refs/heads/master 47f5d4ed4 -> b889bb092
ACCUMULO-3586 Clean up build warnings
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b889bb09
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b889bb09
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b889bb09
Branch: refs/heads/master
Commit: b889bb0923073346c6fbf85da3d43add6af3edbd
Parents: 47f5d4e
Author: Christopher Tubbs <ct...@apache.org>
Authored: Thu Feb 12 20:56:15 2015 -0500
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Fri Feb 13 20:19:10 2015 -0500
----------------------------------------------------------------------
.../main/scripts/generate-example-configs.sh | 7 +-
.../lib/impl/DistributedCacheHelper.java | 7 +-
.../core/conf/AccumuloConfiguration.java | 46 +++++---
.../org/apache/accumulo/core/data/Mutation.java | 6 +-
.../file/blockfile/cache/LruBlockCache.java | 8 +-
.../core/iterators/AggregatingIterator.java | 18 +--
.../core/iterators/SortedMapIterator.java | 4 +-
.../conf/AggregatorConfiguration.java | 3 +-
.../aggregation/conf/AggregatorSet.java | 7 +-
.../iterators/user/TransformingIterator.java | 18 +--
.../core/security/VisibilityEvaluator.java | 2 +-
.../apache/accumulo/core/util/Classpath.java | 2 +-
.../accumulo/core/util/LocalityGroupUtil.java | 29 +++--
.../accumulo/core/util/PreAllocatedArray.java | 62 ++++++++++
.../core/conf/AccumuloConfigurationTest.java | 10 ++
.../file/blockfile/cache/TestLruBlockCache.java | 3 +-
.../core/iterators/AggregatingIteratorTest.java | 37 ++++--
.../conf/AggregatorConfigurationTest.java | 28 +++--
.../accumulo/core/util/PartitionerTest.java | 24 ++--
.../core/util/PreAllocatedArrayTest.java | 116 +++++++++++++++++++
examples/simple/pom.xml | 5 +
.../simple/filedata/ChunkCombinerTest.java | 4 +-
.../maven/plugin/AbstractAccumuloMojo.java | 4 +-
pom.xml | 31 +++--
.../accumulo/monitor/servlets/LogServlet.java | 14 +--
.../apache/accumulo/tserver/InMemoryMap.java | 37 ++++--
.../org/apache/accumulo/tserver/NativeMap.java | 15 ++-
.../java/org/apache/accumulo/start/Main.java | 2 +-
.../accumulo/test/continuous/TimeBinner.java | 68 ++++++-----
.../randomwalk/security/AlterSystemPerm.java | 1 +
.../server/security/SystemCredentialsIT.java | 2 +
.../org/apache/accumulo/test/NamespacesIT.java | 55 +++++++++
.../apache/accumulo/trace/instrument/Trace.java | 4 +-
33 files changed, 494 insertions(+), 185 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/assemble/src/main/scripts/generate-example-configs.sh
----------------------------------------------------------------------
diff --git a/assemble/src/main/scripts/generate-example-configs.sh b/assemble/src/main/scripts/generate-example-configs.sh
index 16c9f4f..606a0ac 100755
--- a/assemble/src/main/scripts/generate-example-configs.sh
+++ b/assemble/src/main/scripts/generate-example-configs.sh
@@ -17,9 +17,12 @@
# This script will regenerate the example configuration files for the tarball
+out=target/bootstrap-config.out
+
+echo 'Generating example scripts...' > $out
for s in 1GB 2GB 3GB 512MB
do
- bin/bootstrap_config.sh -o -d target/example-configs/$s/standalone -s $s -j -v 2
- bin/bootstrap_config.sh -o -d target/example-configs/$s/native-standalone -s $s -n -v 2
+ bin/bootstrap_config.sh -o -d target/example-configs/$s/standalone -s $s -j -v 2 &>> $out
+ bin/bootstrap_config.sh -o -d target/example-configs/$s/native-standalone -s $s -n -v 2 &>> $out
done
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/DistributedCacheHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/DistributedCacheHelper.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/DistributedCacheHelper.java
index c694b9a..a5e603b 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/DistributedCacheHelper.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/DistributedCacheHelper.java
@@ -20,7 +20,6 @@ import java.io.IOException;
import java.net.URI;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.filecache.DistributedCache;
import org.apache.hadoop.fs.Path;
/**
@@ -33,20 +32,20 @@ public class DistributedCacheHelper {
* @since 1.6.0
*/
public static void addCacheFile(URI uri, Configuration conf) {
- DistributedCache.addCacheFile(uri, conf);
+ org.apache.hadoop.filecache.DistributedCache.addCacheFile(uri, conf);
}
/**
* @since 1.6.0
*/
public static URI[] getCacheFiles(Configuration conf) throws IOException {
- return DistributedCache.getCacheFiles(conf);
+ return org.apache.hadoop.filecache.DistributedCache.getCacheFiles(conf);
}
/**
* @since 1.6.0
*/
public static Path[] getLocalCacheFiles(Configuration conf) throws IOException {
- return DistributedCache.getLocalCacheFiles(conf);
+ return org.apache.hadoop.filecache.DistributedCache.getLocalCacheFiles(conf);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java b/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
index cb075a9..90cf8e6 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
@@ -21,6 +21,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
@@ -167,25 +168,30 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str
* @return interpreted memory size
*/
static public long getMemoryInBytes(String str) {
- int multiplier = 0;
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 {
+ int multiplier;
switch (Character.toUpperCase(lastChar)) {
case 'G':
- multiplier += 10;
+ multiplier = 30;
+ break;
case 'M':
- multiplier += 10;
+ multiplier = 20;
+ break;
case 'K':
- multiplier += 10;
+ multiplier = 10;
+ break;
case 'B':
- return Long.parseLong(str.substring(0, str.length() - 1)) << multiplier;
+ multiplier = 0;
+ break;
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'.");
@@ -216,24 +222,32 @@ public abstract class AccumuloConfiguration implements Iterable<Entry<String,Str
* string value
* @return interpreted time duration in milliseconds
*/
- static public long getTimeInMillis(String str) {
- int multiplier = 1;
+ public static long getTimeInMillis(String str) {
+ TimeUnit timeUnit;
+ int unitsLen = 1;
switch (str.charAt(str.length() - 1)) {
case 'd':
- multiplier *= 24;
+ timeUnit = TimeUnit.DAYS;
+ break;
case 'h':
- multiplier *= 60;
+ timeUnit = TimeUnit.HOURS;
+ break;
case 'm':
- multiplier *= 60;
+ timeUnit = TimeUnit.MINUTES;
+ break;
case 's':
- multiplier *= 1000;
- if (str.length() > 1 && str.endsWith("ms")) // millis
- // case
- return Long.parseLong(str.substring(0, str.length() - 2));
- return Long.parseLong(str.substring(0, str.length() - 1)) * multiplier;
+ timeUnit = TimeUnit.SECONDS;
+ if (str.endsWith("ms")) {
+ timeUnit = TimeUnit.MILLISECONDS;
+ unitsLen = 2;
+ }
+ break;
default:
- return Long.parseLong(str) * 1000;
+ timeUnit = TimeUnit.SECONDS;
+ unitsLen = 0;
+ break;
}
+ return timeUnit.toMillis(Long.parseLong(str.substring(0, str.length() - unitsLen)));
}
/**
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
index 6f7d433..4b1a812 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
@@ -922,9 +922,9 @@ public class Mutation implements Writable {
private void oldReadFields(byte first, DataInput in) throws IOException {
- byte b = (byte) in.readByte();
- byte c = (byte) in.readByte();
- byte d = (byte) in.readByte();
+ byte b = in.readByte();
+ byte c = in.readByte();
+ byte d = in.readByte();
int len = (((first & 0xff) << 24) | ((b & 0xff) << 16) | ((c & 0xff) << 8) | (d & 0xff));
row = new byte[len];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/LruBlockCache.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/LruBlockCache.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/LruBlockCache.java
index 6cab164..98c800e 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/LruBlockCache.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/LruBlockCache.java
@@ -247,6 +247,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
* @param inMemory
* if block is in-memory
*/
+ @Override
public CacheEntry cacheBlock(String blockName, byte buf[], boolean inMemory) {
CachedBlock cb = map.get(blockName);
if (cb != null) {
@@ -277,6 +278,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
* @param buf
* block buffer
*/
+ @Override
public CacheEntry cacheBlock(String blockName, byte buf[]) {
return cacheBlock(blockName, buf, false);
}
@@ -289,6 +291,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
* @return buffer of specified block name, or null if not in cache
*/
+ @Override
public CachedBlock getBlock(String blockName) {
CachedBlock cb = map.get(blockName);
if (cb == null) {
@@ -456,6 +459,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
*
* @return max size in bytes
*/
+ @Override
public long getMaxSize() {
return this.maxSize;
}
@@ -648,7 +652,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
}
public double evictedPerEviction() {
- return (float) ((float) getEvictedCount() / (float) getEvictionCount());
+ return (float) getEvictedCount() / (float) getEvictionCount();
}
}
@@ -656,6 +660,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
+ (5 * SizeConstants.SIZEOF_FLOAT) + SizeConstants.SIZEOF_BOOLEAN + ClassSize.OBJECT);
// HeapSize implementation
+ @Override
public long heapSize() {
return getCurrentSize();
}
@@ -687,6 +692,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
return (long) Math.floor(this.maxSize * this.memoryFactor * this.minFactor);
}
+ @Override
public void shutdown() {
this.scheduleThreadPool.shutdown();
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
index fd5525b..eb45fac 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
@@ -28,7 +28,6 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.PartialKey;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.aggregation.Aggregator;
import org.apache.accumulo.core.iterators.conf.ColumnToClassMapping;
import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
import org.apache.log4j.Logger;
@@ -43,7 +42,7 @@ import org.apache.log4j.Logger;
public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>, OptionDescriber {
private SortedKeyValueIterator<Key,Value> iterator;
- private ColumnToClassMapping<Aggregator> aggregators;
+ private ColumnToClassMapping<org.apache.accumulo.core.iterators.aggregation.Aggregator> aggregators;
private Key workKey = new Key();
@@ -52,6 +51,7 @@ public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>, O
// private boolean propogateDeletes;
private static final Logger log = Logger.getLogger(AggregatingIterator.class);
+ @Override
public AggregatingIterator deepCopy(IteratorEnvironment env) {
return new AggregatingIterator(this, env);
}
@@ -63,7 +63,7 @@ public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>, O
public AggregatingIterator() {}
- private void aggregateRowColumn(Aggregator aggr) throws IOException {
+ private void aggregateRowColumn(org.apache.accumulo.core.iterators.aggregation.Aggregator aggr) throws IOException {
// this function assumes that first value is not delete
if (iterator.getTopKey().isDeleted())
@@ -91,14 +91,15 @@ public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>, O
private void findTop() throws IOException {
// check if aggregation is needed
if (iterator.hasTop()) {
- Aggregator aggr = aggregators.getObject(iterator.getTopKey());
+ org.apache.accumulo.core.iterators.aggregation.Aggregator aggr = aggregators.getObject(iterator.getTopKey());
if (aggr != null) {
aggregateRowColumn(aggr);
}
}
}
- public AggregatingIterator(SortedKeyValueIterator<Key,Value> iterator, ColumnToClassMapping<Aggregator> aggregators) throws IOException {
+ public AggregatingIterator(SortedKeyValueIterator<Key,Value> iterator,
+ ColumnToClassMapping<org.apache.accumulo.core.iterators.aggregation.Aggregator> aggregators) throws IOException {
this.iterator = iterator;
this.aggregators = aggregators;
}
@@ -171,7 +172,8 @@ public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>, O
String context = null;
if (null != env)
context = env.getConfig().get(Property.TABLE_CLASSPATH);
- this.aggregators = new ColumnToClassMapping<Aggregator>(options, Aggregator.class, context);
+ this.aggregators = new ColumnToClassMapping<org.apache.accumulo.core.iterators.aggregation.Aggregator>(options,
+ org.apache.accumulo.core.iterators.aggregation.Aggregator.class, context);
} catch (ClassNotFoundException e) {
log.error(e.toString());
throw new IllegalArgumentException(e);
@@ -196,9 +198,9 @@ public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>, O
String classname = entry.getValue();
if (classname == null)
throw new IllegalArgumentException("classname null");
- Class<? extends Aggregator> clazz;
+ Class<? extends org.apache.accumulo.core.iterators.aggregation.Aggregator> clazz;
try {
- clazz = AccumuloVFSClassLoader.loadClass(classname, Aggregator.class);
+ clazz = AccumuloVFSClassLoader.loadClass(classname, org.apache.accumulo.core.iterators.aggregation.Aggregator.class);
clazz.newInstance();
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("class not found: " + classname);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/iterators/SortedMapIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/SortedMapIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/SortedMapIterator.java
index cf385a9..3999b6f 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/SortedMapIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/SortedMapIterator.java
@@ -51,6 +51,7 @@ public class SortedMapIterator implements InterruptibleIterator {
private AtomicBoolean interruptFlag;
private int interruptCheckCount = 0;
+ @Override
public SortedMapIterator deepCopy(IteratorEnvironment env) {
return new SortedMapIterator(map, interruptFlag);
}
@@ -94,7 +95,7 @@ public class SortedMapIterator implements InterruptibleIterator {
if (iter.hasNext()) {
entry = iter.next();
- if (range.afterEndKey((Key) entry.getKey())) {
+ if (range.afterEndKey(entry.getKey())) {
entry = null;
}
} else
@@ -129,6 +130,7 @@ public class SortedMapIterator implements InterruptibleIterator {
}
}
+ @Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfiguration.java b/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfiguration.java
index 41c0374..3432cf5 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfiguration.java
@@ -16,14 +16,13 @@
*/
package org.apache.accumulo.core.iterators.aggregation.conf;
-import org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig;
import org.apache.hadoop.io.Text;
/**
* @deprecated since 1.4
*/
@Deprecated
-public class AggregatorConfiguration extends PerColumnIteratorConfig {
+public class AggregatorConfiguration extends org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig {
public AggregatorConfiguration(Text columnFamily, String aggClassName) {
super(columnFamily, aggClassName);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorSet.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorSet.java b/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorSet.java
index c874cc8..d6545ac 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorSet.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorSet.java
@@ -20,23 +20,22 @@ import java.io.IOException;
import java.util.Map;
import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.iterators.aggregation.Aggregator;
import org.apache.accumulo.core.iterators.conf.ColumnToClassMapping;
/**
* @deprecated since 1.4
*/
@Deprecated
-public class AggregatorSet extends ColumnToClassMapping<Aggregator> {
+public class AggregatorSet extends ColumnToClassMapping<org.apache.accumulo.core.iterators.aggregation.Aggregator> {
public AggregatorSet(Map<String,String> opts) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
- super(opts, Aggregator.class);
+ super(opts, org.apache.accumulo.core.iterators.aggregation.Aggregator.class);
}
public AggregatorSet() {
super();
}
- public Aggregator getAggregator(Key k) {
+ public org.apache.accumulo.core.iterators.aggregation.Aggregator getAggregator(Key k) {
return getObject(k);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
index 9d6c290..ddb149a 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
@@ -482,25 +482,25 @@ abstract public class TransformingIterator extends WrappingIterator implements O
* @return {@code true} if anything after {@code part} is set on {@code key}, and {@code false} if not
*/
protected boolean isSetAfterPart(Key key, PartialKey part) {
- boolean isSet = false;
if (key != null) {
- // Breaks excluded on purpose.
switch (part) {
case ROW:
- isSet = isSet || key.getColumnFamilyData().length() > 0;
+ return key.getColumnFamilyData().length() > 0 || key.getColumnQualifierData().length() > 0 || key.getColumnVisibilityData().length() > 0
+ || key.getTimestamp() < Long.MAX_VALUE || key.isDeleted();
case ROW_COLFAM:
- isSet = isSet || key.getColumnQualifierData().length() > 0;
+ return key.getColumnQualifierData().length() > 0 || key.getColumnVisibilityData().length() > 0 || key.getTimestamp() < Long.MAX_VALUE
+ || key.isDeleted();
case ROW_COLFAM_COLQUAL:
- isSet = isSet || key.getColumnVisibilityData().length() > 0;
+ return key.getColumnVisibilityData().length() > 0 || key.getTimestamp() < Long.MAX_VALUE || key.isDeleted();
case ROW_COLFAM_COLQUAL_COLVIS:
- isSet = isSet || key.getTimestamp() < Long.MAX_VALUE;
+ return key.getTimestamp() < Long.MAX_VALUE || key.isDeleted();
case ROW_COLFAM_COLQUAL_COLVIS_TIME:
- isSet = isSet || key.isDeleted();
+ return key.isDeleted();
case ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL:
- break;
+ return false;
}
}
- return isSet;
+ return false;
}
/**
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/security/VisibilityEvaluator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/VisibilityEvaluator.java b/core/src/main/java/org/apache/accumulo/core/security/VisibilityEvaluator.java
index 8535731..dd07619 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/VisibilityEvaluator.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/VisibilityEvaluator.java
@@ -97,7 +97,7 @@ public class VisibilityEvaluator {
* authorizations object
*/
public VisibilityEvaluator(Authorizations authorizations) {
- this.auths = escape((Authorizations) authorizations);
+ this.auths = escape(authorizations);
}
/**
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/util/Classpath.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/Classpath.java b/core/src/main/java/org/apache/accumulo/core/util/Classpath.java
index 242ca52..b2a6248 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/Classpath.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/Classpath.java
@@ -30,6 +30,6 @@ public class Classpath implements KeywordExecutable {
@Override
public void execute(final String[] args) throws Exception {
- Main.getVFSClassLoader().getMethod("printClassPath", new Class[0]).invoke(Main.getVFSClassLoader(), new Object[0]);
+ Main.getVFSClassLoader().getMethod("printClassPath").invoke(Main.getVFSClassLoader());
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java b/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
index d590ecd..a4936cf 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
@@ -229,33 +229,32 @@ public class LocalityGroupUtil {
public static class Partitioner {
private Map<ByteSequence,Integer> colfamToLgidMap;
- private Map<ByteSequence,MutableLong>[] groups;
+ private PreAllocatedArray<Map<ByteSequence,MutableLong>> groups;
- public Partitioner(Map<ByteSequence,MutableLong> groups[]) {
+ public Partitioner(PreAllocatedArray<Map<ByteSequence,MutableLong>> groups) {
this.groups = groups;
this.colfamToLgidMap = new HashMap<ByteSequence,Integer>();
for (int i = 0; i < groups.length; i++) {
- for (ByteSequence cf : groups[i].keySet()) {
+ for (ByteSequence cf : groups.get(i).keySet()) {
colfamToLgidMap.put(cf, i);
}
}
}
- public void partition(List<Mutation> mutations, List<Mutation> partitionedMutations[]) {
+ public void partition(List<Mutation> mutations, PreAllocatedArray<List<Mutation>> partitionedMutations) {
MutableByteSequence mbs = new MutableByteSequence(new byte[0], 0, 0);
- @SuppressWarnings("unchecked")
- List<ColumnUpdate> parts[] = new List[groups.length + 1];
+ PreAllocatedArray<List<ColumnUpdate>> parts = new PreAllocatedArray<>(groups.length + 1);
for (Mutation mutation : mutations) {
if (mutation.getUpdates().size() == 1) {
int lgid = getLgid(mbs, mutation.getUpdates().get(0));
- partitionedMutations[lgid].add(mutation);
+ partitionedMutations.get(lgid).add(mutation);
} else {
for (int i = 0; i < parts.length; i++) {
- parts[i] = null;
+ parts.set(i, null);
}
int lgcount = 0;
@@ -263,24 +262,24 @@ public class LocalityGroupUtil {
for (ColumnUpdate cu : mutation.getUpdates()) {
int lgid = getLgid(mbs, cu);
- if (parts[lgid] == null) {
- parts[lgid] = new ArrayList<ColumnUpdate>();
+ if (parts.get(lgid) == null) {
+ parts.set(lgid, new ArrayList<ColumnUpdate>());
lgcount++;
}
- parts[lgid].add(cu);
+ parts.get(lgid).add(cu);
}
if (lgcount == 1) {
for (int i = 0; i < parts.length; i++)
- if (parts[i] != null) {
- partitionedMutations[i].add(mutation);
+ if (parts.get(i) != null) {
+ partitionedMutations.get(i).add(mutation);
break;
}
} else {
for (int i = 0; i < parts.length; i++)
- if (parts[i] != null)
- partitionedMutations[i].add(new PartitionedMutation(mutation.getRow(), parts[i]));
+ if (parts.get(i) != null)
+ partitionedMutations.get(i).add(new PartitionedMutation(mutation.getRow(), parts.get(i)));
}
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/main/java/org/apache/accumulo/core/util/PreAllocatedArray.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/PreAllocatedArray.java b/core/src/main/java/org/apache/accumulo/core/util/PreAllocatedArray.java
new file mode 100644
index 0000000..25d814a
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/util/PreAllocatedArray.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.google.common.collect.Iterators;
+
+/**
+ * An {@link ArrayList} implementation that represents a type-safe pre-allocated array. This should be used exactly like an array, but helps avoid type-safety
+ * issues when mixing arrays with generics. The iterator is unmodifiable.
+ */
+public class PreAllocatedArray<T> implements Iterable<T> {
+
+ private final ArrayList<T> internal;
+ public final int length;
+
+ /**
+ * Creates an instance of the given capacity, with all elements initialized to null
+ */
+ public PreAllocatedArray(final int capacity) {
+ length = capacity;
+ internal = new ArrayList<>(capacity);
+ for (int i = 0; i < capacity; i++) {
+ internal.add(null);
+ }
+ }
+
+ /**
+ * Set the element at the specified index, and return the old value.
+ */
+ public T set(final int index, final T element) {
+ return internal.set(index, element);
+ }
+
+ /**
+ * Get the item stored at the specified index.
+ */
+ public T get(final int index) {
+ return internal.get(index);
+ }
+
+ @Override
+ public Iterator<T> iterator() {
+ return Iterators.unmodifiableIterator(internal.iterator());
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
index c8d17f5..0f0e5fc 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
@@ -36,6 +36,16 @@ public class AccumuloConfigurationTest {
}
+ @Test
+ public void testGetTimeInMillis() {
+ assertEquals(42L * 24 * 60 * 60 * 1000, AccumuloConfiguration.getTimeInMillis("42d"));
+ assertEquals(42L * 60 * 60 * 1000, AccumuloConfiguration.getTimeInMillis("42h"));
+ assertEquals(42L * 60 * 1000, AccumuloConfiguration.getTimeInMillis("42m"));
+ assertEquals(42L * 1000, AccumuloConfiguration.getTimeInMillis("42s"));
+ assertEquals(42L * 1000, AccumuloConfiguration.getTimeInMillis("42"));
+ assertEquals(42L, AccumuloConfiguration.getTimeInMillis("42ms"));
+ }
+
@Test(expected = IllegalArgumentException.class)
public void testGetMemoryInBytesFailureCases1() throws Exception {
AccumuloConfiguration.getMemoryInBytes("42x");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
index 88d61ac..a41d1ad 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
@@ -462,7 +462,7 @@ public class TestLruBlockCache extends TestCase {
int numEntries = (int) Math.ceil((1.2) * maxSize / roughBlockSize);
long totalOverhead = LruBlockCache.CACHE_FIXED_OVERHEAD + ClassSize.CONCURRENT_HASHMAP + (numEntries * ClassSize.CONCURRENT_HASHMAP_ENTRY)
+ (LruBlockCache.DEFAULT_CONCURRENCY_LEVEL * ClassSize.CONCURRENT_HASHMAP_SEGMENT);
- long negateBlockSize = (long) (totalOverhead / numEntries);
+ long negateBlockSize = totalOverhead / numEntries;
negateBlockSize += CachedBlock.PER_BLOCK_OVERHEAD;
return ClassSize.align((long) Math.floor((roughBlockSize - negateBlockSize) * 0.99f));
}
@@ -486,6 +486,7 @@ public class TestLruBlockCache extends TestCase {
this.buf = new byte[size];
}
+ @Override
public long heapSize() {
return CachedBlock.PER_BLOCK_OVERHEAD + ClassSize.align(blockName.length()) + ClassSize.align(buf.length);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/test/java/org/apache/accumulo/core/iterators/AggregatingIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/AggregatingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/AggregatingIteratorTest.java
index 788366a..e39d0d5 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/AggregatingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/AggregatingIteratorTest.java
@@ -16,6 +16,10 @@
*/
package org.apache.accumulo.core.iterators;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -25,38 +29,39 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
-import junit.framework.TestCase;
-
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.aggregation.Aggregator;
import org.apache.accumulo.core.iterators.system.MultiIterator;
import org.apache.hadoop.io.Text;
+import org.junit.Test;
-/**
- * @deprecated since 1.4
- */
-@Deprecated
-public class AggregatingIteratorTest extends TestCase {
+public class AggregatingIteratorTest {
private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<ByteSequence>();
- public static class SummationAggregator implements Aggregator {
+ /**
+ * @deprecated since 1.4; visible only for testing
+ */
+ @Deprecated
+ public static class SummationAggregator implements org.apache.accumulo.core.iterators.aggregation.Aggregator {
int sum;
+ @Override
public Value aggregate() {
return new Value((sum + "").getBytes());
}
+ @Override
public void collect(Value value) {
int val = Integer.parseInt(value.toString());
sum += val;
}
+ @Override
public void reset() {
sum = 0;
@@ -92,6 +97,8 @@ public class AggregatingIteratorTest extends TestCase {
return new Text(String.format("r%03d", row));
}
+ @SuppressWarnings("deprecation")
+ @Test
public void test1() throws IOException {
TreeMap<Key,Value> tm1 = new TreeMap<Key,Value>();
@@ -152,6 +159,8 @@ public class AggregatingIteratorTest extends TestCase {
}
+ @SuppressWarnings("deprecation")
+ @Test
public void test2() throws IOException {
TreeMap<Key,Value> tm1 = new TreeMap<Key,Value>();
@@ -211,6 +220,8 @@ public class AggregatingIteratorTest extends TestCase {
assertFalse(ai.hasTop());
}
+ @SuppressWarnings("deprecation")
+ @Test
public void test3() throws IOException {
TreeMap<Key,Value> tm1 = new TreeMap<Key,Value>();
@@ -275,6 +286,8 @@ public class AggregatingIteratorTest extends TestCase {
}
+ @SuppressWarnings("deprecation")
+ @Test
public void test4() throws IOException {
TreeMap<Key,Value> tm1 = new TreeMap<Key,Value>();
@@ -348,6 +361,8 @@ public class AggregatingIteratorTest extends TestCase {
}
+ @SuppressWarnings("deprecation")
+ @Test
public void test5() throws IOException {
// try aggregating across multiple data sets that contain
// the exact same keys w/ different values
@@ -379,6 +394,8 @@ public class AggregatingIteratorTest extends TestCase {
assertEquals("9", ai.getTopValue().toString());
}
+ @SuppressWarnings("deprecation")
+ @Test
public void test6() throws IOException {
TreeMap<Key,Value> tm1 = new TreeMap<Key,Value>();
@@ -403,6 +420,8 @@ public class AggregatingIteratorTest extends TestCase {
}
+ @SuppressWarnings("deprecation")
+ @Test
public void test7() throws IOException {
// test that delete is not aggregated
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfigurationTest.java
index 1a285bc..61693ab 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfigurationTest.java
@@ -16,16 +16,15 @@
*/
package org.apache.accumulo.core.iterators.aggregation.conf;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
-import org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig;
import org.apache.hadoop.io.Text;
+import org.junit.Test;
-/**
- * @deprecated since 1.4
- */
-@Deprecated
-public class AggregatorConfigurationTest extends TestCase {
+public class AggregatorConfigurationTest {
+
+ @Test
public void testBinary() {
Text colf = new Text();
Text colq = new Text();
@@ -39,25 +38,32 @@ public class AggregatorConfigurationTest extends TestCase {
runTest(colf);
}
+ @Test
public void testBasic() {
runTest(new Text("colf1"), new Text("cq2"));
runTest(new Text("colf1"));
}
+ @SuppressWarnings("deprecation")
private void runTest(Text colf) {
String encodedCols;
- PerColumnIteratorConfig ac3 = new PerColumnIteratorConfig(colf, "com.foo.SuperAgg");
+ org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig ac3 = new org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig(colf,
+ "com.foo.SuperAgg");
encodedCols = ac3.encodeColumns();
- PerColumnIteratorConfig ac4 = PerColumnIteratorConfig.decodeColumns(encodedCols, "com.foo.SuperAgg");
+ org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig ac4 = org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig.decodeColumns(
+ encodedCols, "com.foo.SuperAgg");
assertEquals(colf, ac4.getColumnFamily());
assertNull(ac4.getColumnQualifier());
}
+ @SuppressWarnings("deprecation")
private void runTest(Text colf, Text colq) {
- PerColumnIteratorConfig ac = new PerColumnIteratorConfig(colf, colq, "com.foo.SuperAgg");
+ org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig ac = new org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig(colf, colq,
+ "com.foo.SuperAgg");
String encodedCols = ac.encodeColumns();
- PerColumnIteratorConfig ac2 = PerColumnIteratorConfig.decodeColumns(encodedCols, "com.foo.SuperAgg");
+ org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig ac2 = org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig.decodeColumns(
+ encodedCols, "com.foo.SuperAgg");
assertEquals(colf, ac2.getColumnFamily());
assertEquals(colq, ac2.getColumnQualifier());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java b/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
index c4538ab..8ab2beb 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
@@ -38,15 +38,14 @@ public class PartitionerTest {
@Test
public void test1() {
- @SuppressWarnings("unchecked")
- Map<ByteSequence,MutableLong>[] groups = new Map[2];
+ PreAllocatedArray<Map<ByteSequence,MutableLong>> groups = new PreAllocatedArray<>(2);
- groups[0] = new HashMap<ByteSequence,MutableLong>();
- groups[0].put(new ArrayByteSequence("cf1"), new MutableLong(1));
- groups[0].put(new ArrayByteSequence("cf2"), new MutableLong(1));
+ groups.set(0, new HashMap<ByteSequence,MutableLong>());
+ groups.get(0).put(new ArrayByteSequence("cf1"), new MutableLong(1));
+ groups.get(0).put(new ArrayByteSequence("cf2"), new MutableLong(1));
- groups[1] = new HashMap<ByteSequence,MutableLong>();
- groups[1].put(new ArrayByteSequence("cf3"), new MutableLong(1));
+ groups.set(1, new HashMap<ByteSequence,MutableLong>());
+ groups.get(1).put(new ArrayByteSequence("cf3"), new MutableLong(1));
Partitioner p1 = new Partitioner(groups);
@@ -70,11 +69,10 @@ public class PartitionerTest {
m5.put("cf5", "cq3", "v9");
List<Mutation> mutations = Arrays.asList(m1, m2, m3, m4, m5);
- @SuppressWarnings("unchecked")
- List<Mutation>[] partitioned = new List[3];
+ PreAllocatedArray<List<Mutation>> partitioned = new PreAllocatedArray<>(3);
for (int i = 0; i < partitioned.length; i++) {
- partitioned[i] = new ArrayList<Mutation>();
+ partitioned.set(i, new ArrayList<Mutation>());
}
p1.partition(mutations, partitioned);
@@ -92,7 +90,7 @@ public class PartitionerTest {
m4 = new Mutation("r4");
m4.put("cf1", "cq1", "v6");
- Assert.assertEquals(toKeySet(m1, m2, m3, m4), toKeySet(partitioned[0]));
+ Assert.assertEquals(toKeySet(m1, m2, m3, m4), toKeySet(partitioned.get(0)));
m3 = new Mutation("r3");
m3.put("cf3", "cq2", "v5");
@@ -100,12 +98,12 @@ public class PartitionerTest {
m4 = new Mutation("r4");
m4.put("cf3", "cq2", "v7");
- Assert.assertEquals(toKeySet(m3, m4), toKeySet(partitioned[1]));
+ Assert.assertEquals(toKeySet(m3, m4), toKeySet(partitioned.get(1)));
m4 = new Mutation("r4");
m4.put("cf5", "cq3", "v8");
- Assert.assertEquals(toKeySet(m4, m5), toKeySet(partitioned[2]));
+ Assert.assertEquals(toKeySet(m4, m5), toKeySet(partitioned.get(2)));
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/core/src/test/java/org/apache/accumulo/core/util/PreAllocatedArrayTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/util/PreAllocatedArrayTest.java b/core/src/test/java/org/apache/accumulo/core/util/PreAllocatedArrayTest.java
new file mode 100644
index 0000000..b1fffcb
--- /dev/null
+++ b/core/src/test/java/org/apache/accumulo/core/util/PreAllocatedArrayTest.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
+import java.util.Iterator;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class PreAllocatedArrayTest {
+
+ @Rule
+ public ExpectedException exception = ExpectedException.none();
+
+ /**
+ * Test method for {@link org.apache.accumulo.core.util.PreAllocatedArray#PreAllocatedArray(int)}.
+ */
+ @Test
+ public void testPreAllocatedArray() {
+ PreAllocatedArray<String> strings = new PreAllocatedArray<>(5);
+ assertEquals(5, strings.length);
+
+ strings = new PreAllocatedArray<>(3);
+ assertEquals(3, strings.length);
+
+ strings = new PreAllocatedArray<>(0);
+ assertEquals(0, strings.length);
+ }
+
+ @Test
+ public void testPreAllocatedArray_Fail() {
+ exception.expect(IllegalArgumentException.class);
+ new PreAllocatedArray<String>(-5);
+ }
+
+ /**
+ * Test method for {@link org.apache.accumulo.core.util.PreAllocatedArray#set(int, java.lang.Object)}.<br>
+ * Test method for {@link org.apache.accumulo.core.util.PreAllocatedArray#get(int)}.<br>
+ * Test method for {@link org.apache.accumulo.core.util.PreAllocatedArray#iterator()}.
+ */
+ @Test
+ public void testSet() {
+ int capacity = 5;
+ PreAllocatedArray<String> strings = new PreAllocatedArray<>(capacity);
+ assertEquals(capacity, strings.length);
+
+ // everything else should be null
+ strings.set(1, "a");
+ strings.set(4, "b");
+ assertEquals(capacity, strings.length);
+
+ // overwrite
+ String b = strings.set(4, "c");
+ assertEquals("b", b);
+ assertEquals(capacity, strings.length);
+
+ Iterator<String> iter = strings.iterator();
+ assertNull(iter.next()); // index 0
+ assertEquals("a", iter.next()); // index 1
+ assertNull(iter.next()); // index 2
+ assertNull(iter.next()); // index 3
+ assertEquals("c", iter.next()); // index 4
+ assertFalse(iter.hasNext()); // index 5
+ }
+
+ @Test
+ public void testSetIndexHigh() {
+ PreAllocatedArray<String> strings = new PreAllocatedArray<>(3);
+ strings.set(2, "in bounds");
+ exception.expect(IndexOutOfBoundsException.class);
+ strings.set(3, "out of bounds");
+ }
+
+ @Test
+ public void testSetIndexNegative() {
+ PreAllocatedArray<String> strings = new PreAllocatedArray<>(3);
+ strings.set(0, "in bounds");
+ exception.expect(IndexOutOfBoundsException.class);
+ strings.set(-3, "out of bounds");
+ }
+
+ @Test
+ public void testGetIndexHigh() {
+ PreAllocatedArray<String> strings = new PreAllocatedArray<>(3);
+ strings.get(2);
+ exception.expect(IndexOutOfBoundsException.class);
+ strings.get(3);
+ }
+
+ @Test
+ public void testGetIndexNegative() {
+ PreAllocatedArray<String> strings = new PreAllocatedArray<>(3);
+ strings.get(0);
+ exception.expect(IndexOutOfBoundsException.class);
+ strings.get(-3);
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/examples/simple/pom.xml
----------------------------------------------------------------------
diff --git a/examples/simple/pom.xml b/examples/simple/pom.xml
index 95845de..649ff59 100644
--- a/examples/simple/pom.xml
+++ b/examples/simple/pom.xml
@@ -32,6 +32,11 @@
<artifactId>jcommander</artifactId>
</dependency>
<dependency>
+ <groupId>com.google.auto.service</groupId>
+ <artifactId>auto-service</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkCombinerTest.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkCombinerTest.java b/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkCombinerTest.java
index 6d1467a..9efd68b 100644
--- a/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkCombinerTest.java
+++ b/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkCombinerTest.java
@@ -45,6 +45,7 @@ public class ChunkCombinerTest extends TestCase {
private SortedMap<Key,Value> map;
private Range range;
+ @Override
public MapIterator deepCopy(IteratorEnvironment env) {
return new MapIterator(map);
}
@@ -83,7 +84,7 @@ public class ChunkCombinerTest extends TestCase {
entry = null;
continue;
}
- if (range.afterEndKey((Key) entry.getKey()))
+ if (range.afterEndKey(entry.getKey()))
entry = null;
break;
}
@@ -109,6 +110,7 @@ public class ChunkCombinerTest extends TestCase {
}
}
+ @Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/AbstractAccumuloMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/AbstractAccumuloMojo.java b/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/AbstractAccumuloMojo.java
index 5e6a905..46fdfbc 100644
--- a/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/AbstractAccumuloMojo.java
+++ b/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/AbstractAccumuloMojo.java
@@ -24,12 +24,12 @@ import java.util.Arrays;
import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
public abstract class AbstractAccumuloMojo extends AbstractMojo {
- @Component
+ @Parameter(defaultValue = "${project}", readonly = true)
private MavenProject project;
void configureMiniClasspath(MiniAccumuloConfigImpl macConfig, String miniClasspath) throws MalformedURLException {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ee04e24..1629757 100644
--- a/pom.xml
+++ b/pom.xml
@@ -534,7 +534,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.13</version>
+ <version>2.14</version>
</plugin>
<plugin>
<groupId>com.google.code.sortpom</groupId>
@@ -574,7 +574,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
- <version>2.9</version>
+ <version>2.11</version>
<configuration>
<issueManagementSystems>
<issueManagementSystem>JIRA</issueManagementSystem>
@@ -607,6 +607,7 @@
<showWarnings>true</showWarnings>
<compilerArgs>
<arg>-Xlint:all</arg>
+ <arg>-Xlint:-processing</arg>
<arg>-Xmaxwarns</arg>
<arg>5</arg>
</compilerArgs>
@@ -638,8 +639,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
- <!-- Work around MRELEASE-812 -->
- <version>2.5</version>
<configuration>
<arguments>-P apache-release,thrift,assemble,docs,sunny -Dtimeout.factor=2 -Dmavanagaiata.dirtyFlag=false</arguments>
<autoVersionSubmodules>true</autoVersionSubmodules>
@@ -681,12 +680,12 @@
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
- <version>0.1.4</version>
+ <version>1.5.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
- <version>1.8</version>
+ <version>1.9.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -708,7 +707,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
- <version>1.2.1</version>
+ <version>1.3.2</version>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
@@ -896,7 +895,7 @@
<!-- Allows us to get the apache-ds bundle artifacts -->
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>2.4.0</version>
+ <version>2.5.3</version>
</plugin>
</plugins>
</pluginManagement>
@@ -1020,7 +1019,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
- <version>6.1.1</version>
+ <version>6.3</version>
</dependency>
</dependencies>
<executions>
@@ -1122,7 +1121,7 @@
<!-- enable ssh deployment of site with maven 3 -->
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
- <version>2.6</version>
+ <version>2.8</version>
</extension>
</extensions>
</build>
@@ -1131,7 +1130,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
- <version>2.9</version>
+ <version>2.11</version>
<reportSets>
<reportSet>
<reports>
@@ -1143,7 +1142,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.9.1</version>
+ <version>2.10.1</version>
<reportSets>
<reportSet>
<reports>
@@ -1155,12 +1154,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
- <version>2.4</version>
+ <version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
- <version>3.1</version>
+ <version>3.4</version>
<configuration>
<excludes>
<exclude>**/thrift/*.java</exclude>
@@ -1173,7 +1172,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.7</version>
+ <version>2.8</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
@@ -1192,7 +1191,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
- <version>2.5.3</version>
+ <version>3.0.0</version>
<configuration>
<excludeFilterFile>contrib/findbugs-exclude.xml</excludeFilterFile>
<findbugsXmlOutput>true</findbugsXmlOutput>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/LogServlet.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/LogServlet.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/LogServlet.java
index 77f14de..7226476 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/LogServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/LogServlet.java
@@ -70,16 +70,10 @@ public class LogServlet extends BasicServlet {
StringBuilder text = new StringBuilder();
for (int i = 0; i < msg.length(); i++) {
char c = msg.charAt(i);
- switch (Character.getType(c)) {
- case Character.UNASSIGNED:
- case Character.LINE_SEPARATOR:
- case Character.NON_SPACING_MARK:
- case Character.PRIVATE_USE:
- c = '?';
- default:
- text.append(c);
- }
-
+ int type = Character.getType(c);
+ boolean notPrintable = type == Character.UNASSIGNED || type == Character.LINE_SEPARATOR || type == Character.NON_SPACING_MARK
+ || type == Character.PRIVATE_USE;
+ text.append(notPrintable ? '?' : c);
}
StringBuilder builder = new StringBuilder(text.toString());
if (ev.getThrowableStrRep() != null)
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
index 47936b6..8aa357b 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
@@ -63,6 +63,7 @@ import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.LocalityGroupUtil;
import org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
import org.apache.accumulo.core.util.LocalityGroupUtil.Partitioner;
+import org.apache.accumulo.core.util.PreAllocatedArray;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.commons.lang.mutable.MutableLong;
import org.apache.hadoop.conf.Configuration;
@@ -157,12 +158,14 @@ class MemKeyConversionIterator extends WrappingIterator implements Interruptible
}
+ @Override
public void next() throws IOException {
super.next();
if (hasTop())
getTopKeyVal();
}
+ @Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
super.seek(range, columnFamilies, inclusive);
@@ -241,19 +244,18 @@ public class InMemoryMap {
private static class LocalityGroupMap implements SimpleMap {
- private Map<ByteSequence,MutableLong> groupFams[];
+ private PreAllocatedArray<Map<ByteSequence,MutableLong>> groupFams;
// the last map in the array is the default locality group
private SimpleMap maps[];
private Partitioner partitioner;
- private List<Mutation>[] partitioned;
+ private PreAllocatedArray<List<Mutation>> partitioned;
private Set<ByteSequence> nonDefaultColumnFamilies;
- @SuppressWarnings("unchecked")
LocalityGroupMap(Map<String,Set<ByteSequence>> groups, boolean useNativeMap) {
- this.groupFams = new Map[groups.size()];
+ this.groupFams = new PreAllocatedArray<>(groups.size());
this.maps = new SimpleMap[groups.size() + 1];
- this.partitioned = new List[groups.size() + 1];
+ this.partitioned = new PreAllocatedArray<>(groups.size() + 1);
this.nonDefaultColumnFamilies = new HashSet<ByteSequence>();
for (int i = 0; i < maps.length; i++) {
@@ -265,14 +267,14 @@ public class InMemoryMap {
HashMap<ByteSequence,MutableLong> map = new HashMap<ByteSequence,MutableLong>();
for (ByteSequence bs : cfset)
map.put(bs, new MutableLong(1));
- this.groupFams[count++] = map;
+ this.groupFams.set(count++, map);
nonDefaultColumnFamilies.addAll(cfset);
}
partitioner = new LocalityGroupUtil.Partitioner(this.groupFams);
for (int i = 0; i < partitioned.length; i++) {
- partitioned[i] = new ArrayList<Mutation>();
+ partitioned.set(i, new ArrayList<Mutation>());
}
}
@@ -299,7 +301,7 @@ public class InMemoryMap {
LocalityGroup groups[] = new LocalityGroup[maps.length];
for (int i = 0; i < groups.length; i++) {
if (i < groupFams.length)
- groups[i] = new LocalityGroup(maps[i].skvIterator(), groupFams[i], false);
+ groups[i] = new LocalityGroup(maps[i].skvIterator(), groupFams.get(i), false);
else
groups[i] = new LocalityGroup(maps[i].skvIterator(), null, true);
}
@@ -331,9 +333,9 @@ public class InMemoryMap {
partitioner.partition(mutations, partitioned);
for (int i = 0; i < partitioned.length; i++) {
- if (partitioned[i].size() > 0) {
- maps[i].mutate(partitioned[i], kvCount);
- for (Mutation m : partitioned[i])
+ if (partitioned.get(i).size() > 0) {
+ maps[i].mutate(partitioned.get(i), kvCount);
+ for (Mutation m : partitioned.get(i))
kvCount += m.getUpdates().size();
}
}
@@ -360,20 +362,24 @@ public class InMemoryMap {
size.incrementAndGet();
}
+ @Override
public Value get(Key key) {
return map.get(key);
}
+ @Override
public Iterator<Entry<Key,Value>> iterator(Key startKey) {
Key lk = new Key(startKey);
SortedMap<Key,Value> tm = map.tailMap(lk);
return tm.entrySet().iterator();
}
+ @Override
public int size() {
return size.get();
}
+ @Override
public synchronized InterruptibleIterator skvIterator() {
if (map == null)
throw new IllegalStateException();
@@ -381,6 +387,7 @@ public class InMemoryMap {
return new SortedMapIterator(map);
}
+ @Override
public synchronized void delete() {
map = null;
}
@@ -420,26 +427,32 @@ public class InMemoryMap {
nativeMap = new NativeMap();
}
+ @Override
public Value get(Key key) {
return nativeMap.get(key);
}
+ @Override
public Iterator<Entry<Key,Value>> iterator(Key startKey) {
return nativeMap.iterator(startKey);
}
+ @Override
public int size() {
return nativeMap.size();
}
+ @Override
public InterruptibleIterator skvIterator() {
return (InterruptibleIterator) nativeMap.skvIterator();
}
+ @Override
public void delete() {
nativeMap.delete();
}
+ @Override
public long getMemoryUsed() {
return nativeMap.getMemoryUsed();
}
@@ -604,6 +617,7 @@ public class InMemoryMap {
private SourceSwitchingIterator ssi;
private MemoryDataSource mds;
+ @Override
protected SortedKeyValueIterator<Key,Value> getSource() {
if (closed.get())
throw new IllegalStateException("Memory iterator is closed");
@@ -619,6 +633,7 @@ public class InMemoryMap {
this.closed = closed;
}
+ @Override
public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
return new MemoryIterator(getSource().deepCopy(env), closed);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
index c2e45c3..2f44e13 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
@@ -44,6 +44,7 @@ import org.apache.accumulo.core.iterators.IterationInterruptedException;
import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iterators.system.InterruptibleIterator;
+import org.apache.accumulo.core.util.PreAllocatedArray;
import org.apache.log4j.Logger;
/**
@@ -264,7 +265,7 @@ public class NativeMap implements Iterable<Map.Entry<Key,Value>> {
private NMIterator source;
- private Entry<Key,Value> nextEntries[];
+ private PreAllocatedArray<Entry<Key,Value>> nextEntries;
private int index;
private int end;
@@ -272,10 +273,9 @@ public class NativeMap implements Iterable<Map.Entry<Key,Value>> {
this(new MemKey());
}
- @SuppressWarnings("unchecked")
ConcurrentIterator(Key key) {
// start off with a small read ahead
- nextEntries = new Entry[1];
+ nextEntries = new PreAllocatedArray<>(1);
rlock.lock();
try {
@@ -287,7 +287,6 @@ public class NativeMap implements Iterable<Map.Entry<Key,Value>> {
}
// it is assumed the read lock is held when this method is called
- @SuppressWarnings("unchecked")
private void fill() {
end = 0;
index = 0;
@@ -299,11 +298,11 @@ public class NativeMap implements Iterable<Map.Entry<Key,Value>> {
// as we keep filling, increase the read ahead buffer
if (nextEntries.length < MAX_READ_AHEAD_ENTRIES)
- nextEntries = new Entry[Math.min(nextEntries.length * 2, MAX_READ_AHEAD_ENTRIES)];
+ nextEntries = new PreAllocatedArray<>(Math.min(nextEntries.length * 2, MAX_READ_AHEAD_ENTRIES));
while (source.hasNext() && end < nextEntries.length) {
Entry<Key,Value> ne = source.next();
- nextEntries[end++] = ne;
+ nextEntries.set(end++, ne);
amountRead += ne.getKey().getSize() + ne.getValue().getSize();
if (amountRead > READ_AHEAD_BYTES)
@@ -322,7 +321,7 @@ public class NativeMap implements Iterable<Map.Entry<Key,Value>> {
throw new NoSuchElementException();
}
- Entry<Key,Value> ret = nextEntries[index++];
+ Entry<Key,Value> ret = nextEntries.get(index++);
if (index == end) {
rlock.lock();
@@ -332,7 +331,7 @@ public class NativeMap implements Iterable<Map.Entry<Key,Value>> {
source.delete();
source = new NMIterator(ret.getKey());
fill();
- if (0 < end && nextEntries[0].getKey().equals(ret.getKey())) {
+ if (0 < end && nextEntries.get(0).getKey().equals(ret.getKey())) {
index++;
if (index == end) {
fill();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/Main.java b/start/src/main/java/org/apache/accumulo/start/Main.java
index fa79196..880e52e 100644
--- a/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/start/src/main/java/org/apache/accumulo/start/Main.java
@@ -64,7 +64,7 @@ public class Main {
public static ClassLoader getClassLoader() {
if (classLoader == null) {
try {
- ClassLoader clTmp = (ClassLoader) getVFSClassLoader().getMethod("getClassLoader", new Class[0]).invoke(null, new Object[0]);
+ ClassLoader clTmp = (ClassLoader) getVFSClassLoader().getMethod("getClassLoader").invoke(null);
classLoader = clTmp;
} catch (ClassNotFoundException | IOException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
| SecurityException e) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java b/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java
index 186e8d0..cfe8551 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java
@@ -92,58 +92,46 @@ public class TimeBinner {
time = (time / opts.period) * opts.period;
- double data_min = data;
- double data_max = data;
-
switch (operation) {
case AMM_HACK1: {
- data_min = Double.parseDouble(tokens[opts.dataColumn - 2]);
- data_max = Double.parseDouble(tokens[opts.dataColumn - 1]);
- // fall through to AMM
+ double data_min = Double.parseDouble(tokens[opts.dataColumn - 2]);
+ double data_max = Double.parseDouble(tokens[opts.dataColumn - 1]);
+
+ updateMin(time, aggregation3, data, data_min);
+ updateMax(time, aggregation4, data, data_max);
+
+ increment(time, aggregation1, data);
+ increment(time, aggregation2, 1);
+ break;
}
case AMM: {
- DoubleWrapper mindw = get(time, aggregation3, Double.POSITIVE_INFINITY);
- if (data < mindw.d)
- mindw.d = data_min;
+ updateMin(time, aggregation3, data, data);
+ updateMax(time, aggregation4, data, data);
- DoubleWrapper maxdw = get(time, aggregation4, Double.NEGATIVE_INFINITY);
- if (data > maxdw.d)
- maxdw.d = data_max;
-
- // fall through to AVG
+ increment(time, aggregation1, data);
+ increment(time, aggregation2, 1);
+ break;
}
case AVG: {
- DoubleWrapper sumdw = get(time, aggregation1, 0);
- DoubleWrapper countdw = get(time, aggregation2, 0);
-
- sumdw.d += data;
- countdw.d++;
-
+ increment(time, aggregation1, data);
+ increment(time, aggregation2, 1);
break;
}
case MAX: {
- DoubleWrapper maxdw = get(time, aggregation1, Double.NEGATIVE_INFINITY);
- if (data > maxdw.d) {
- maxdw.d = data;
- }
+ updateMax(time, aggregation1, data, data);
break;
}
case MIN: {
- DoubleWrapper mindw = get(time, aggregation1, Double.POSITIVE_INFINITY);
- if (data < mindw.d) {
- mindw.d = data;
- }
+ updateMin(time, aggregation1, data, data);
break;
}
case COUNT: {
- DoubleWrapper countdw = get(time, aggregation1, 0);
- countdw.d++;
+ increment(time, aggregation1, 1);
break;
}
case SUM:
case CUMULATIVE: {
- DoubleWrapper sumdw = get(time, aggregation1, 0);
- sumdw.d += data;
+ increment(time, aggregation1, data);
break;
}
}
@@ -186,4 +174,20 @@ public class TimeBinner {
}
}
+
+ private static void increment(long time, HashMap<Long,DoubleWrapper> aggregation, double amount) {
+ get(time, aggregation, 0).d += amount;
+ }
+
+ private static void updateMax(long time, HashMap<Long,DoubleWrapper> aggregation, double data, double new_max) {
+ DoubleWrapper maxdw = get(time, aggregation, Double.NEGATIVE_INFINITY);
+ if (data > maxdw.d)
+ maxdw.d = new_max;
+ }
+
+ private static void updateMin(long time, HashMap<Long,DoubleWrapper> aggregation, double data, double new_min) {
+ DoubleWrapper mindw = get(time, aggregation, Double.POSITIVE_INFINITY);
+ if (data < mindw.d)
+ mindw.d = new_min;
+ }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterSystemPerm.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterSystemPerm.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterSystemPerm.java
index ba4d2e9..7927c60 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterSystemPerm.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterSystemPerm.java
@@ -85,6 +85,7 @@ public class AlterSystemPerm extends Test {
case GRANT_INVALID:
if (sysPerm.equals(SystemPermission.GRANT))
return;
+ throw new AccumuloException("Got GRANT_INVALID when not dealing with GRANT", ae);
case PERMISSION_DENIED:
throw new AccumuloException("Test user doesn't have root", ae);
case USER_DOESNT_EXIST:
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java b/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
index 216ac3e..9f00fcb 100644
--- a/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
+++ b/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
@@ -189,11 +189,13 @@ public class SystemCredentialsIT extends ConfigurableMacIT {
throw new UnsupportedOperationException();
}
+ @Deprecated
@Override
public AccumuloConfiguration getConfiguration() {
throw new UnsupportedOperationException();
}
+ @Deprecated
@Override
public void setConfiguration(AccumuloConfiguration conf) {
throw new UnsupportedOperationException();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
index c6b9b23..ab9eb0f 100644
--- a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
@@ -973,13 +973,16 @@ public class NamespacesIT extends AccumuloIT {
case 0:
ops.create(tableName);
fail();
+ break;
case 1:
ops.create("a");
ops.clone("a", tableName, true, Collections.<String,String> emptyMap(), Collections.<String> emptySet());
fail();
+ break;
case 2:
ops.importTable(tableName, System.getProperty("user.dir") + "/target");
fail();
+ break;
default:
// break out of infinite loop
assertEquals(3, i); // check test integrity
@@ -1001,12 +1004,15 @@ public class NamespacesIT extends AccumuloIT {
case 0:
ops.removeConstraint(tableName, 0);
fail();
+ break;
case 1:
ops.removeProperty(tableName, "a");
fail();
+ break;
case 2:
ops.setProperty(tableName, "a", "b");
fail();
+ break;
default:
// break out of infinite loop
assertEquals(3, i); // check test integrity
@@ -1028,90 +1034,119 @@ public class NamespacesIT extends AccumuloIT {
case 0:
ops.addConstraint(tableName, NumericValueConstraint.class.getName());
fail();
+ break;
case 1:
ops.addSplits(tableName, new TreeSet<Text>());
fail();
+ break;
case 2:
ops.attachIterator(tableName, setting);
fail();
+ break;
case 3:
ops.cancelCompaction(tableName);
fail();
+ break;
case 4:
ops.checkIteratorConflicts(tableName, setting, EnumSet.allOf(IteratorScope.class));
fail();
+ break;
case 5:
ops.clearLocatorCache(tableName);
fail();
+ break;
case 6:
ops.clone(tableName, "2", true, Collections.<String,String> emptyMap(), Collections.<String> emptySet());
fail();
+ break;
case 7:
ops.compact(tableName, a, z, true, true);
fail();
+ break;
case 8:
ops.delete(tableName);
fail();
+ break;
case 9:
ops.deleteRows(tableName, a, z);
fail();
+ break;
case 10:
ops.splitRangeByTablets(tableName, new Range(), 10);
fail();
+ break;
case 11:
ops.exportTable(tableName, namespace + "_dir");
fail();
+ break;
case 12:
ops.flush(tableName, a, z, true);
fail();
+ break;
case 13:
ops.getDiskUsage(Collections.singleton(tableName));
fail();
+ break;
case 14:
ops.getIteratorSetting(tableName, "a", IteratorScope.scan);
fail();
+ break;
case 15:
ops.getLocalityGroups(tableName);
fail();
+ break;
case 16:
ops.getMaxRow(tableName, Authorizations.EMPTY, a, true, z, true);
fail();
+ break;
case 17:
ops.getProperties(tableName);
fail();
+ break;
case 18:
ops.importDirectory(tableName, "", "", false);
fail();
+ break;
case 19:
ops.testClassLoad(tableName, VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName());
fail();
+ break;
case 20:
ops.listConstraints(tableName);
fail();
+ break;
case 21:
ops.listIterators(tableName);
fail();
+ break;
case 22:
ops.listSplits(tableName);
fail();
+ break;
case 23:
ops.merge(tableName, a, z);
fail();
+ break;
case 24:
ops.offline(tableName, true);
fail();
+ break;
case 25:
ops.online(tableName, true);
fail();
+ break;
case 26:
ops.removeIterator(tableName, "a", EnumSet.of(IteratorScope.scan));
fail();
+ break;
case 27:
ops.rename(tableName, tableName + "2");
fail();
+ break;
case 28:
ops.setLocalityGroups(tableName, Collections.<String,Set<Text>> emptyMap());
fail();
+ break;
default:
// break out of infinite loop
assertEquals(29, i); // check test integrity
@@ -1141,45 +1176,59 @@ public class NamespacesIT extends AccumuloIT {
case 0:
ops.addConstraint(namespace, NumericValueConstraint.class.getName());
fail();
+ break;
case 1:
ops.attachIterator(namespace, setting);
fail();
+ break;
case 2:
ops.checkIteratorConflicts(namespace, setting, EnumSet.of(IteratorScope.scan));
fail();
+ break;
case 3:
ops.delete(namespace);
fail();
+ break;
case 4:
ops.getIteratorSetting(namespace, "thing", IteratorScope.scan);
fail();
+ break;
case 5:
ops.getProperties(namespace);
fail();
+ break;
case 6:
ops.listConstraints(namespace);
fail();
+ break;
case 7:
ops.listIterators(namespace);
fail();
+ break;
case 8:
ops.removeConstraint(namespace, 1);
fail();
+ break;
case 9:
ops.removeIterator(namespace, "thing", EnumSet.allOf(IteratorScope.class));
fail();
+ break;
case 10:
ops.removeProperty(namespace, "a");
fail();
+ break;
case 11:
ops.rename(namespace, namespace + "2");
fail();
+ break;
case 12:
ops.setProperty(namespace, "k", "v");
fail();
+ break;
case 13:
ops.testClassLoad(namespace, VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName());
fail();
+ break;
default:
// break out of infinite loop
assertEquals(14, i); // check test integrity
@@ -1201,25 +1250,31 @@ public class NamespacesIT extends AccumuloIT {
ops.create(namespace + "0");
ops.create(namespace + "0"); // should fail here
fail();
+ break;
case 1:
ops.create(namespace + i + "_1");
ops.create(namespace + i + "_2");
ops.rename(namespace + i + "_1", namespace + i + "_2"); // should fail here
fail();
+ break;
case 2:
ops.create(Namespaces.DEFAULT_NAMESPACE);
fail();
+ break;
case 3:
ops.create(Namespaces.ACCUMULO_NAMESPACE);
fail();
+ break;
case 4:
ops.create(namespace + i + "_1");
ops.rename(namespace + i + "_1", Namespaces.DEFAULT_NAMESPACE); // should fail here
fail();
+ break;
case 5:
ops.create(namespace + i + "_1");
ops.rename(namespace + i + "_1", Namespaces.ACCUMULO_NAMESPACE); // should fail here
fail();
+ break;
default:
// break out of infinite loop
assertEquals(6, i); // check test integrity
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b889bb09/trace/src/main/java/org/apache/accumulo/trace/instrument/Trace.java
----------------------------------------------------------------------
diff --git a/trace/src/main/java/org/apache/accumulo/trace/instrument/Trace.java b/trace/src/main/java/org/apache/accumulo/trace/instrument/Trace.java
index a44512f..557d381 100644
--- a/trace/src/main/java/org/apache/accumulo/trace/instrument/Trace.java
+++ b/trace/src/main/java/org/apache/accumulo/trace/instrument/Trace.java
@@ -16,8 +16,6 @@
*/
package org.apache.accumulo.trace.instrument;
-import org.apache.accumulo.trace.thrift.TInfo;
-
/**
* @deprecated since 1.7, use {@link org.apache.accumulo.core.trace.Trace} instead
*/
@@ -53,7 +51,7 @@ public class Trace extends org.apache.accumulo.core.trace.Trace {
}
// Start a trace in the current thread from information passed via RPC
- public static Span trace(TInfo info, String description) {
+ public static Span trace(org.apache.accumulo.trace.thrift.TInfo info, String description) {
return new Span(org.apache.accumulo.core.trace.Trace.trace(info, description));
}