Author: ctubbsii
Date: Thu Jan 17 21:46:32 2013
New Revision: 1434928
URL: http://svn.apache.org/viewvc?rev=1434928&view=rev
Log:
ACCUMULO-973 Remove trivial warnings about imports, and added missing
hashCode() implementations for objects that override equals(), to be nice to
users.
ACCUMULO-971 Fix some malformed javadoc return tags, and errors linking to
hidden (protected) methods (I don't know why javadoc cares about these).
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/BatchWriterConfig.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/ColumnUpdate.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/KeyTransformingIterator.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InterpreterCommand.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java
accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/TStore.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityUtil.java
accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloConfig.java
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/BatchWriterConfig.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/BatchWriterConfig.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/BatchWriterConfig.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/BatchWriterConfig.java
Thu Jan 17 21:46:32 2013
@@ -31,9 +31,8 @@ public class BatchWriterConfig {
*
* @param maxMemory
* size in bytes of the maximum memory to batch before writing.
Defaults to 50M.
- * @return
*/
-
+
public BatchWriterConfig setMaxMemory(long maxMemory) {
this.maxMemory = maxMemory;
return this;
@@ -47,11 +46,11 @@ public class BatchWriterConfig {
* Determines how maxLatency will be interpreted.
* @return this to allow chaining of set methods
*/
-
+
public BatchWriterConfig setMaxLatency(long maxLatency, TimeUnit timeUnit) {
if (maxLatency < 0)
throw new IllegalArgumentException("Negative max latency not allowed " +
maxLatency);
-
+
if (maxLatency == 0)
this.maxLatency = Long.MAX_VALUE;
else
@@ -67,7 +66,7 @@ public class BatchWriterConfig {
* @param timeUnit
* @return this to allow chaining of set methods
*/
-
+
public BatchWriterConfig setTimeout(long timeout, TimeUnit timeUnit) {
if (timeout < 0)
throw new IllegalArgumentException("Negative timeout not allowed " +
timeout);
@@ -84,15 +83,15 @@ public class BatchWriterConfig {
* the maximum number of threads to use for writing data to the
tablet servers. Defaults to 3.
* @return this to allow chaining of set methods
*/
-
+
public BatchWriterConfig setMaxWriteThreads(int maxWriteThreads) {
if (maxWriteThreads <= 0)
throw new IllegalArgumentException("Max threads must be positive " +
maxWriteThreads);
-
+
this.maxWriteThreads = maxWriteThreads;
return this;
}
-
+
public long getMaxMemory() {
return maxMemory;
}
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
Thu Jan 17 21:46:32 2013
@@ -116,7 +116,6 @@ class OfflineIterator implements Iterato
private ArrayList<SortedKeyValueIterator<Key,Value>> readers;
/**
- * @param offlineScanner
* @param instance
* @param credentials
* @param authorizations
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
Thu Jan 17 21:46:32 2013
@@ -74,7 +74,6 @@ import org.apache.thrift.TException;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
-
public class TabletServerBatchReaderIterator implements
Iterator<Entry<Key,Value>> {
private static final Logger log =
Logger.getLogger(TabletServerBatchReaderIterator.class);
@@ -100,9 +99,9 @@ public class TabletServerBatchReaderIter
private Map<String,TimeoutTracker> timeoutTrackers;
private Set<String> timedoutServers;
private long timeout;
-
+
private TabletLocator locator;
-
+
public interface ResultReceiver {
void receive(List<Entry<Key,Value>> entries);
}
@@ -147,11 +146,11 @@ public class TabletServerBatchReaderIter
resultsQueue = new ArrayBlockingQueue<List<Entry<Key,Value>>>(numThreads);
this.locator = new
TimeoutTabletLocator(TabletLocator.getInstance(instance, credentials, new
Text(table)), timeout);
-
+
timeoutTrackers = Collections.synchronizedMap(new
HashMap<String,TabletServerBatchReaderIterator.TimeoutTracker>());
timedoutServers = Collections.synchronizedSet(new HashSet<String>());
this.timeout = timeout;
-
+
if (options.fetchedColumns.size() > 0) {
ArrayList<Range> ranges2 = new ArrayList<Range>(ranges.size());
for (Range range : ranges) {
@@ -189,7 +188,6 @@ public class TabletServerBatchReaderIter
}
}
-
@Override
public boolean hasNext() {
synchronized (nextLock) {
@@ -213,7 +211,7 @@ public class TabletServerBatchReaderIter
if (queryThreadPool.isShutdown())
throw new RuntimeException("scanner closed");
-
+
batchIterator = batch.iterator();
return batch != LAST_BATCH;
} catch (InterruptedException e) {
@@ -348,6 +346,7 @@ public class TabletServerBatchReaderIter
this.semaphoreSize = semaphoreSize;
}
+ @Override
public void run() {
String threadName = Thread.currentThread().getName();
Thread.currentThread().setName(threadName + " looking up " +
tabletsRanges.size() + " ranges at " + tsLocation);
@@ -448,7 +447,7 @@ public class TabletServerBatchReaderIter
// all servers have timed out
throw new TimedOutException(timedoutServers);
}
-
+
// when there are lots of threads and a few tablet servers
// it is good to break request to tablet servers up, the
// following code determines if this is the case
@@ -478,7 +477,7 @@ public class TabletServerBatchReaderIter
}
}
}
-
+
// randomize tabletserver order... this will help when there are multiple
// batch readers and writers running against accumulo
List<String> locations = new ArrayList<String>(binnedRanges.keySet());
@@ -564,11 +563,11 @@ public class TabletServerBatchReaderIter
this.server = server;
this.badServers = badServers;
}
-
+
TimeoutTracker(long timeOut) {
this.timeOut = timeOut;
}
-
+
void startingScan() {
activityTime = System.currentTimeMillis();
}
@@ -594,13 +593,12 @@ public class TabletServerBatchReaderIter
}
/**
- * @return
*/
public long getTimeOut() {
return timeOut;
}
}
-
+
static void doLookup(String server, Map<KeyExtent,List<Range>> requested,
Map<KeyExtent,List<Range>> failures, Map<KeyExtent,List<Range>> unscanned,
ResultReceiver receiver, List<Column> columns, AuthInfo credentials,
ScannerOptions options, Authorizations authorizations, AccumuloConfiguration
conf)
throws IOException, AccumuloSecurityException, AccumuloServerException {
@@ -632,11 +630,9 @@ public class TabletServerBatchReaderIter
client = ThriftUtil.getTServerClient(server, conf,
timeoutTracker.getTimeOut());
else
client = ThriftUtil.getTServerClient(server, conf);
-
+
try {
-
-
OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Starting multi
scan, tserver=" + server + " #tablets=" + requested.size() + " #ranges="
+ sumSizes(requested.values()) + " ssil=" +
options.serverSideIteratorList + " ssio=" + options.serverSideIteratorOptions);
@@ -662,16 +658,16 @@ public class TabletServerBatchReaderIter
if (entries.size() > 0)
receiver.receive(entries);
-
+
if (entries.size() > 0 || scanResult.fullScans.size() > 0)
timeoutTracker.madeProgress();
-
+
trackScanning(failures, unscanned, scanResult);
while (scanResult.more) {
timeoutTracker.check();
-
+
opTimer.start("Continuing multi scan, scanid=" + imsr.scanID);
scanResult = client.continueMultiScan(Tracer.traceInfo(),
imsr.scanID);
opTimer.stop("Got more multi scan results, #results=" +
scanResult.results.size() + (scanResult.more ? " scanID=" + imsr.scanID : "")
@@ -687,7 +683,7 @@ public class TabletServerBatchReaderIter
if (entries.size() > 0 || scanResult.fullScans.size() > 0)
timeoutTracker.madeProgress();
-
+
trackScanning(failures, unscanned, scanResult);
}
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/ColumnUpdate.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/ColumnUpdate.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/ColumnUpdate.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/ColumnUpdate.java
Thu Jan 17 21:46:32 2013
@@ -47,6 +47,7 @@ public class ColumnUpdate {
* @deprecated use setTimestamp(long);
* @param timestamp
*/
+ @Deprecated
public void setSystemTimestamp(long timestamp) {
if (hasTimestamp)
throw new IllegalStateException("Cannot set system timestamp when user
set a timestamp");
@@ -84,23 +85,26 @@ public class ColumnUpdate {
return this.val;
}
+ @Override
public String toString() {
return new String(Arrays.toString(columnFamily)) + ":" + new
String(Arrays.toString(columnQualifier)) + " ["
+ new String(Arrays.toString(columnVisibility)) + "] " + (hasTimestamp
? timestamp : "NO_TIME_STAMP") + " " + Arrays.toString(val) + " " + deleted;
}
-
+
@Override
public boolean equals(Object obj) {
if (!(obj instanceof ColumnUpdate))
return false;
- ColumnUpdate upd = (ColumnUpdate)obj;
- return Arrays.equals(getColumnFamily(), upd.getColumnFamily()) &&
- Arrays.equals(getColumnQualifier(), upd.getColumnQualifier()) &&
- Arrays.equals(getColumnVisibility(), upd.getColumnVisibility()) &&
- isDeleted() == upd.isDeleted() &&
- Arrays.equals(getValue(), upd.getValue()) &&
- hasTimestamp() == upd.hasTimestamp() &&
- getTimestamp() == upd.getTimestamp();
+ ColumnUpdate upd = (ColumnUpdate) obj;
+ return Arrays.equals(getColumnFamily(), upd.getColumnFamily()) &&
Arrays.equals(getColumnQualifier(), upd.getColumnQualifier())
+ && Arrays.equals(getColumnVisibility(), upd.getColumnVisibility()) &&
isDeleted() == upd.isDeleted() && Arrays.equals(getValue(), upd.getValue())
+ && hasTimestamp() == upd.hasTimestamp() && getTimestamp() ==
upd.getTimestamp();
}
+ @Override
+ public int hashCode() {
+ return Arrays.hashCode(columnFamily) + Arrays.hashCode(columnQualifier) +
Arrays.hashCode(columnVisibility)
+ + (hasTimestamp ? (Boolean.TRUE.hashCode() + new
Long(timestamp).hashCode()) : Boolean.FALSE.hashCode())
+ + (deleted ? Boolean.TRUE.hashCode() : (Boolean.FALSE.hashCode() +
Arrays.hashCode(val)));
+ }
}
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
Thu Jan 17 21:46:32 2013
@@ -50,9 +50,8 @@ import org.apache.log4j.Logger;
*
* This iterator is commonly used with BatchScanner or AccumuloInputFormat, to
parallelize the search over all shardIDs.
*
- * This iterator will *ignore* any columnFamilies passed to {@link
#seek(Range, Collection, boolean)} as it performs intersections
- * over terms. Extending classes should override the {@link
TermSource#seekColfams} in their implementation's
- * {@link #init(SortedKeyValueIterator, Map, IteratorEnvironment)} method.
+ * This iterator will *ignore* any columnFamilies passed to {@link
#seek(Range, Collection, boolean)} as it performs intersections over terms.
Extending classes
+ * should override the {@link TermSource#seekColfams} in their
implementation's {@link #init(SortedKeyValueIterator, Map,
IteratorEnvironment)} method.
*
* README.shard in docs/examples shows an example of using the
IntersectingIterator.
*/
@@ -86,7 +85,7 @@ public class IntersectingIterator implem
protected static final Logger log =
Logger.getLogger(IntersectingIterator.class);
- protected static class TermSource {
+ public static class TermSource {
public SortedKeyValueIterator<Key,Value> iter;
public Text term;
public Collection<ByteSequence> seekColfams;
@@ -108,7 +107,7 @@ public class IntersectingIterator implem
this.term = term;
this.notFlag = notFlag;
// The desired column families for this source is the term itself
- this.seekColfams = Collections.<ByteSequence>singletonList(new
ArrayByteSequence(term.getBytes(), 0, term.getLength()));
+ this.seekColfams = Collections.<ByteSequence> singletonList(new
ArrayByteSequence(term.getBytes(), 0, term.getLength()));
}
public String getTermString() {
@@ -489,7 +488,6 @@ public class IntersectingIterator implem
currentPartition = new Text();
currentDocID.set(emptyByteArray);
-
// seek each of the sources to the right column family within the row
given by key
for (int i = 0; i < sourcesCount; i++) {
Key sourceKey;
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/KeyTransformingIterator.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/KeyTransformingIterator.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/KeyTransformingIterator.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/KeyTransformingIterator.java
Thu Jan 17 21:46:32 2013
@@ -51,7 +51,7 @@ import org.apache.log4j.Logger;
* column family. In that case, the iterator must load all column qualifiers
for each row/column family pair into memory. Given this constraint, care must be
* taken by users of this iterator to ensure it is not run in such a way that
will overrun memory in a tablet server.
* <p>
- * If the implementing iterator is transforming column families, then it must
also override {@link #untransformColumnFamilies(Collection)} to handle the case
+ * If the implementing iterator is transforming column families, then it must
also override {@code untransformColumnFamilies(Collection)} to handle the case
* when column families are fetched at scan time. The fetched column families
will/must be in the transformed space, and the untransformed column families
need
* to be passed to this iterator's source. If it is not possible to write a
reverse transformation (e.g., the column family transformation depends on the
row
* value or something like that), then the iterator must not fetch specific
column families (or only fetch column families that are known to not transform
at
@@ -80,7 +80,7 @@ abstract public class KeyTransformingIte
protected Range seekRange;
protected Collection<ByteSequence> seekColumnFamilies;
protected boolean seekColumnFamiliesInclusive;
-
+
private VisibilityEvaluator ve = null;
private LRUMap visibleCache = null;
private LRUMap parsedVisibilitiesCache = null;
@@ -131,7 +131,7 @@ abstract public class KeyTransformingIte
} catch (Exception e) {
throw new RuntimeException(e);
}
-
+
copy.setSource(getSource().deepCopy(env));
copy.scanning = scanning;
@@ -140,7 +140,7 @@ abstract public class KeyTransformingIte
copy.seekRange = (seekRange == null) ? null : new Range(seekRange);
copy.seekColumnFamilies = (seekColumnFamilies == null) ? null : new
HashSet<ByteSequence>(seekColumnFamilies);
copy.seekColumnFamiliesInclusive = seekColumnFamiliesInclusive;
-
+
copy.ve = ve;
if (visibleCache != null) {
copy.visibleCache = new LRUMap(visibleCache.maxSize());
@@ -190,13 +190,13 @@ abstract public class KeyTransformingIte
seekRange = (range != null) ? new Range(range) : null;
seekColumnFamilies = columnFamilies;
seekColumnFamiliesInclusive = inclusive;
-
+
// Seek the source iterator, but use a recalculated range that ensures
// we see all keys with the same "prefix." We need to do this since
// transforming could change the sort order and transformed keys that
// are before the range start could be inside the range after
transformation.
super.seek(computeReseekRange(range),
untransformColumnFamilies(columnFamilies), inclusive);
-
+
// Range clipping could cause us to trim out all the keys we transformed.
// Keep looping until we either have some keys in the output range, or have
// exhausted the source iterator.
@@ -217,10 +217,10 @@ abstract public class KeyTransformingIte
keyPos = -1;
keys.clear();
Key prefixKey = super.hasTop() ? new Key(super.getTopKey()) : null;
-
+
while (super.hasTop()) {
Key sourceTopKey = super.getTopKey();
-
+
// If the source key equals our prefix key (up to the prefix), then
// we have a key that needs transformed. Otherwise, we're done.
if (sourceTopKey.equals(prefixKey, getKeyPrefix())) {
@@ -232,7 +232,7 @@ abstract public class KeyTransformingIte
transformedKey = new Key(sourceTopKey);
// We could check that the transformed key didn't transform anything
// in the key prefix here...
-
+
// Transformation could have produced a key that falls outside
// of the seek range, or one that the user cannot see. Check
// these before adding it to the output list.
@@ -241,10 +241,10 @@ abstract public class KeyTransformingIte
} else {
break;
}
-
+
super.next();
}
-
+
if (!keys.isEmpty()) {
Collections.sort(keys, keyComparator);
keyPos = 0;
@@ -307,7 +307,7 @@ abstract public class KeyTransformingIte
if (!scanning || !visible || ve == null || visibleCache == null ||
visibility.length() == 0)
return visible;
-
+
visible = (Boolean) visibleCache.get(visibility);
if (visible == null) {
try {
@@ -323,7 +323,7 @@ abstract public class KeyTransformingIte
visible = Boolean.FALSE;
}
}
-
+
return visible;
}
@@ -345,7 +345,7 @@ abstract public class KeyTransformingIte
}
return visible;
}
-
+
/**
* Possibly expand {@code range} to include everything for the key prefix we
are working with. That is, if our prefix is ROW_COLFAM, then we need to expand
* the range so we're sure to include all entries having the same row and
column family as the start/end of the range.
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InterpreterCommand.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InterpreterCommand.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InterpreterCommand.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InterpreterCommand.java
Thu Jan 17 21:46:32 2013
@@ -25,15 +25,10 @@ import org.apache.accumulo.core.util.she
*/
public class InterpreterCommand extends ShellPluginConfigurationCommand {
- /**
- * @param typeName
- * @param tableProp
- * @param classOpt
- */
public InterpreterCommand() {
super("interpreter", Property.TABLE_INTERPRETER_CLASS, "i");
}
-
+
@Override
public String description() {
return "specifies a scan interpreter to interpret scan range and column
arguments";
Modified:
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java
(original)
+++
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java
Thu Jan 17 21:46:32 2013
@@ -44,19 +44,19 @@ public class ReadWriteExample {
private Connector conn;
static class Opts extends ClientOnDefaultTable {
- @Parameter(names={"-C", "--createtable"}, description="create table before
doing anything")
+ @Parameter(names = {"-C", "--createtable"}, description = "create table
before doing anything")
boolean createtable = false;
- @Parameter(names={"-D", "--deletetable"}, description="delete table when
finished")
+ @Parameter(names = {"-D", "--deletetable"}, description = "delete table
when finished")
boolean deletetable = false;
- @Parameter(names={"-c", "--create"}, description="create entries before
any deletes")
+ @Parameter(names = {"-c", "--create"}, description = "create entries
before any deletes")
boolean createEntries = false;
- @Parameter(names={"-r", "--read"}, description="read entries after any
creates/deletes")
+ @Parameter(names = {"-r", "--read"}, description = "read entries after any
creates/deletes")
boolean readEntries = false;
- @Parameter(names={"-d", "--delete"}, description="delete entries after any
creates")
+ @Parameter(names = {"-d", "--delete"}, description = "delete entries after
any creates")
boolean deleteEntries = false;
- public Opts() {
- super(DEFAULT_TABLE_NAME);
+ public Opts() {
+ super(DEFAULT_TABLE_NAME);
auths = new Authorizations(DEFAULT_AUTHS.split(","));
}
}
@@ -66,7 +66,7 @@ public class ReadWriteExample {
private void execute(Opts opts, ScannerOpts scanOpts) throws Exception {
conn = opts.getConnector();
-
+
// add the authorizations to the user
Authorizations userAuthorizations =
conn.securityOperations().getUserAuthorizations(opts.user);
ByteArraySet auths = new
ByteArraySet(userAuthorizations.getAuthorizations());
@@ -82,7 +82,7 @@ public class ReadWriteExample {
conn.tableOperations().create(opts.getTableName());
conn.tableOperations().addSplits(opts.getTableName(), partitionKeys);
}
-
+
// send mutations
createEntries(opts);
Modified: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/TStore.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/TStore.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
--- accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/TStore.java
(original)
+++ accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/TStore.java Thu
Jan 17 21:46:32 2013
@@ -135,7 +135,6 @@ public interface TStore<T> {
/**
* list all transaction ids in store
*
- * @return
*/
public List<Long> list();
Modified:
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java
(original)
+++
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java
Thu Jan 17 21:46:32 2013
@@ -33,7 +33,6 @@ import org.apache.accumulo.core.util.Cac
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.server.tabletserver.log.MultiReader;
import org.apache.accumulo.server.trace.TraceFileSystem;
-import org.apache.commons.cli.ParseException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
@@ -46,15 +45,15 @@ import com.beust.jcommander.Parameter;
public class LogReader {
static class Opts extends Help {
- @Parameter(names="-r", description="print only mutations associated with
the given row")
+ @Parameter(names = "-r", description = "print only mutations associated
with the given row")
String row;
- @Parameter(names="-m", description="limit the number of mutations printed
per row")
+ @Parameter(names = "-m", description = "limit the number of mutations
printed per row")
int maxMutations = 5;
- @Parameter(names="-t", description="print only mutations that fall within
the given key extent")
+ @Parameter(names = "-t", description = "print only mutations that fall
within the given key extent")
String extent;
- @Parameter(names="-p", description="search for a row that matches the
given regex")
+ @Parameter(names = "-p", description = "search for a row that matches the
given regex")
String regexp;
- @Parameter(description="<logfile> { <logfile> ... }")
+ @Parameter(description = "<logfile> { <logfile> ... }")
List<String> files = new ArrayList<String>();
}
@@ -64,7 +63,6 @@ public class LogReader {
* @param args
* - first argument is the file to print
* @throws IOException
- * @throws ParseException
*/
public static void main(String[] args) throws IOException {
Opts opts = new Opts();
@@ -92,7 +90,7 @@ public class LogReader {
}
Set<Integer> tabletIds = new HashSet<Integer>();
-
+
for (String file : opts.files) {
Path path = new Path(file);
@@ -146,7 +144,7 @@ public class LogReader {
return;
}
}
-
+
if (row != null || rowMatcher != null) {
if (key.event == LogEvents.MUTATION || key.event ==
LogEvents.MANY_MUTATIONS) {
boolean found = false;
Modified:
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityUtil.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityUtil.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityUtil.java
(original)
+++
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityUtil.java
Thu Jan 17 21:46:32 2013
@@ -18,7 +18,6 @@ package org.apache.accumulo.server.secur
import java.io.IOException;
import java.net.InetAddress;
-import java.net.UnknownHostException;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
@@ -30,13 +29,10 @@ import org.apache.log4j.Logger;
*/
public class SecurityUtil {
private static final Logger log = Logger.getLogger(SecurityUtil.class);
-
+
/**
* This method is for logging a server in kerberos. If this is used in
client code, it will fail unless run as the accumulo keytab's owner. Instead,
use
* {@link #login(String, String)}
- *
- * @throws UnknownHostException
- * @throws IOException
*/
public static void serverLogin() {
@SuppressWarnings("deprecation")
@@ -69,7 +65,6 @@ public class SecurityUtil {
* replaced by the systems host name.
* @param keyTabPath
* @return true if login succeeded, otherwise false
- * @throws IOException
*/
public static boolean login(String principalConfig, String keyTabPath) {
try {
Modified:
accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
(original)
+++
accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
Thu Jan 17 21:46:32 2013
@@ -44,19 +44,16 @@ import org.w3c.dom.NodeList;
public class AccumuloClassLoader {
public static final String CLASSPATH_PROPERTY_NAME = "general.classpaths";
-
- public static final String ACCUMULO_CLASSPATH_VALUE =
"$ACCUMULO_HOME/conf,\n"
- + "$ACCUMULO_HOME/lib/[^.].*.jar,\n"
- + "$ZOOKEEPER_HOME/zookeeper[^.].*.jar,\n"
- + "$HADOOP_PREFIX/[^.].*.jar,\n" + "$HADOOP_CONF_DIR,\n"
- + "$HADOOP_PREFIX/lib/[^.].*.jar,\n";
+
+ public static final String ACCUMULO_CLASSPATH_VALUE =
"$ACCUMULO_HOME/conf,\n" + "$ACCUMULO_HOME/lib/[^.].*.jar,\n"
+ + "$ZOOKEEPER_HOME/zookeeper[^.].*.jar,\n" +
"$HADOOP_PREFIX/[^.].*.jar,\n" + "$HADOOP_CONF_DIR,\n" +
"$HADOOP_PREFIX/lib/[^.].*.jar,\n";
private static String SITE_CONF;
private static URLClassLoader classloader;
-
+
private static Logger log = Logger.getLogger(AccumuloClassLoader.class);
-
+
static {
String configFile = System.getProperty("org.apache.accumulo.config.file",
"accumulo-site.xml");
if (System.getenv("ACCUMULO_HOME") != null) {
@@ -65,12 +62,12 @@ public class AccumuloClassLoader {
} else {
SITE_CONF = null;
}
-
- //Register the shutdown hook
+
+ // Register the shutdown hook
// TODO
// Runtime.getRuntime().addShutdownHook(new Thread(new
AccumuloVFSClassLoaderShutdownThread()));
}
-
+
/**
* Parses and XML Document for a property node for a <name> with the value
propertyName if it finds one the function return that property's value for its
* <value> node. If not found the function will return null
@@ -93,7 +90,7 @@ public class AccumuloClassLoader {
}
return null;
}
-
+
/**
* Looks for the site configuration file for Accumulo and if it has a
property for propertyName return it otherwise returns defaultValue Should throw
an
* exception if the default configuration can not be read;
@@ -130,7 +127,6 @@ public class AccumuloClassLoader {
*
* @param classpath
* @param env
- * @return
*/
public static String replaceEnvVars(String classpath, Map<String,String>
env) {
Pattern envPat = Pattern.compile("\\$[A-Za-z][a-zA-Z0-9_]*");
@@ -147,7 +143,7 @@ public class AccumuloClassLoader {
}
return classpath;
}
-
+
/**
* Populate the list of URLs with the items in the classpath string
*
@@ -179,6 +175,7 @@ public class AccumuloClassLoader {
else {
if (extDir.getParentFile() != null) {
File[] extJars = extDir.getParentFile().listFiles(new
FilenameFilter() {
+ @Override
public boolean accept(File dir, String name) {
return name.matches("^" + extDir.getName());
}
@@ -198,7 +195,7 @@ public class AccumuloClassLoader {
}
}
-
+
private static ArrayList<URL> findAccumuloURLs() throws IOException {
String cp = getAccumuloString(AccumuloClassLoader.CLASSPATH_PROPERTY_NAME,
AccumuloClassLoader.ACCUMULO_CLASSPATH_VALUE);
if (cp == null)
@@ -218,11 +215,12 @@ public class AccumuloClassLoader {
ArrayList<URL> urls = findAccumuloURLs();
ClassLoader parentClassLoader = ClassLoader.getSystemClassLoader();
-
+
log.debug("Create 2nd tier ClassLoader using URLs: " + urls.toString());
URLClassLoader aClassLoader = new URLClassLoader(urls.toArray(new
URL[urls.size()]), parentClassLoader) {
+ @Override
protected synchronized Class<?> loadClass(String name, boolean
resolve) throws ClassNotFoundException {
-
+
if (name.startsWith("org.apache.accumulo.start.classloader.vfs")) {
Class<?> c = findLoadedClass(name);
if (c == null) {
Modified:
accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
(original)
+++
accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
Thu Jan 17 21:46:32 2013
@@ -53,9 +53,9 @@ public class ContextManager {
loader = null;
}
}
-
+
private Map<String,Context> contexts = new HashMap<String,Context>();
-
+
private volatile ContextsConfig config;
private FileSystemManager vfs;
private ReloadingClassLoader parent;
@@ -74,6 +74,7 @@ public class ContextManager {
this.preDelegation = preDelegation;
}
+ @Override
public boolean equals(Object o) {
if (o instanceof ContextConfig) {
ContextConfig oc = (ContextConfig) o;
@@ -83,6 +84,11 @@ public class ContextManager {
return false;
}
+
+ @Override
+ public int hashCode() {
+ return uris.hashCode() + (preDelegation ? Boolean.TRUE :
Boolean.FALSE).hashCode();
+ }
}
public interface ContextsConfig {
@@ -101,7 +107,7 @@ public class ContextManager {
}
public ClassLoader getClassLoader(String contextName) throws
FileSystemException {
-
+
ContextConfig cconfig = config.getContextConfig(contextName);
if (cconfig == null)
@@ -127,7 +133,7 @@ public class ContextManager {
if (contextToClose != null)
contextToClose.close();
-
+
ClassLoader loader = context.getClassLoader();
if (loader == null) {
// ooppss, context was closed by another thread, try again
@@ -135,12 +141,12 @@ public class ContextManager {
}
return loader;
-
+
}
public <U> Class<? extends U> loadClass(String context, String classname,
Class<U> extension) throws ClassNotFoundException {
try {
- return (Class<? extends U>)
getClassLoader(context).loadClass(classname).asSubclass(extension);
+ return
getClassLoader(context).loadClass(classname).asSubclass(extension);
} catch (IOException e) {
throw new ClassNotFoundException("IO Error loading class " + classname,
e);
}
Modified:
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
(original)
+++
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
Thu Jan 17 21:46:32 2013
@@ -50,14 +50,12 @@ public class MiniAccumuloCluster {
private static final String INSTANCE_SECRET = "DONTTELL";
private static final String INSTANCE_NAME = "miniInstance";
-
+
private static class LogWriter extends Thread {
private BufferedReader in;
private BufferedWriter out;
/**
- * @param errorStream
- * @param logDir
* @throws IOException
*/
public LogWriter(InputStream stream, File logFile) throws IOException {
@@ -81,7 +79,8 @@ public class MiniAccumuloCluster {
if (out != null)
out.flush();
}
-
+
+ @Override
public void run() {
String line;
@@ -96,13 +95,13 @@ public class MiniAccumuloCluster {
out = null;
in.close();
}
-
+
} catch (IOException e) {
e.printStackTrace();
}
}
}
-
+
private File libDir;
private File confDir;
private File zooKeeperDir;
@@ -113,14 +112,14 @@ public class MiniAccumuloCluster {
private Process zooKeeperProcess;
private Process masterProcess;
-
+
private int zooKeeperPort;
private List<LogWriter> logWriters = new
ArrayList<MiniAccumuloCluster.LogWriter>();
-
+
private MiniAccumuloConfig config;
private Process[] tabletServerProcesses;
-
+
private int getRandomFreePort() {
Random r = new Random();
int count = 0;
@@ -146,29 +145,28 @@ public class MiniAccumuloCluster {
throw new RuntimeException("Unable to find port");
}
-
+
private Process exec(Class<? extends Object> clazz, String... args) throws
IOException {
String javaHome = System.getProperty("java.home");
String javaBin = javaHome + File.separator + "bin" + File.separator +
"java";
String classpath = System.getProperty("java.class.path");
classpath = confDir.getAbsolutePath() + File.pathSeparator + classpath;
-
+
String className = clazz.getCanonicalName();
ArrayList<String> argList = new ArrayList<String>();
- argList.addAll(Arrays.asList(javaBin, "-cp", classpath, "-Xmx128m",
"-XX:+UseConcMarkSweepGC", "-XX:CMSInitiatingOccupancyFraction=75",
- className));
+ argList.addAll(Arrays.asList(javaBin, "-cp", classpath, "-Xmx128m",
"-XX:+UseConcMarkSweepGC", "-XX:CMSInitiatingOccupancyFraction=75", className));
argList.addAll(Arrays.asList(args));
ProcessBuilder builder = new ProcessBuilder(argList);
builder.environment().put("ACCUMULO_HOME",
config.getDir().getAbsolutePath());
builder.environment().put("ACCUMULO_LOG_DIR", logDir.getAbsolutePath());
-
+
Process process = builder.start();
-
+
LogWriter lw;
lw = new LogWriter(process.getErrorStream(), new File(logDir,
clazz.getSimpleName() + "_" + process.hashCode() + ".err"));
logWriters.add(lw);
@@ -176,14 +174,14 @@ public class MiniAccumuloCluster {
lw = new LogWriter(process.getInputStream(), new File(logDir,
clazz.getSimpleName() + "_" + process.hashCode() + ".out"));
logWriters.add(lw);
lw.start();
-
+
return process;
}
-
+
private void appendProp(FileWriter fileWriter, Property key, String value,
Map<String,String> siteConfig) throws IOException {
appendProp(fileWriter, key.getKey(), value, siteConfig);
}
-
+
private void appendProp(FileWriter fileWriter, String key, String value,
Map<String,String> siteConfig) throws IOException {
if (!siteConfig.containsKey(key))
fileWriter.append("<property><name>" + key + "</name><value>" + value +
"</value></property>\n");
@@ -201,15 +199,15 @@ public class MiniAccumuloCluster {
public MiniAccumuloCluster(File dir, String rootPassword) throws IOException
{
this(new MiniAccumuloConfig(dir, rootPassword));
}
-
+
/**
* @param config
* initial configuration
* @throws IOException
*/
-
+
public MiniAccumuloCluster(MiniAccumuloConfig config) throws IOException {
-
+
if (config.getDir().exists() && !config.getDir().isDirectory())
throw new IllegalArgumentException("Must pass in directory, " +
config.getDir() + " is a file");
@@ -217,7 +215,7 @@ public class MiniAccumuloCluster {
throw new IllegalArgumentException("Directory " + config.getDir() + " is
not empty");
this.config = config;
-
+
libDir = new File(config.getDir(), "lib");
confDir = new File(config.getDir(), "conf");
accumuloDir = new File(config.getDir(), "accumulo");
@@ -233,14 +231,14 @@ public class MiniAccumuloCluster {
libDir.mkdirs();
zooKeeperPort = getRandomFreePort();
-
+
File siteFile = new File(confDir, "accumulo-site.xml");
FileWriter fileWriter = new FileWriter(siteFile);
fileWriter.append("<configuration>\n");
HashMap<String,String> siteConfig = new
HashMap<String,String>(config.getSiteConfig());
-
+
appendProp(fileWriter, Property.INSTANCE_DFS_URI, "file:///", siteConfig);
appendProp(fileWriter, Property.INSTANCE_DFS_DIR,
accumuloDir.getAbsolutePath(), siteConfig);
appendProp(fileWriter, Property.INSTANCE_ZK_HOST, "localhost:" +
zooKeeperPort, siteConfig);
@@ -258,7 +256,7 @@ public class MiniAccumuloCluster {
appendProp(fileWriter, Property.TSERV_MAJC_DELAY, "3", siteConfig);
appendProp(fileWriter, Property.GENERAL_CLASSPATHS,
libDir.getAbsolutePath(), siteConfig);
appendProp(fileWriter, Property.GENERAL_DYNAMIC_CLASSPATHS,
libDir.getAbsolutePath(), siteConfig);
-
+
for (Entry<String,String> entry : siteConfig.entrySet())
fileWriter.append("<property><name>" + entry.getKey() + "</name><value>"
+ entry.getValue() + "</value></property>\n");
fileWriter.append("</configuration>\n");
@@ -276,11 +274,11 @@ public class MiniAccumuloCluster {
zooCfg.setProperty("maxClientCnxns", "100");
zooCfg.setProperty("dataDir", zooKeeperDir.getAbsolutePath());
zooCfg.store(fileWriter, null);
-
+
fileWriter.close();
}
-
+
/**
* Starts Accumulo and Zookeeper processes. Can only be called once.
*
@@ -289,12 +287,13 @@ public class MiniAccumuloCluster {
* @throws IllegalStateException
* if already started
*/
-
+
public void start() throws IOException, InterruptedException {
if (zooKeeperProcess != null)
throw new IllegalStateException("Already started");
-
+
Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
public void run() {
try {
MiniAccumuloCluster.this.stop();
@@ -305,12 +304,12 @@ public class MiniAccumuloCluster {
}
}
});
-
+
zooKeeperProcess = exec(ZooKeeperServerMain.class,
zooCfgFile.getAbsolutePath());
-
+
// sleep a little bit to let zookeeper come up before calling init, seems
to work better
UtilWaitThread.sleep(250);
-
+
Process initProcess = exec(Initialize.class, "--instance-name",
INSTANCE_NAME, "--password", config.getRootPassword());
int ret = initProcess.waitFor();
if (ret != 0) {
@@ -321,14 +320,14 @@ public class MiniAccumuloCluster {
for (int i = 0; i < config.getNumTservers(); i++) {
tabletServerProcesses[i] = exec(TabletServer.class);
}
-
+
masterProcess = exec(Master.class);
}
-
+
/**
* @return Accumulo instance name
*/
-
+
public String getInstanceName() {
return INSTANCE_NAME;
}
@@ -336,11 +335,11 @@ public class MiniAccumuloCluster {
/**
* @return zookeeper connection string
*/
-
+
public String getZookeepers() {
return "localhost:" + zooKeeperPort;
}
-
+
/**
* Stops Accumulo and Zookeeper processes. If stop is not called, there is a
shutdown hook that is setup to kill the processes. Howerver its probably best to
* call stop in a finally block as soon as possible.
@@ -348,7 +347,7 @@ public class MiniAccumuloCluster {
* @throws IOException
* @throws InterruptedException
*/
-
+
public void stop() throws IOException, InterruptedException {
if (zooKeeperProcess != null)
zooKeeperProcess.destroy();
Modified:
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloConfig.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloConfig.java?rev=1434928&r1=1434927&r2=1434928&view=diff
==============================================================================
---
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloConfig.java
(original)
+++
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloConfig.java
Thu Jan 17 21:46:32 2013
@@ -38,7 +38,7 @@ public class MiniAccumuloConfig {
* @param rootPassword
* The initial password for the Accumulo root user
*/
-
+
public MiniAccumuloConfig(File dir, String rootPassword) {
this.dir = dir;
this.rootPassword = rootPassword;
@@ -55,13 +55,12 @@ public class MiniAccumuloConfig {
public int getNumTservers() {
return numTservers;
}
-
+
/**
* Calling this method is optional. If not set, it defaults to two.
*
* @param numTservers
* the number of tablet servers that mini accumulo cluster should
start
- * @return
*/
public MiniAccumuloConfig setNumTservers(int numTservers) {
@@ -70,22 +69,20 @@ public class MiniAccumuloConfig {
this.numTservers = numTservers;
return this;
}
-
+
public Map<String,String> getSiteConfig() {
return siteConfig;
}
-
/**
* Calling this method is optional. If not set, it defautls to an empty map.
*
* @param siteConfig
* key/values that you normally put in accumulo-site.xml can be put
here
- * @return
*/
public MiniAccumuloConfig setSiteConfig(Map<String,String> siteConfig) {
this.siteConfig = siteConfig;
return this;
}
-}
\ No newline at end of file
+}