You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2012/07/13 22:34:49 UTC
svn commit: r1361382 [6/16] - in /accumulo/branches/ACCUMULO-259: ./ bin/
conf/examples/1GB/native-standalone/ conf/examples/1GB/standalone/
conf/examples/2GB/native-standalone/ conf/examples/2GB/standalone/
conf/examples/3GB/native-standalone/ conf/ex...
Modified: accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/gc/thrift/GcCycleStats.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/gc/thrift/GcCycleStats.java?rev=1361382&r1=1361381&r2=1361382&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/gc/thrift/GcCycleStats.java (original)
+++ accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/gc/thrift/GcCycleStats.java Fri Jul 13 20:34:44 2012
@@ -1,10 +1,17 @@
/**
- * Autogenerated by Thrift
+ * Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.accumulo.core.gc.thrift;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -30,12 +37,18 @@ import org.slf4j.LoggerFactory;
private static final org.apache.thrift.protocol.TField DELETED_FIELD_DESC = new org.apache.thrift.protocol.TField("deleted", org.apache.thrift.protocol.TType.I64, (short)5);
private static final org.apache.thrift.protocol.TField ERRORS_FIELD_DESC = new org.apache.thrift.protocol.TField("errors", org.apache.thrift.protocol.TType.I64, (short)6);
- public long started;
- public long finished;
- public long candidates;
- public long inUse;
- public long deleted;
- public long errors;
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new GcCycleStatsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new GcCycleStatsTupleSchemeFactory());
+ }
+
+ public long started; // required
+ public long finished; // required
+ public long candidates; // required
+ public long inUse; // required
+ public long deleted; // required
+ public long errors; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -118,7 +131,6 @@ import org.slf4j.LoggerFactory;
private static final int __DELETED_ISSET_ID = 4;
private static final int __ERRORS_ISSET_ID = 5;
private BitSet __isset_bit_vector = new BitSet(6);
-
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -392,22 +404,22 @@ import org.slf4j.LoggerFactory;
public Object getFieldValue(_Fields field) {
switch (field) {
case STARTED:
- return new Long(getStarted());
+ return Long.valueOf(getStarted());
case FINISHED:
- return new Long(getFinished());
+ return Long.valueOf(getFinished());
case CANDIDATES:
- return new Long(getCandidates());
+ return Long.valueOf(getCandidates());
case IN_USE:
- return new Long(getInUse());
+ return Long.valueOf(getInUse());
case DELETED:
- return new Long(getDeleted());
+ return Long.valueOf(getDeleted());
case ERRORS:
- return new Long(getErrors());
+ return Long.valueOf(getErrors());
}
throw new IllegalStateException();
@@ -587,98 +599,11 @@ import org.slf4j.LoggerFactory;
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // STARTED
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.started = iprot.readI64();
- setStartedIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // FINISHED
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.finished = iprot.readI64();
- setFinishedIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // CANDIDATES
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.candidates = iprot.readI64();
- setCandidatesIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 4: // IN_USE
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.inUse = iprot.readI64();
- setInUseIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 5: // DELETED
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.deleted = iprot.readI64();
- setDeletedIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 6: // ERRORS
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.errors = iprot.readI64();
- setErrorsIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(STARTED_FIELD_DESC);
- oprot.writeI64(this.started);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(FINISHED_FIELD_DESC);
- oprot.writeI64(this.finished);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(CANDIDATES_FIELD_DESC);
- oprot.writeI64(this.candidates);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(IN_USE_FIELD_DESC);
- oprot.writeI64(this.inUse);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(DELETED_FIELD_DESC);
- oprot.writeI64(this.deleted);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(ERRORS_FIELD_DESC);
- oprot.writeI64(this.errors);
- oprot.writeFieldEnd();
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -735,5 +660,192 @@ import org.slf4j.LoggerFactory;
}
}
+ private static class GcCycleStatsStandardSchemeFactory implements SchemeFactory {
+ public GcCycleStatsStandardScheme getScheme() {
+ return new GcCycleStatsStandardScheme();
+ }
+ }
+
+ private static class GcCycleStatsStandardScheme extends StandardScheme<GcCycleStats> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, GcCycleStats struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STARTED
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.started = iprot.readI64();
+ struct.setStartedIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // FINISHED
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.finished = iprot.readI64();
+ struct.setFinishedIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // CANDIDATES
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.candidates = iprot.readI64();
+ struct.setCandidatesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // IN_USE
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.inUse = iprot.readI64();
+ struct.setInUseIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // DELETED
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.deleted = iprot.readI64();
+ struct.setDeletedIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 6: // ERRORS
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.errors = iprot.readI64();
+ struct.setErrorsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, GcCycleStats struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(STARTED_FIELD_DESC);
+ oprot.writeI64(struct.started);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(FINISHED_FIELD_DESC);
+ oprot.writeI64(struct.finished);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(CANDIDATES_FIELD_DESC);
+ oprot.writeI64(struct.candidates);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(IN_USE_FIELD_DESC);
+ oprot.writeI64(struct.inUse);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(DELETED_FIELD_DESC);
+ oprot.writeI64(struct.deleted);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(ERRORS_FIELD_DESC);
+ oprot.writeI64(struct.errors);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class GcCycleStatsTupleSchemeFactory implements SchemeFactory {
+ public GcCycleStatsTupleScheme getScheme() {
+ return new GcCycleStatsTupleScheme();
+ }
+ }
+
+ private static class GcCycleStatsTupleScheme extends TupleScheme<GcCycleStats> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, GcCycleStats struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetStarted()) {
+ optionals.set(0);
+ }
+ if (struct.isSetFinished()) {
+ optionals.set(1);
+ }
+ if (struct.isSetCandidates()) {
+ optionals.set(2);
+ }
+ if (struct.isSetInUse()) {
+ optionals.set(3);
+ }
+ if (struct.isSetDeleted()) {
+ optionals.set(4);
+ }
+ if (struct.isSetErrors()) {
+ optionals.set(5);
+ }
+ oprot.writeBitSet(optionals, 6);
+ if (struct.isSetStarted()) {
+ oprot.writeI64(struct.started);
+ }
+ if (struct.isSetFinished()) {
+ oprot.writeI64(struct.finished);
+ }
+ if (struct.isSetCandidates()) {
+ oprot.writeI64(struct.candidates);
+ }
+ if (struct.isSetInUse()) {
+ oprot.writeI64(struct.inUse);
+ }
+ if (struct.isSetDeleted()) {
+ oprot.writeI64(struct.deleted);
+ }
+ if (struct.isSetErrors()) {
+ oprot.writeI64(struct.errors);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, GcCycleStats struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(6);
+ if (incoming.get(0)) {
+ struct.started = iprot.readI64();
+ struct.setStartedIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.finished = iprot.readI64();
+ struct.setFinishedIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.candidates = iprot.readI64();
+ struct.setCandidatesIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.inUse = iprot.readI64();
+ struct.setInUseIsSet(true);
+ }
+ if (incoming.get(4)) {
+ struct.deleted = iprot.readI64();
+ struct.setDeletedIsSet(true);
+ }
+ if (incoming.get(5)) {
+ struct.errors = iprot.readI64();
+ struct.setErrorsIsSet(true);
+ }
+ }
+ }
+
}
Modified: accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/OrIterator.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/OrIterator.java?rev=1361382&r1=1361381&r2=1361382&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/OrIterator.java (original)
+++ accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/OrIterator.java Fri Jul 13 20:34:44 2012
@@ -19,10 +19,12 @@ package org.apache.accumulo.core.iterato
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
import java.util.PriorityQueue;
+import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
@@ -47,15 +49,19 @@ public class OrIterator implements Sorte
protected static class TermSource implements Comparable<TermSource> {
public SortedKeyValueIterator<Key,Value> iter;
public Text term;
+ public Collection<ByteSequence> seekColfams;
public TermSource(TermSource other) {
this.iter = other.iter;
this.term = other.term;
+ this.seekColfams = other.seekColfams;
}
public TermSource(SortedKeyValueIterator<Key,Value> iter, Text term) {
this.iter = iter;
this.term = term;
+ // The desired column families for this source is the term itself
+ this.seekColfams = Collections.<ByteSequence>singletonList(new ArrayByteSequence(term.getBytes(), 0, term.getLength()));
}
public int compareTo(TermSource o) {
@@ -143,7 +149,7 @@ public class OrIterator implements Sorte
newRange = new Range((newKey == null) ? nullKey : newKey, true, range.getEndKey(), false);
}
}
- currentTerm.iter.seek(newRange, columnFamilies, inclusive);
+ currentTerm.iter.seek(newRange, currentTerm.seekColfams, true);
// If there is no top key
// OR we are:
@@ -166,7 +172,7 @@ public class OrIterator implements Sorte
// because an Or must have at least two elements.
if (currentTerm == null) {
for (TermSource TS : sources) {
- TS.iter.seek(range, columnFamilies, inclusive);
+ TS.iter.seek(range, TS.seekColfams, true);
if ((TS.iter.hasTop()) && ((TS.term != null) && (TS.term.compareTo(TS.iter.getTopKey().getColumnFamily()) == 0)))
sorted.add(TS);
@@ -196,7 +202,8 @@ public class OrIterator implements Sorte
}
}
- TS.iter.seek(newRange, columnFamilies, inclusive);
+ // Seek only to the term for this source as a column family
+ TS.iter.seek(newRange, TS.seekColfams, true);
// If there is no top key
// OR we are:
Modified: accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/SortedKeyValueIterator.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/SortedKeyValueIterator.java?rev=1361382&r1=1361381&r2=1361382&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/SortedKeyValueIterator.java (original)
+++ accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/SortedKeyValueIterator.java Fri Jul 13 20:34:44 2012
@@ -81,6 +81,13 @@ public interface SortedKeyValueIterator<
* Iterators that examine groups of adjacent key/value pairs (e.g. rows) to determine their top key and value should be sure that they properly handle a seek
* to a key in the middle of such a group (e.g. the middle of a row). Even if the client always seeks to a range containing an entire group (a,c), the tablet
* server could send back a batch of entries corresponding to (a,b], then reseek the iterator to range (b,c) when the scan is continued.
+ *
+ * {@link columnFamilies} is used, at the lowest level, to determine which data blocks inside of an RFile need to be opened for this iterator. This set of data
+ * blocks is also the set of locality groups defined for the given table. If no columnFamilies are provided, the data blocks for all locality groups inside of
+ * the correct RFile will be opened and seeked in an attempt to find the correct start key, irregardless of the startKey in the {@link range}.
+ *
+ * In an Accumulo instance in which multiple locality groups exist for a table, it is important to ensure that {@link columnFamilies} is properly set to the
+ * minimum required column families to ensure that data from separate locality groups is not inadvertently read.
*
* @param range
* <tt>Range</tt> of keys to iterate over.
Modified: accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/user/IndexedDocIterator.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/user/IndexedDocIterator.java?rev=1361382&r1=1361381&r2=1361382&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/user/IndexedDocIterator.java (original)
+++ accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/user/IndexedDocIterator.java Fri Jul 13 20:34:44 2012
@@ -31,6 +31,7 @@ import org.apache.accumulo.core.data.Ran
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
+import org.apache.accumulo.core.iterators.user.IntersectingIterator.TermSource;
import org.apache.hadoop.io.Text;
/**
@@ -134,6 +135,10 @@ public class IndexedDocIterator extends
docColf = new Text(options.get(docFamilyOptionName));
docSource = source.deepCopy(env);
indexColfSet = Collections.singleton((ByteSequence) new ArrayByteSequence(indexColf.getBytes(), 0, indexColf.getLength()));
+
+ for (TermSource ts : this.sources) {
+ ts.seekColfams = indexColfSet;
+ }
}
@Override
@@ -143,7 +148,7 @@ public class IndexedDocIterator extends
@Override
public void seek(Range range, Collection<ByteSequence> seekColumnFamilies, boolean inclusive) throws IOException {
- super.seek(range, indexColfSet, true);
+ super.seek(range, null, true);
}
Modified: accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java?rev=1361382&r1=1361381&r2=1361382&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java (original)
+++ accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java Fri Jul 13 20:34:44 2012
@@ -18,9 +18,11 @@ package org.apache.accumulo.core.iterato
import java.io.IOException;
import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.PartialKey;
@@ -48,6 +50,10 @@ 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.
+ *
* README.shard in docs/examples shows an example of using the IntersectingIterator.
*/
public class IntersectingIterator implements SortedKeyValueIterator<Key,Value> {
@@ -83,24 +89,26 @@ public class IntersectingIterator implem
protected static class TermSource {
public SortedKeyValueIterator<Key,Value> iter;
public Text term;
+ public Collection<ByteSequence> seekColfams;
public boolean notFlag;
public TermSource(TermSource other) {
this.iter = other.iter;
this.term = other.term;
this.notFlag = other.notFlag;
+ this.seekColfams = other.seekColfams;
}
public TermSource(SortedKeyValueIterator<Key,Value> iter, Text term) {
- this.iter = iter;
- this.term = term;
- this.notFlag = false;
+ this(iter, term, false);
}
public TermSource(SortedKeyValueIterator<Key,Value> iter, Text term, boolean notFlag) {
this.iter = iter;
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()));
}
public String getTermString() {
@@ -121,10 +129,6 @@ public class IntersectingIterator implem
protected Key topKey = null;
protected Value value = new Value(emptyByteArray);
- protected Collection<ByteSequence> seekColumnFamilies;
-
- protected boolean inclusive;
-
public IntersectingIterator() {}
@Override
@@ -196,7 +200,7 @@ public class IntersectingIterator implem
if (partitionCompare > 0) {
// seek to at least the currentRow
Key seekKey = buildKey(currentPartition, sources[sourceID].term);
- sources[sourceID].iter.seek(new Range(seekKey, true, null, false), seekColumnFamilies, inclusive);
+ sources[sourceID].iter.seek(new Range(seekKey, true, null, false), sources[sourceID].seekColfams, true);
continue;
}
// check if this source has gone beyond currentRow
@@ -213,7 +217,7 @@ public class IntersectingIterator implem
// if not, then seek forwards to the right columnFamily
if (termCompare > 0) {
Key seekKey = buildKey(currentPartition, sources[sourceID].term, currentDocID);
- sources[sourceID].iter.seek(new Range(seekKey, true, null, false), seekColumnFamilies, inclusive);
+ sources[sourceID].iter.seek(new Range(seekKey, true, null, false), sources[sourceID].seekColfams, true);
continue;
}
// check if this source is beyond the right columnFamily
@@ -235,7 +239,7 @@ public class IntersectingIterator implem
if (docIDCompare > 0) {
// seek forwards
Key seekKey = buildKey(currentPartition, sources[sourceID].term, currentDocID);
- sources[sourceID].iter.seek(new Range(seekKey, true, null, false), seekColumnFamilies, inclusive);
+ sources[sourceID].iter.seek(new Range(seekKey, true, null, false), sources[sourceID].seekColfams, true);
continue;
}
// if we are equal to the target, this is an invalid result.
@@ -273,7 +277,7 @@ public class IntersectingIterator implem
if (partitionCompare > 0) {
// seek to at least the currentRow
Key seekKey = buildKey(currentPartition, sources[sourceID].term);
- sources[sourceID].iter.seek(new Range(seekKey, true, null, false), seekColumnFamilies, inclusive);
+ sources[sourceID].iter.seek(new Range(seekKey, true, null, false), sources[sourceID].seekColfams, true);
continue;
}
// check if this source has gone beyond currentRow
@@ -294,7 +298,7 @@ public class IntersectingIterator implem
// if not, then seek forwards to the right columnFamily
if (termCompare > 0) {
Key seekKey = buildKey(currentPartition, sources[sourceID].term, currentDocID);
- sources[sourceID].iter.seek(new Range(seekKey, true, null, false), seekColumnFamilies, inclusive);
+ sources[sourceID].iter.seek(new Range(seekKey, true, null, false), sources[sourceID].seekColfams, true);
continue;
}
// check if this source is beyond the right columnFamily
@@ -314,7 +318,7 @@ public class IntersectingIterator implem
return true;
}
Key seekKey = buildFollowingPartitionKey(sources[sourceID].iter.getTopKey());
- sources[sourceID].iter.seek(new Range(seekKey, true, null, false), seekColumnFamilies, inclusive);
+ sources[sourceID].iter.seek(new Range(seekKey, true, null, false), sources[sourceID].seekColfams, true);
continue;
}
}
@@ -332,7 +336,7 @@ public class IntersectingIterator implem
if (docIDCompare > 0) {
// seek forwards
Key seekKey = buildKey(currentPartition, sources[sourceID].term, currentDocID);
- sources[sourceID].iter.seek(new Range(seekKey, true, null, false), seekColumnFamilies, inclusive);
+ sources[sourceID].iter.seek(new Range(seekKey, true, null, false), sources[sourceID].seekColfams, true);
continue;
}
// this source is at the current row, in its column family, and at currentCQ
@@ -485,8 +489,6 @@ public class IntersectingIterator implem
currentPartition = new Text();
currentDocID.set(emptyByteArray);
- this.seekColumnFamilies = seekColumnFamilies;
- this.inclusive = inclusive;
// seek each of the sources to the right column family within the row given by key
for (int i = 0; i < sourcesCount; i++) {
@@ -497,9 +499,11 @@ public class IntersectingIterator implem
} else {
sourceKey = buildKey(getPartition(range.getStartKey()), sources[i].term);
}
- sources[i].iter.seek(new Range(sourceKey, true, null, false), seekColumnFamilies, inclusive);
+ // Seek only to the term for this source as a column family
+ sources[i].iter.seek(new Range(sourceKey, true, null, false), sources[i].seekColfams, true);
} else {
- sources[i].iter.seek(range, seekColumnFamilies, inclusive);
+ // Seek only to the term for this source as a column family
+ sources[i].iter.seek(range, sources[i].seekColfams, true);
}
}
advanceToIntersection();
Modified: accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/master/thrift/Compacting.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/master/thrift/Compacting.java?rev=1361382&r1=1361381&r2=1361382&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/master/thrift/Compacting.java (original)
+++ accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/master/thrift/Compacting.java Fri Jul 13 20:34:44 2012
@@ -1,10 +1,17 @@
/**
- * Autogenerated by Thrift
+ * Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.accumulo.core.master.thrift;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -26,8 +33,14 @@ import org.slf4j.LoggerFactory;
private static final org.apache.thrift.protocol.TField RUNNING_FIELD_DESC = new org.apache.thrift.protocol.TField("running", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField QUEUED_FIELD_DESC = new org.apache.thrift.protocol.TField("queued", org.apache.thrift.protocol.TType.I32, (short)2);
- public int running;
- public int queued;
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new CompactingStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new CompactingTupleSchemeFactory());
+ }
+
+ public int running; // required
+ public int queued; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -94,7 +107,6 @@ import org.slf4j.LoggerFactory;
private static final int __RUNNING_ISSET_ID = 0;
private static final int __QUEUED_ISSET_ID = 1;
private BitSet __isset_bit_vector = new BitSet(2);
-
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -212,10 +224,10 @@ import org.slf4j.LoggerFactory;
public Object getFieldValue(_Fields field) {
switch (field) {
case RUNNING:
- return new Integer(getRunning());
+ return Integer.valueOf(getRunning());
case QUEUED:
- return new Integer(getQueued());
+ return Integer.valueOf(getQueued());
}
throw new IllegalStateException();
@@ -311,54 +323,11 @@ import org.slf4j.LoggerFactory;
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // RUNNING
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.running = iprot.readI32();
- setRunningIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // QUEUED
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.queued = iprot.readI32();
- setQueuedIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(RUNNING_FIELD_DESC);
- oprot.writeI32(this.running);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(QUEUED_FIELD_DESC);
- oprot.writeI32(this.queued);
- oprot.writeFieldEnd();
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -399,5 +368,108 @@ import org.slf4j.LoggerFactory;
}
}
+ private static class CompactingStandardSchemeFactory implements SchemeFactory {
+ public CompactingStandardScheme getScheme() {
+ return new CompactingStandardScheme();
+ }
+ }
+
+ private static class CompactingStandardScheme extends StandardScheme<Compacting> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, Compacting struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // RUNNING
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.running = iprot.readI32();
+ struct.setRunningIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // QUEUED
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.queued = iprot.readI32();
+ struct.setQueuedIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, Compacting struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(RUNNING_FIELD_DESC);
+ oprot.writeI32(struct.running);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(QUEUED_FIELD_DESC);
+ oprot.writeI32(struct.queued);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class CompactingTupleSchemeFactory implements SchemeFactory {
+ public CompactingTupleScheme getScheme() {
+ return new CompactingTupleScheme();
+ }
+ }
+
+ private static class CompactingTupleScheme extends TupleScheme<Compacting> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, Compacting struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetRunning()) {
+ optionals.set(0);
+ }
+ if (struct.isSetQueued()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetRunning()) {
+ oprot.writeI32(struct.running);
+ }
+ if (struct.isSetQueued()) {
+ oprot.writeI32(struct.queued);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, Compacting struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.running = iprot.readI32();
+ struct.setRunningIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.queued = iprot.readI32();
+ struct.setQueuedIsSet(true);
+ }
+ }
+ }
+
}
Modified: accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/master/thrift/DeadServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/master/thrift/DeadServer.java?rev=1361382&r1=1361381&r2=1361382&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/master/thrift/DeadServer.java (original)
+++ accumulo/branches/ACCUMULO-259/core/src/main/java/org/apache/accumulo/core/master/thrift/DeadServer.java Fri Jul 13 20:34:44 2012
@@ -1,10 +1,17 @@
/**
- * Autogenerated by Thrift
+ * Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.accumulo.core.master.thrift;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -27,9 +34,15 @@ import org.slf4j.LoggerFactory;
private static final org.apache.thrift.protocol.TField LAST_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("lastStatus", org.apache.thrift.protocol.TType.I64, (short)2);
private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRING, (short)3);
- public String server;
- public long lastStatus;
- public String status;
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new DeadServerStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new DeadServerTupleSchemeFactory());
+ }
+
+ public String server; // required
+ public long lastStatus; // required
+ public String status; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -98,7 +111,6 @@ import org.slf4j.LoggerFactory;
// isset id assignments
private static final int __LASTSTATUS_ISSET_ID = 0;
private BitSet __isset_bit_vector = new BitSet(1);
-
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -260,7 +272,7 @@ import org.slf4j.LoggerFactory;
return getServer();
case LAST_STATUS:
- return new Long(getLastStatus());
+ return Long.valueOf(getLastStatus());
case STATUS:
return getStatus();
@@ -380,67 +392,11 @@ import org.slf4j.LoggerFactory;
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // SERVER
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.server = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // LAST_STATUS
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.lastStatus = iprot.readI64();
- setLastStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // STATUS
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.status = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.server != null) {
- oprot.writeFieldBegin(SERVER_FIELD_DESC);
- oprot.writeString(this.server);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldBegin(LAST_STATUS_FIELD_DESC);
- oprot.writeI64(this.lastStatus);
- oprot.writeFieldEnd();
- if (this.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- oprot.writeString(this.status);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -493,5 +449,133 @@ import org.slf4j.LoggerFactory;
}
}
+ private static class DeadServerStandardSchemeFactory implements SchemeFactory {
+ public DeadServerStandardScheme getScheme() {
+ return new DeadServerStandardScheme();
+ }
+ }
+
+ private static class DeadServerStandardScheme extends StandardScheme<DeadServer> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, DeadServer struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // SERVER
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.server = iprot.readString();
+ struct.setServerIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // LAST_STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.lastStatus = iprot.readI64();
+ struct.setLastStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.status = iprot.readString();
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, DeadServer struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.server != null) {
+ oprot.writeFieldBegin(SERVER_FIELD_DESC);
+ oprot.writeString(struct.server);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(LAST_STATUS_FIELD_DESC);
+ oprot.writeI64(struct.lastStatus);
+ oprot.writeFieldEnd();
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ oprot.writeString(struct.status);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class DeadServerTupleSchemeFactory implements SchemeFactory {
+ public DeadServerTupleScheme getScheme() {
+ return new DeadServerTupleScheme();
+ }
+ }
+
+ private static class DeadServerTupleScheme extends TupleScheme<DeadServer> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, DeadServer struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetServer()) {
+ optionals.set(0);
+ }
+ if (struct.isSetLastStatus()) {
+ optionals.set(1);
+ }
+ if (struct.isSetStatus()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetServer()) {
+ oprot.writeString(struct.server);
+ }
+ if (struct.isSetLastStatus()) {
+ oprot.writeI64(struct.lastStatus);
+ }
+ if (struct.isSetStatus()) {
+ oprot.writeString(struct.status);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, DeadServer struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.server = iprot.readString();
+ struct.setServerIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.lastStatus = iprot.readI64();
+ struct.setLastStatusIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.status = iprot.readString();
+ struct.setStatusIsSet(true);
+ }
+ }
+ }
+
}