HBASE-12519 Remove tabs used as whitespace (Varun Saxena)

This commit is contained in:
stack 2014-11-28 20:50:02 -08:00
parent eb4c194a87
commit 58b6b24c29
64 changed files with 810 additions and 834 deletions

View File

@ -39,7 +39,7 @@ public class ExcludePrivateAnnotationsStandardDoclet {
public static boolean start(RootDoc root) {
System.out.println(
ExcludePrivateAnnotationsStandardDoclet.class.getSimpleName());
ExcludePrivateAnnotationsStandardDoclet.class.getSimpleName());
return Standard.start(RootDocProcessor.process(root));
}

View File

@ -65,10 +65,10 @@ class RootDocProcessor {
return getProxy(obj);
} else if (obj instanceof Object[]) {
Class<?> componentType = type.isArray() ? type.getComponentType()
: cls.getComponentType();
: cls.getComponentType();
Object[] array = (Object[]) obj;
Object[] newArray = (Object[]) Array.newInstance(componentType,
array.length);
array.length);
for (int i = 0; i < array.length; ++i) {
newArray[i] = process(array[i], componentType);
}
@ -98,116 +98,99 @@ class RootDocProcessor {
}
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String methodName = method.getName();
if (target instanceof Doc) {
if (methodName.equals("isIncluded")) {
Doc doc = (Doc) target;
return !exclude(doc) && doc.isIncluded();
}
if (target instanceof RootDoc) {
if (methodName.equals("classes")) {
return filter(((RootDoc) target).classes(), ClassDoc.class);
} else if (methodName.equals("specifiedClasses")) {
return filter(((RootDoc) target).specifiedClasses(), ClassDoc.class);
} else if (methodName.equals("specifiedPackages")) {
return filter(((RootDoc) target).specifiedPackages(), PackageDoc.class);
}
} else if (target instanceof ClassDoc) {
if (isFiltered(args)) {
if (methodName.equals("methods")) {
return filter(((ClassDoc) target).methods(true), MethodDoc.class);
} else if (methodName.equals("fields")) {
return filter(((ClassDoc) target).fields(true), FieldDoc.class);
} else if (methodName.equals("innerClasses")) {
return filter(((ClassDoc) target).innerClasses(true),
ClassDoc.class);
} else if (methodName.equals("constructors")) {
return filter(((ClassDoc) target).constructors(true),
ConstructorDoc.class);
}
}
} else if (target instanceof PackageDoc) {
if (methodName.equals("allClasses")) {
if (isFiltered(args)) {
return filter(((PackageDoc) target).allClasses(true),
ClassDoc.class);
} else {
return filter(((PackageDoc) target).allClasses(), ClassDoc.class);
}
} else if (methodName.equals("annotationTypes")) {
return filter(((PackageDoc) target).annotationTypes(),
AnnotationTypeDoc.class);
} else if (methodName.equals("enums")) {
return filter(((PackageDoc) target).enums(),
ClassDoc.class);
} else if (methodName.equals("errors")) {
return filter(((PackageDoc) target).errors(),
ClassDoc.class);
} else if (methodName.equals("exceptions")) {
return filter(((PackageDoc) target).exceptions(),
ClassDoc.class);
} else if (methodName.equals("interfaces")) {
return filter(((PackageDoc) target).interfaces(),
ClassDoc.class);
} else if (methodName.equals("ordinaryClasses")) {
return filter(((PackageDoc) target).ordinaryClasses(),
ClassDoc.class);
}
}
if (methodName.equals("isIncluded")) {
Doc doc = (Doc) target;
return !exclude(doc) && doc.isIncluded();
}
if (target instanceof RootDoc) {
if (methodName.equals("classes")) {
return filter(((RootDoc) target).classes(), ClassDoc.class);
} else if (methodName.equals("specifiedClasses")) {
return filter(((RootDoc) target).specifiedClasses(), ClassDoc.class);
} else if (methodName.equals("specifiedPackages")) {
return filter(((RootDoc) target).specifiedPackages(), PackageDoc.class);
}
} else if (target instanceof ClassDoc) {
if (isFiltered(args)) {
if (methodName.equals("methods")) {
return filter(((ClassDoc) target).methods(true), MethodDoc.class);
} else if (methodName.equals("fields")) {
return filter(((ClassDoc) target).fields(true), FieldDoc.class);
} else if (methodName.equals("innerClasses")) {
return filter(((ClassDoc) target).innerClasses(true), ClassDoc.class);
} else if (methodName.equals("constructors")) {
return filter(((ClassDoc) target).constructors(true), ConstructorDoc.class);
}
}
} else if (target instanceof PackageDoc) {
if (methodName.equals("allClasses")) {
if (isFiltered(args)) {
return filter(((PackageDoc) target).allClasses(true), ClassDoc.class);
} else {
return filter(((PackageDoc) target).allClasses(), ClassDoc.class);
}
} else if (methodName.equals("annotationTypes")) {
return filter(((PackageDoc) target).annotationTypes(), AnnotationTypeDoc.class);
} else if (methodName.equals("enums")) {
return filter(((PackageDoc) target).enums(), ClassDoc.class);
} else if (methodName.equals("errors")) {
return filter(((PackageDoc) target).errors(), ClassDoc.class);
} else if (methodName.equals("exceptions")) {
return filter(((PackageDoc) target).exceptions(), ClassDoc.class);
} else if (methodName.equals("interfaces")) {
return filter(((PackageDoc) target).interfaces(), ClassDoc.class);
} else if (methodName.equals("ordinaryClasses")) {
return filter(((PackageDoc) target).ordinaryClasses(), ClassDoc.class);
}
}
}
if (args != null) {
if (methodName.equals("compareTo") || methodName.equals("equals")
|| methodName.equals("overrides")
|| methodName.equals("subclassOf")) {
args[0] = unwrap(args[0]);
}
if (methodName.equals("compareTo") || methodName.equals("equals")
|| methodName.equals("overrides") || methodName.equals("subclassOf")) {
args[0] = unwrap(args[0]);
}
}
try {
return process(method.invoke(target, args), method.getReturnType());
return process(method.invoke(target, args), method.getReturnType());
} catch (InvocationTargetException e) {
throw e.getTargetException();
throw e.getTargetException();
}
}
private static boolean exclude(Doc doc) {
AnnotationDesc[] annotations = null;
if (doc instanceof ProgramElementDoc) {
annotations = ((ProgramElementDoc) doc).annotations();
annotations = ((ProgramElementDoc) doc).annotations();
} else if (doc instanceof PackageDoc) {
annotations = ((PackageDoc) doc).annotations();
annotations = ((PackageDoc) doc).annotations();
}
if (annotations != null) {
for (AnnotationDesc annotation : annotations) {
String qualifiedTypeName = annotation.annotationType().qualifiedTypeName();
if (qualifiedTypeName.equals(
InterfaceAudience.Private.class.getCanonicalName())
|| qualifiedTypeName.equals(
InterfaceAudience.LimitedPrivate.class.getCanonicalName())) {
return true;
}
if (stability.equals(StabilityOptions.EVOLVING_OPTION)) {
if (qualifiedTypeName.equals(
InterfaceStability.Unstable.class.getCanonicalName())) {
return true;
}
}
if (stability.equals(StabilityOptions.STABLE_OPTION)) {
if (qualifiedTypeName.equals(
InterfaceStability.Unstable.class.getCanonicalName())
|| qualifiedTypeName.equals(
InterfaceStability.Evolving.class.getCanonicalName())) {
return true;
}
}
}
for (AnnotationDesc annotation : annotations) {
String qualifiedTypeName =
annotation.annotationType().qualifiedTypeName();
if (qualifiedTypeName.equals(
InterfaceAudience.Public.class.getCanonicalName())) {
String qualifiedTypeName = annotation.annotationType().qualifiedTypeName();
if (qualifiedTypeName.equals(InterfaceAudience.Private.class.getCanonicalName())
|| qualifiedTypeName
.equals(InterfaceAudience.LimitedPrivate.class.getCanonicalName())) {
return true;
}
if (stability.equals(StabilityOptions.EVOLVING_OPTION)) {
if (qualifiedTypeName.equals(InterfaceStability.Unstable.class.getCanonicalName())) {
return true;
}
}
if (stability.equals(StabilityOptions.STABLE_OPTION)) {
if (qualifiedTypeName.equals(InterfaceStability.Unstable.class.getCanonicalName())
|| qualifiedTypeName.equals(InterfaceStability.Evolving.class.getCanonicalName())) {
return true;
}
}
}
for (AnnotationDesc annotation : annotations) {
String qualifiedTypeName = annotation.annotationType().qualifiedTypeName();
if (qualifiedTypeName.equals(InterfaceAudience.Public.class.getCanonicalName())) {
return false;
}
}
@ -220,28 +203,24 @@ class RootDocProcessor {
private static Object[] filter(Doc[] array, Class<?> componentType) {
if (array == null || array.length == 0) {
return array;
return array;
}
List<Object> list = new ArrayList<Object>(array.length);
for (Doc entry : array) {
if (!exclude(entry)) {
list.add(process(entry, componentType));
}
if (!exclude(entry)) {
list.add(process(entry, componentType));
}
}
return list.toArray((Object[]) Array.newInstance(componentType, list
.size()));
return list.toArray((Object[]) Array.newInstance(componentType, list.size()));
}
private Object unwrap(Object proxy) {
if (proxy instanceof Proxy)
return ((ExcludeHandler) Proxy.getInvocationHandler(proxy)).target;
if (proxy instanceof Proxy) return ((ExcludeHandler) Proxy.getInvocationHandler(proxy)).target;
return proxy;
}
private boolean isFiltered(Object[] args) {
return args != null && Boolean.TRUE.equals(args[0]);
}
}
}

View File

@ -35,16 +35,15 @@ class StabilityOptions {
return null;
}
public static void validOptions(String[][] options,
DocErrorReporter reporter) {
public static void validOptions(String[][] options, DocErrorReporter reporter) {
for (int i = 0; i < options.length; i++) {
String opt = options[i][0].toLowerCase();
if (opt.equals(UNSTABLE_OPTION)) {
RootDocProcessor.stability = UNSTABLE_OPTION;
RootDocProcessor.stability = UNSTABLE_OPTION;
} else if (opt.equals(EVOLVING_OPTION)) {
RootDocProcessor.stability = EVOLVING_OPTION;
RootDocProcessor.stability = EVOLVING_OPTION;
} else if (opt.equals(STABLE_OPTION)) {
RootDocProcessor.stability = STABLE_OPTION;
RootDocProcessor.stability = STABLE_OPTION;
}
}
}
@ -53,9 +52,9 @@ class StabilityOptions {
List<String[]> optionsList = new ArrayList<String[]>();
for (int i = 0; i < options.length; i++) {
if (!options[i][0].equalsIgnoreCase(UNSTABLE_OPTION)
&& !options[i][0].equalsIgnoreCase(EVOLVING_OPTION)
&& !options[i][0].equalsIgnoreCase(STABLE_OPTION)) {
optionsList.add(options[i]);
&& !options[i][0].equalsIgnoreCase(EVOLVING_OPTION)
&& !options[i][0].equalsIgnoreCase(STABLE_OPTION)) {
optionsList.add(options[i]);
}
}
String[][] filteredOptions = new String[optionsList.size()][];
@ -65,5 +64,4 @@ class StabilityOptions {
}
return filteredOptions;
}
}

View File

@ -973,7 +973,7 @@ public class HTableDescriptor implements Comparable<HTableDescriptor> {
* This compares the content of the two descriptors and not the reference.
*
* @return 0 if the contents of the descriptors are exactly matching,
* 1 if there is a mismatch in the contents
* 1 if there is a mismatch in the contents
*/
@Override
public int compareTo(@Nonnull final HTableDescriptor other) {

View File

@ -428,7 +428,7 @@ public class HTable implements HTableInterface, RegionLocator {
* @param tableName Name of table to check.
* @return {@code true} if table is online.
* @throws IOException if a remote or network exception occurs
* @deprecated use {@link HBaseAdmin#isTableEnabled(byte[])}
* @deprecated use {@link HBaseAdmin#isTableEnabled(byte[])}
*/
@Deprecated
public static boolean isTableEnabled(Configuration conf, String tableName)
@ -442,7 +442,7 @@ public class HTable implements HTableInterface, RegionLocator {
* @param tableName Name of table to check.
* @return {@code true} if table is online.
* @throws IOException if a remote or network exception occurs
* @deprecated use {@link HBaseAdmin#isTableEnabled(byte[])}
* @deprecated use {@link HBaseAdmin#isTableEnabled(byte[])}
*/
@Deprecated
public static boolean isTableEnabled(Configuration conf, byte[] tableName)

View File

@ -32,7 +32,7 @@ import org.apache.hadoop.hbase.classification.InterfaceStability;
public class UnmodifyableHTableDescriptor extends HTableDescriptor {
/** Default constructor */
public UnmodifyableHTableDescriptor() {
super();
super();
}
/*

View File

@ -180,12 +180,11 @@ public class AggregationClient implements Closeable {
*/
private void validateParameters(Scan scan, boolean canFamilyBeAbsent) throws IOException {
if (scan == null
|| (Bytes.equals(scan.getStartRow(), scan.getStopRow()) && !Bytes
.equals(scan.getStartRow(), HConstants.EMPTY_START_ROW))
|| ((Bytes.compareTo(scan.getStartRow(), scan.getStopRow()) > 0) &&
!Bytes.equals(scan.getStopRow(), HConstants.EMPTY_END_ROW))) {
throw new IOException(
"Agg client Exception: Startrow should be smaller than Stoprow");
|| (Bytes.equals(scan.getStartRow(), scan.getStopRow()) && !Bytes.equals(
scan.getStartRow(), HConstants.EMPTY_START_ROW))
|| ((Bytes.compareTo(scan.getStartRow(), scan.getStopRow()) > 0) && !Bytes.equals(
scan.getStopRow(), HConstants.EMPTY_END_ROW))) {
throw new IOException("Agg client Exception: Startrow should be smaller than Stoprow");
} else if (!canFamilyBeAbsent) {
if (scan.getFamilyMap().size() != 1) {
throw new IOException("There must be only one family.");

View File

@ -68,8 +68,8 @@ public class DependentColumnFilter extends CompareFilter {
* @param valueComparator comparator
*/
public DependentColumnFilter(final byte [] family, final byte[] qualifier,
final boolean dropDependentColumn, final CompareOp valueCompareOp,
final ByteArrayComparable valueComparator) {
final boolean dropDependentColumn, final CompareOp valueCompareOp,
final ByteArrayComparable valueComparator) {
// set up the comparator
super(valueCompareOp, valueComparator);
this.columnFamily = family;
@ -136,10 +136,10 @@ public class DependentColumnFilter extends CompareFilter {
@Override
public ReturnCode filterKeyValue(Cell c) {
// Check if the column and qualifier match
if (!CellUtil.matchingColumn(c, this.columnFamily, this.columnQualifier)) {
if (!CellUtil.matchingColumn(c, this.columnFamily, this.columnQualifier)) {
// include non-matches for the time being, they'll be discarded afterwards
return ReturnCode.INCLUDE;
}
}
// If it doesn't pass the op, skip it
if (comparator != null
&& doCompare(compareOp, comparator, c.getValueArray(), c.getValueOffset(),
@ -148,7 +148,7 @@ public class DependentColumnFilter extends CompareFilter {
stampSet.add(c.getTimestamp());
if(dropDependentColumn) {
return ReturnCode.SKIP;
return ReturnCode.SKIP;
}
return ReturnCode.INCLUDE;
}

View File

@ -1049,7 +1049,7 @@ public final class RequestConverter {
public static MoveRegionRequest buildMoveRegionRequest(
final byte [] encodedRegionName, final byte [] destServerName) throws
DeserializationException {
MoveRegionRequest.Builder builder = MoveRegionRequest.newBuilder();
MoveRegionRequest.Builder builder = MoveRegionRequest.newBuilder();
builder.setRegion(
buildRegionSpecifier(RegionSpecifierType.ENCODED_REGION_NAME,encodedRegionName));
if (destServerName != null) {

View File

@ -61,7 +61,7 @@ public class TimeRange {
* @param minStamp the minimum timestamp value, inclusive
*/
public TimeRange(byte [] minStamp) {
this.minStamp = Bytes.toLong(minStamp);
this.minStamp = Bytes.toLong(minStamp);
}
/**
@ -126,8 +126,8 @@ public class TimeRange {
* @return true if within TimeRange, false if not
*/
public boolean withinTimeRange(byte [] bytes, int offset) {
if(allTime) return true;
return withinTimeRange(Bytes.toLong(bytes, offset));
if(allTime) return true;
return withinTimeRange(Bytes.toLong(bytes, offset));
}
/**
@ -139,9 +139,9 @@ public class TimeRange {
* @return true if within TimeRange, false if not
*/
public boolean withinTimeRange(long timestamp) {
if(allTime) return true;
// check if >= minStamp
return (minStamp <= timestamp && timestamp < maxStamp);
if(allTime) return true;
// check if >= minStamp
return (minStamp <= timestamp && timestamp < maxStamp);
}
/**

View File

@ -43,7 +43,7 @@ public class CollectionUtils {
return in;
}
/************************ size ************************************/
/************************ size ************************************/
public static <T> int nullSafeSize(Collection<T> collection) {
if (collection == null) {
@ -56,7 +56,7 @@ public class CollectionUtils {
return nullSafeSize(a) == nullSafeSize(b);
}
/*************************** empty ****************************************/
/*************************** empty ****************************************/
public static <T> boolean isEmpty(Collection<T> collection) {
return collection == null || collection.isEmpty();
@ -66,7 +66,7 @@ public class CollectionUtils {
return !isEmpty(collection);
}
/************************ first/last **************************/
/************************ first/last **************************/
public static <T> T getFirst(Collection<T> collection) {
if (CollectionUtils.isEmpty(collection)) {

View File

@ -164,7 +164,7 @@ public class JenkinsHash extends Hash {
//-------------------------------- last block: affect all 32 bits of (c)
switch (length) { // all the case statements fall through
case 12:
c += ((key[offset + 11] & BYTE_MASK) << 24);
c += ((key[offset + 11] & BYTE_MASK) << 24);
case 11:
c += ((key[offset + 10] & BYTE_MASK) << 16);
case 10:

View File

@ -201,7 +201,7 @@ public class TestHBaseConfiguration {
hadoopClassesAvailable = true;
LOG.info("Credential provider classes have been" +
" loaded and initialized successfully through reflection.");
" loaded and initialized successfully through reflection.");
return true;
}
@ -280,7 +280,7 @@ public class TestHBaseConfiguration {
List<Object> providers = getCredentialProviders(conf);
if (null == providers) {
throw new IOException("Could not fetch any CredentialProviders, " +
"is the implementation available?");
"is the implementation available?");
}
Object provider = providers.get(0);

View File

@ -583,8 +583,8 @@ public class IntegrationTestBigLinkedListWithVisibility extends IntegrationTestB
if (args.length < 5) {
System.err
.println("Usage: Loop <num iterations> " +
"<num mappers> <num nodes per mapper> <output dir> " +
"<num reducers> [<width> <wrap multiplier>]");
"<num mappers> <num nodes per mapper> <output dir> " +
"<num reducers> [<width> <wrap multiplier>]");
return 1;
}
LOG.info("Running Loop with args:" + Arrays.deepToString(args));

View File

@ -45,7 +45,7 @@ public class PrefixTreeBlockMeta {
public static final int MAX_FAMILY_LENGTH = Byte.MAX_VALUE;// hard-coded in KeyValue
public static final int
NUM_LONGS = 2,
NUM_LONGS = 2,
NUM_INTS = 28,
NUM_SHORTS = 0,//keyValueTypeWidth not persisted
NUM_SINGLE_BYTES = 2,
@ -135,7 +135,7 @@ public class PrefixTreeBlockMeta {
}
/**************** operate on each field **********************/
/**************** operate on each field **********************/
public int calculateNumMetaBytes(){
int numBytes = 0;
@ -339,7 +339,7 @@ public class PrefixTreeBlockMeta {
position += UVIntTool.numBytes(numUniqueTags);
}
//TODO method that can read directly from ByteBuffer instead of InputStream
//TODO method that can read directly from ByteBuffer instead of InputStream
/*************** methods *************************/

View File

@ -306,7 +306,7 @@ public class PrefixTreeArraySearcher extends PrefixTreeArrayReversibleScanner im
}
/****************** complete seek when token mismatch ******************/
/****************** complete seek when token mismatch ******************/
/**
* @param searcherIsAfterInputKey <0: input key is before the searcher's position<br/>

View File

@ -71,7 +71,7 @@ public class ColumnSectionWriter {
private List<Integer> outputArrayOffsets;
/*********************** construct *********************/
/*********************** construct *********************/
public ColumnSectionWriter() {
this.nonLeaves = Lists.newArrayList();
@ -100,7 +100,7 @@ public class ColumnSectionWriter {
}
/****************** methods *******************************/
/****************** methods *******************************/
public ColumnSectionWriter compile() {
if (this.nodeType == ColumnNodeType.FAMILY) {

View File

@ -75,7 +75,7 @@ public class LongEncoder {
}
/************* methods ***************************/
/************* methods ***************************/
public void add(long timestamp) {
uniqueValues.add(timestamp);
@ -158,7 +158,7 @@ public class LongEncoder {
}
/******************** get/set **************************/
/******************** get/set **************************/
public long getMin() {
return min;

View File

@ -179,7 +179,7 @@ public class Tokenizer{
}
/********************** write ***************************/
/********************** write ***************************/
public Tokenizer setNodeFirstInsertionIndexes() {
root.setInsertionIndexes(0);

View File

@ -289,7 +289,7 @@ public class TokenizerNode{
}
/************************ byte[] utils *************************/
/************************ byte[] utils *************************/
protected boolean partiallyMatchesToken(ByteRange bytes) {
return numIdenticalBytes(bytes) > 0;
@ -304,7 +304,7 @@ public class TokenizerNode{
}
/***************** moving nodes around ************************/
/***************** moving nodes around ************************/
public void appendNodesToExternalList(List<TokenizerNode> appendTo, boolean includeNonLeaves,
boolean includeLeaves) {
@ -462,7 +462,7 @@ public class TokenizerNode{
}
/********************** count different node types ********************/
/********************** count different node types ********************/
public int getNumBranchNodesIncludingThisNode() {
if (isLeaf()) {

View File

@ -30,9 +30,9 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
@InterfaceAudience.Private
public enum TokenizerRowSearchPosition {
AFTER,//the key is after this tree node, so keep searching
BEFORE,//in a binary search, this tells us to back up
MATCH,//the current node is a full match
NO_MATCH,//might as well return a value more informative than null
AFTER,//the key is after this tree node, so keep searching
BEFORE,//in a binary search, this tells us to back up
MATCH,//the current node is a full match
NO_MATCH,//might as well return a value more informative than null
}

View File

@ -78,13 +78,13 @@ public class UFIntTool {
private static final long[] MASKS = new long[] {
(long) 255,
(long) 255 << 8,
(long) 255 << 16,
(long) 255 << 24,
(long) 255 << 32,
(long) 255 << 40,
(long) 255 << 48,
(long) 255 << 56
(long) 255 << 8,
(long) 255 << 16,
(long) 255 << 24,
(long) 255 << 32,
(long) 255 << 40,
(long) 255 << 48,
(long) 255 << 56
};
public static void writeBytes(int outputWidth, final long value, OutputStream os) throws IOException {

View File

@ -48,7 +48,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class TestPrefixTreeSearcher {
protected static int BLOCK_START = 7;
protected static int BLOCK_START = 7;
@Parameters
public static Collection<Object[]> parameters() {

View File

@ -77,7 +77,7 @@ public class TestRowEncoder {
this.rows = testRows;
}
@Before
@Before
public void compile() throws IOException {
// Always run with tags. But should also ensure that KVs without tags work fine
os = new ByteArrayOutputStream(1 << 20);
@ -175,7 +175,7 @@ public class TestRowEncoder {
}
/**************** helper **************************/
/**************** helper **************************/
protected void assertKeyAndValueEqual(Cell expected, Cell actual) {
// assert keys are equal (doesn't compare values)

View File

@ -29,7 +29,7 @@ import com.google.common.collect.Lists;
public class TestRowDataComplexQualifiers extends BaseTestRowData{
static byte[]
static byte[]
Arow = Bytes.toBytes("Arow"),
cf = PrefixTreeTestConstants.TEST_CF,
v0 = Bytes.toBytes("v0");

View File

@ -36,36 +36,36 @@ import com.google.common.collect.Lists;
*/
public class TestRowDataDeeper extends BaseTestRowData{
static byte[]
cdc = Bytes.toBytes("cdc"),
cf6 = Bytes.toBytes("cf6"),
cfc = Bytes.toBytes("cfc"),
f = Bytes.toBytes("f"),
q = Bytes.toBytes("q"),
v = Bytes.toBytes("v");
static byte[]
cdc = Bytes.toBytes("cdc"),
cf6 = Bytes.toBytes("cf6"),
cfc = Bytes.toBytes("cfc"),
f = Bytes.toBytes("f"),
q = Bytes.toBytes("q"),
v = Bytes.toBytes("v");
static long
ts = 55L;
static long
ts = 55L;
static List<KeyValue> d = Lists.newArrayList();
static{
d.add(new KeyValue(cdc, f, q, ts, v));
static List<KeyValue> d = Lists.newArrayList();
static{
d.add(new KeyValue(cdc, f, q, ts, v));
d.add(new KeyValue(cf6, f, q, ts, v));
d.add(new KeyValue(cfc, f, q, ts, v));
}
}
@Override
public List<KeyValue> getInputs() {
return d;
}
@Override
public List<KeyValue> getInputs() {
return d;
}
@Override
public void individualBlockMetaAssertions(PrefixTreeBlockMeta blockMeta) {
//0: token:c; fan:d,f
//1: token:f; fan:6,c
//2: leaves
Assert.assertEquals(3, blockMeta.getRowTreeDepth());
}
@Override
public void individualBlockMetaAssertions(PrefixTreeBlockMeta blockMeta) {
//0: token:c; fan:d,f
//1: token:f; fan:6,c
//2: leaves
Assert.assertEquals(3, blockMeta.getRowTreeDepth());
}
@Override
public void individualSearcherAssertions(CellSearcher searcher) {

View File

@ -33,62 +33,62 @@ import com.google.common.collect.Lists;
*/
public class TestRowDataDifferentTimestamps extends BaseTestRowData{
static byte[]
Arow = Bytes.toBytes("Arow"),
Brow = Bytes.toBytes("Brow"),
cf = Bytes.toBytes("fammy"),
cq0 = Bytes.toBytes("cq0"),
cq1 = Bytes.toBytes("cq1"),
v0 = Bytes.toBytes("v0");
static byte[]
Arow = Bytes.toBytes("Arow"),
Brow = Bytes.toBytes("Brow"),
cf = Bytes.toBytes("fammy"),
cq0 = Bytes.toBytes("cq0"),
cq1 = Bytes.toBytes("cq1"),
v0 = Bytes.toBytes("v0");
static List<KeyValue> d = Lists.newArrayList();
static{
KeyValue kv0 = new KeyValue(Arow, cf, cq0, 0L, v0);
kv0.setSequenceId(123456789L);
d.add(kv0);
static List<KeyValue> d = Lists.newArrayList();
static{
KeyValue kv0 = new KeyValue(Arow, cf, cq0, 0L, v0);
kv0.setSequenceId(123456789L);
d.add(kv0);
KeyValue kv1 = new KeyValue(Arow, cf, cq1, 1L, v0);
KeyValue kv1 = new KeyValue(Arow, cf, cq1, 1L, v0);
kv1.setSequenceId(3L);
d.add(kv1);
KeyValue kv2 = new KeyValue(Brow, cf, cq0, 12345678L, v0);
KeyValue kv2 = new KeyValue(Brow, cf, cq0, 12345678L, v0);
kv2.setSequenceId(65537L);
d.add(kv2);
//watch out... Long.MAX_VALUE comes back as 1332221664203, even with other encoders
// d.add(new KeyValue(Brow, cf, cq1, Long.MAX_VALUE, v0));
KeyValue kv3 = new KeyValue(Brow, cf, cq1, Long.MAX_VALUE-1, v0);
//watch out... Long.MAX_VALUE comes back as 1332221664203, even with other encoders
//d.add(new KeyValue(Brow, cf, cq1, Long.MAX_VALUE, v0));
KeyValue kv3 = new KeyValue(Brow, cf, cq1, Long.MAX_VALUE-1, v0);
kv3.setSequenceId(1L);
d.add(kv3);
KeyValue kv4 = new KeyValue(Brow, cf, cq1, 999999999, v0);
KeyValue kv4 = new KeyValue(Brow, cf, cq1, 999999999, v0);
//don't set memstoreTS
d.add(kv4);
d.add(kv4);
KeyValue kv5 = new KeyValue(Brow, cf, cq1, 12345, v0);
KeyValue kv5 = new KeyValue(Brow, cf, cq1, 12345, v0);
kv5.setSequenceId(0L);
d.add(kv5);
}
}
@Override
public List<KeyValue> getInputs() {
return d;
}
@Override
public List<KeyValue> getInputs() {
return d;
}
@Override
public void individualBlockMetaAssertions(PrefixTreeBlockMeta blockMeta) {
Assert.assertTrue(blockMeta.getNumMvccVersionBytes() > 0);
Assert.assertEquals(12, blockMeta.getNumValueBytes());
@Override
public void individualBlockMetaAssertions(PrefixTreeBlockMeta blockMeta) {
Assert.assertTrue(blockMeta.getNumMvccVersionBytes() > 0);
Assert.assertEquals(12, blockMeta.getNumValueBytes());
Assert.assertFalse(blockMeta.isAllSameTimestamp());
Assert.assertNotNull(blockMeta.getMinTimestamp());
Assert.assertTrue(blockMeta.getTimestampIndexWidth() > 0);
Assert.assertTrue(blockMeta.getTimestampDeltaWidth() > 0);
Assert.assertFalse(blockMeta.isAllSameTimestamp());
Assert.assertNotNull(blockMeta.getMinTimestamp());
Assert.assertTrue(blockMeta.getTimestampIndexWidth() > 0);
Assert.assertTrue(blockMeta.getTimestampDeltaWidth() > 0);
Assert.assertFalse(blockMeta.isAllSameMvccVersion());
Assert.assertNotNull(blockMeta.getMinMvccVersion());
Assert.assertTrue(blockMeta.getMvccVersionIndexWidth() > 0);
Assert.assertTrue(blockMeta.getMvccVersionDeltaWidth() > 0);
}
}
}

View File

@ -42,49 +42,49 @@ import com.google.common.collect.Lists;
public class TestRowDataExerciseFInts extends BaseTestRowData{
static List<ByteRange> rows;
static{
List<String> rowStrings = new ArrayList<String>();
rowStrings.add("com.edsBlog/directoryAa/pageAaa");
rowStrings.add("com.edsBlog/directoryAa/pageBbb");
rowStrings.add("com.edsBlog/directoryAa/pageCcc");
rowStrings.add("com.edsBlog/directoryAa/pageDdd");
rowStrings.add("com.edsBlog/directoryBb/pageEee");
rowStrings.add("com.edsBlog/directoryBb/pageFff");
rowStrings.add("com.edsBlog/directoryBb/pageGgg");
rowStrings.add("com.edsBlog/directoryBb/pageHhh");
rowStrings.add("com.isabellasBlog/directoryAa/pageAaa");
rowStrings.add("com.isabellasBlog/directoryAa/pageBbb");
rowStrings.add("com.isabellasBlog/directoryAa/pageCcc");
rowStrings.add("com.isabellasBlog/directoryAa/pageDdd");
rowStrings.add("com.isabellasBlog/directoryBb/pageEee");
rowStrings.add("com.isabellasBlog/directoryBb/pageFff");
rowStrings.add("com.isabellasBlog/directoryBb/pageGgg");
rowStrings.add("com.isabellasBlog/directoryBb/pageHhh");
ByteRangeTreeSet ba = new ByteRangeTreeSet();
for(String row : rowStrings){
ba.add(new SimpleMutableByteRange(Bytes.toBytes(row)));
}
rows = ba.compile().getSortedRanges();
}
static{
List<String> rowStrings = new ArrayList<String>();
rowStrings.add("com.edsBlog/directoryAa/pageAaa");
rowStrings.add("com.edsBlog/directoryAa/pageBbb");
rowStrings.add("com.edsBlog/directoryAa/pageCcc");
rowStrings.add("com.edsBlog/directoryAa/pageDdd");
rowStrings.add("com.edsBlog/directoryBb/pageEee");
rowStrings.add("com.edsBlog/directoryBb/pageFff");
rowStrings.add("com.edsBlog/directoryBb/pageGgg");
rowStrings.add("com.edsBlog/directoryBb/pageHhh");
rowStrings.add("com.isabellasBlog/directoryAa/pageAaa");
rowStrings.add("com.isabellasBlog/directoryAa/pageBbb");
rowStrings.add("com.isabellasBlog/directoryAa/pageCcc");
rowStrings.add("com.isabellasBlog/directoryAa/pageDdd");
rowStrings.add("com.isabellasBlog/directoryBb/pageEee");
rowStrings.add("com.isabellasBlog/directoryBb/pageFff");
rowStrings.add("com.isabellasBlog/directoryBb/pageGgg");
rowStrings.add("com.isabellasBlog/directoryBb/pageHhh");
ByteRangeTreeSet ba = new ByteRangeTreeSet();
for(String row : rowStrings){
ba.add(new SimpleMutableByteRange(Bytes.toBytes(row)));
}
rows = ba.compile().getSortedRanges();
}
static List<String> cols = Lists.newArrayList();
static{
cols.add("Chrome");
cols.add("Chromeb");
cols.add("Firefox");
cols.add("InternetExplorer");
cols.add("Opera");
cols.add("Safari");
cols.add("Z1stBrowserWithHuuuuuuuuuuuugeQualifier");
cols.add("Z2ndBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z3rdBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z4thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z5thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z6thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z7thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z8thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z9thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
}
static List<String> cols = Lists.newArrayList();
static{
cols.add("Chrome");
cols.add("Chromeb");
cols.add("Firefox");
cols.add("InternetExplorer");
cols.add("Opera");
cols.add("Safari");
cols.add("Z1stBrowserWithHuuuuuuuuuuuugeQualifier");
cols.add("Z2ndBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z3rdBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z4thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z5thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z6thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z7thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z8thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
cols.add("Z9thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
}
static long ts = 1234567890;

View File

@ -29,31 +29,31 @@ import com.google.common.collect.Lists;
public class TestRowDataNub extends BaseTestRowData{
static byte[]
rowA = Bytes.toBytes("rowA"),
rowB = Bytes.toBytes("rowB"),//nub
rowBB = Bytes.toBytes("rowBB"),
cf = PrefixTreeTestConstants.TEST_CF,
cq0 = Bytes.toBytes("cq0"),
cq1 = Bytes.toBytes("cq1"),
v0 = Bytes.toBytes("v0");
static byte[]
rowA = Bytes.toBytes("rowA"),
rowB = Bytes.toBytes("rowB"),//nub
rowBB = Bytes.toBytes("rowBB"),
cf = PrefixTreeTestConstants.TEST_CF,
cq0 = Bytes.toBytes("cq0"),
cq1 = Bytes.toBytes("cq1"),
v0 = Bytes.toBytes("v0");
static long
ts = 55L;
static long
ts = 55L;
static List<KeyValue> d = Lists.newArrayList();
static{
d.add(new KeyValue(rowA, cf, cq0, ts, v0));
d.add(new KeyValue(rowA, cf, cq1, ts, v0));
d.add(new KeyValue(rowB, cf, cq0, ts, v0));
d.add(new KeyValue(rowB, cf, cq1, ts, v0));
d.add(new KeyValue(rowBB, cf, cq0, ts, v0));
d.add(new KeyValue(rowBB, cf, cq1, ts, v0));
}
static List<KeyValue> d = Lists.newArrayList();
static{
d.add(new KeyValue(rowA, cf, cq0, ts, v0));
d.add(new KeyValue(rowA, cf, cq1, ts, v0));
d.add(new KeyValue(rowB, cf, cq0, ts, v0));
d.add(new KeyValue(rowB, cf, cq1, ts, v0));
d.add(new KeyValue(rowBB, cf, cq0, ts, v0));
d.add(new KeyValue(rowBB, cf, cq1, ts, v0));
}
@Override
public List<KeyValue> getInputs() {
return d;
}
@Override
public List<KeyValue> getInputs() {
return d;
}
}

View File

@ -28,15 +28,15 @@ import com.google.common.collect.Lists;
public class TestRowDataQualifierByteOrdering extends BaseTestRowData{
static byte[]
Arow = Bytes.toBytes("Arow"),
Brow = Bytes.toBytes("Brow"),
Brow2 = Bytes.toBytes("Brow2"),
fam = Bytes.toBytes("HappyFam"),
cq0 = Bytes.toBytes("cq0"),
cq1 = Bytes.toBytes("cq1tail"),//make sure tail does not come back as liat
cq2 = Bytes.toBytes("cq2"),
v0 = Bytes.toBytes("v0");
static byte[]
Arow = Bytes.toBytes("Arow"),
Brow = Bytes.toBytes("Brow"),
Brow2 = Bytes.toBytes("Brow2"),
fam = Bytes.toBytes("HappyFam"),
cq0 = Bytes.toBytes("cq0"),
cq1 = Bytes.toBytes("cq1tail"),//make sure tail does not come back as liat
cq2 = Bytes.toBytes("cq2"),
v0 = Bytes.toBytes("v0");
static long ts = 55L;

View File

@ -55,13 +55,13 @@ public class TestRowDataSearcherRowMiss extends BaseTestRowData{
d.add(new KeyValue(B, cf, cq, ts, v));
}
@Override
public List<KeyValue> getInputs() {
return d;
}
@Override
public List<KeyValue> getInputs() {
return d;
}
@Override
public void individualSearcherAssertions(CellSearcher searcher) {
@Override
public void individualSearcherAssertions(CellSearcher searcher) {
assertRowOffsetsCorrect();
searcher.resetToBeforeFirstEntry();
@ -83,13 +83,13 @@ public class TestRowDataSearcherRowMiss extends BaseTestRowData{
testBetween2and3(searcher);
}
/************ private methods, call from above *******************/
/************ private methods, call from above *******************/
private void assertRowOffsetsCorrect(){
Assert.assertEquals(4, getRowStartIndexes().size());
}
private void assertRowOffsetsCorrect(){
Assert.assertEquals(4, getRowStartIndexes().size());
}
private void testBetween1and2(CellSearcher searcher){
private void testBetween1and2(CellSearcher searcher){
CellScannerPosition p;//reuse
Cell betweenAAndAAA = new KeyValue(AA, cf, cq, ts-2, v);
@ -105,7 +105,7 @@ public class TestRowDataSearcherRowMiss extends BaseTestRowData{
p = searcher.positionAtOrAfter(betweenAAndAAA);
Assert.assertEquals(CellScannerPosition.AFTER, p);
Assert.assertTrue(CellComparator.equals(searcher.current(), d.get(2)));
}
}
private void testBetween2and3(CellSearcher searcher){
CellScannerPosition p;//reuse

View File

@ -29,12 +29,12 @@ import com.google.common.collect.Lists;
public class TestRowDataSingleQualifier extends BaseTestRowData{
static byte[]
rowA = Bytes.toBytes("rowA"),
rowB = Bytes.toBytes("rowB"),
cf = PrefixTreeTestConstants.TEST_CF,
cq0 = Bytes.toBytes("cq0"),
v0 = Bytes.toBytes("v0");
static byte[]
rowA = Bytes.toBytes("rowA"),
rowB = Bytes.toBytes("rowB"),
cf = PrefixTreeTestConstants.TEST_CF,
cq0 = Bytes.toBytes("cq0"),
v0 = Bytes.toBytes("v0");
static long ts = 55L;

View File

@ -33,12 +33,12 @@ import com.google.common.collect.Lists;
public class TestRowDataTrivial extends BaseTestRowData{
static byte[]
rA = Bytes.toBytes("rA"),
rB = Bytes.toBytes("rB"),//turn "r" into a branch for the Searcher tests
cf = Bytes.toBytes("fam"),
cq0 = Bytes.toBytes("q0"),
v0 = Bytes.toBytes("v0");
static byte[]
rA = Bytes.toBytes("rA"),
rB = Bytes.toBytes("rB"),//turn "r" into a branch for the Searcher tests
cf = Bytes.toBytes("fam"),
cq0 = Bytes.toBytes("q0"),
v0 = Bytes.toBytes("v0");
static long ts = 55L;

View File

@ -40,7 +40,7 @@ import com.google.common.collect.Lists;
public class TestRowDataUrls extends BaseTestRowData{
static List<ByteRange> rows;
static{
static{
List<String> rowStrings = new ArrayList<String>();
rowStrings.add("com.edsBlog/directoryAa/pageAaa");
rowStrings.add("com.edsBlog/directoryAa/pageBbb");

View File

@ -51,33 +51,33 @@ public class TestRowDataUrlsExample extends BaseTestRowData{
static String FAMILY = "hits";
static List<String> BROWSERS = Lists.newArrayList(
"Chrome", "IE8", "IE9beta");//, "Opera", "Safari");
static long TIMESTAMP = 1234567890;
static long TIMESTAMP = 1234567890;
static int MAX_VALUE = 50;
static int MAX_VALUE = 50;
static List<KeyValue> kvs = Lists.newArrayList();
static{
for(String rowKey : URLS){
for(String qualifier : BROWSERS){
KeyValue kv = new KeyValue(
Bytes.toBytes(rowKey),
Bytes.toBytes(FAMILY),
Bytes.toBytes(qualifier),
TIMESTAMP,
KeyValue.Type.Put,
Bytes.toBytes("VvvV"));
kvs.add(kv);
}
}
}
static List<KeyValue> kvs = Lists.newArrayList();
static{
for(String rowKey : URLS){
for(String qualifier : BROWSERS){
KeyValue kv = new KeyValue(
Bytes.toBytes(rowKey),
Bytes.toBytes(FAMILY),
Bytes.toBytes(qualifier),
TIMESTAMP,
KeyValue.Type.Put,
Bytes.toBytes("VvvV"));
kvs.add(kv);
}
}
}
/**
* Used for generating docs.
*/
public static void main(String... args) throws IOException{
/**
* Used for generating docs.
*/
public static void main(String... args) throws IOException{
System.out.println("-- inputs --");
System.out.println(KeyValueTestUtil.toStringWithPadding(kvs, true));
ByteArrayOutputStream os = new ByteArrayOutputStream(1<<20);
ByteArrayOutputStream os = new ByteArrayOutputStream(1<<20);
PrefixTreeEncoder encoder = new PrefixTreeEncoder(os, false);
for(KeyValue kv : kvs){
@ -116,11 +116,11 @@ public class TestRowDataUrlsExample extends BaseTestRowData{
System.out.println("-- concatenated values --");
System.out.println(Bytes.toStringBinary(encoder.getValueByteRange().deepCopyToNewArray()));
}
}
@Override
public List<KeyValue> getInputs() {
return kvs;
}
@Override
public List<KeyValue> getInputs() {
return kvs;
}
}

View File

@ -40,39 +40,39 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
@XmlRootElement(name="ClusterVersion")
@InterfaceAudience.Private
public class StorageClusterVersionModel implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private String version;
private String version;
/**
* @return the storage cluster version
*/
@XmlValue
public String getVersion() {
return version;
}
/**
* @return the storage cluster version
*/
@XmlValue
public String getVersion() {
return version;
}
/**
* @param version the storage cluster version
*/
public void setVersion(String version) {
this.version = version;
}
/**
* @param version the storage cluster version
*/
public void setVersion(String version) {
this.version = version;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@JsonValue
@Override
public String toString() {
return version;
}
@Override
public String toString() {
return version;
}
//needed for jackson deserialization
private static StorageClusterVersionModel valueOf(String value) {
StorageClusterVersionModel versionModel
= new StorageClusterVersionModel();
versionModel.setVersion(value);
return versionModel;
}
//needed for jackson deserialization
private static StorageClusterVersionModel valueOf(String value) {
StorageClusterVersionModel versionModel
= new StorageClusterVersionModel();
versionModel.setVersion(value);
return versionModel;
}
}

View File

@ -38,67 +38,67 @@ import org.apache.hadoop.hbase.rest.protobuf.generated.TableListMessage.TableLis
@InterfaceAudience.Private
public class TableListModel implements Serializable, ProtobufMessageHandler {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private List<TableModel> tables = new ArrayList<TableModel>();
private List<TableModel> tables = new ArrayList<TableModel>();
/**
* Default constructor
*/
public TableListModel() {}
/**
* Default constructor
*/
public TableListModel() {}
/**
* Add the table name model to the list
* @param table the table model
*/
public void add(TableModel table) {
tables.add(table);
}
/**
* Add the table name model to the list
* @param table the table model
*/
public void add(TableModel table) {
tables.add(table);
}
/**
* @param index the index
* @return the table model
*/
public TableModel get(int index) {
return tables.get(index);
}
/**
* @param index the index
* @return the table model
*/
public TableModel get(int index) {
return tables.get(index);
}
/**
* @return the tables
*/
@XmlElementRef(name="table")
public List<TableModel> getTables() {
return tables;
}
/**
* @return the tables
*/
@XmlElementRef(name="table")
public List<TableModel> getTables() {
return tables;
}
/**
* @param tables the tables to set
*/
public void setTables(List<TableModel> tables) {
this.tables = tables;
}
/**
* @param tables the tables to set
*/
public void setTables(List<TableModel> tables) {
this.tables = tables;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for(TableModel aTable : tables) {
sb.append(aTable.toString());
sb.append('\n');
}
return sb.toString();
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for(TableModel aTable : tables) {
sb.append(aTable.toString());
sb.append('\n');
}
return sb.toString();
}
@Override
public byte[] createProtobufOutput() {
TableList.Builder builder = TableList.newBuilder();
for (TableModel aTable : tables) {
builder.addName(aTable.getName());
}
return builder.build().toByteArray();
}
@Override
public byte[] createProtobufOutput() {
TableList.Builder builder = TableList.newBuilder();
for (TableModel aTable : tables) {
builder.addName(aTable.getName());
}
return builder.build().toByteArray();
}
@Override
public ProtobufMessageHandler getObjectFromMessage(byte[] message)

View File

@ -41,44 +41,44 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
@InterfaceAudience.Private
public class TableModel implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private String name;
private String name;
/**
* Default constructor
*/
public TableModel() {}
/**
* Default constructor
*/
public TableModel() {}
/**
* Constructor
* @param name
*/
public TableModel(String name) {
super();
this.name = name;
}
/**
* Constructor
* @param name
*/
public TableModel(String name) {
super();
this.name = name;
}
/**
* @return the name
*/
@XmlAttribute
public String getName() {
return name;
}
/**
* @return the name
*/
@XmlAttribute
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return this.name;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return this.name;
}
}

View File

@ -48,9 +48,9 @@ import com.sun.jersey.spi.container.servlet.ServletContainer;
@InterfaceAudience.Private
public class VersionModel implements Serializable, ProtobufMessageHandler {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private String restVersion;
private String restVersion;
private String jvmVersion;
private String osVersion;
private String serverVersion;
@ -65,30 +65,30 @@ public class VersionModel implements Serializable, ProtobufMessageHandler {
* Constructor
* @param context the servlet context
*/
public VersionModel(ServletContext context) {
restVersion = RESTServlet.VERSION_STRING;
jvmVersion = System.getProperty("java.vm.vendor") + ' ' +
public VersionModel(ServletContext context) {
restVersion = RESTServlet.VERSION_STRING;
jvmVersion = System.getProperty("java.vm.vendor") + ' ' +
System.getProperty("java.version") + '-' +
System.getProperty("java.vm.version");
osVersion = System.getProperty("os.name") + ' ' +
osVersion = System.getProperty("os.name") + ' ' +
System.getProperty("os.version") + ' ' +
System.getProperty("os.arch");
serverVersion = context.getServerInfo();
jerseyVersion = ServletContainer.class.getPackage()
serverVersion = context.getServerInfo();
jerseyVersion = ServletContainer.class.getPackage()
.getImplementationVersion();
}
}
/**
* @return the REST gateway version
*/
@XmlAttribute(name="REST")
public String getRESTVersion() {
/**
* @return the REST gateway version
*/
@XmlAttribute(name="REST")
public String getRESTVersion() {
return restVersion;
}
/**
* @return the JVM vendor and version
*/
/**
* @return the JVM vendor and version
*/
@XmlAttribute(name="JVM")
public String getJVMVersion() {
return jvmVersion;
@ -154,34 +154,34 @@ public class VersionModel implements Serializable, ProtobufMessageHandler {
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("rest ");
sb.append(restVersion);
sb.append(" [JVM: ");
sb.append(jvmVersion);
sb.append("] [OS: ");
sb.append(osVersion);
sb.append("] [Server: ");
sb.append(serverVersion);
sb.append("] [Jersey: ");
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("rest ");
sb.append(restVersion);
sb.append(" [JVM: ");
sb.append(jvmVersion);
sb.append("] [OS: ");
sb.append(osVersion);
sb.append("] [Server: ");
sb.append(serverVersion);
sb.append("] [Jersey: ");
sb.append(jerseyVersion);
sb.append("]\n");
return sb.toString();
}
sb.append("]\n");
return sb.toString();
}
@Override
@Override
public byte[] createProtobufOutput() {
Version.Builder builder = Version.newBuilder();
builder.setRestVersion(restVersion);
builder.setJvmVersion(jvmVersion);
builder.setOsVersion(osVersion);
builder.setServerVersion(serverVersion);
builder.setJerseyVersion(jerseyVersion);
return builder.build().toByteArray();
Version.Builder builder = Version.newBuilder();
builder.setRestVersion(restVersion);
builder.setJvmVersion(jvmVersion);
builder.setOsVersion(osVersion);
builder.setServerVersion(serverVersion);
builder.setJerseyVersion(jerseyVersion);
return builder.build().toByteArray();
}
@Override

View File

@ -55,12 +55,12 @@ import com.sun.jersey.api.json.JSONJAXBContext;
@InterfaceAudience.Private
public class JAXBContextResolver implements ContextResolver<JAXBContext> {
private final JAXBContext context;
private final JAXBContext context;
private final Set<Class<?>> types;
private final Set<Class<?>> types;
private final Class<?>[] cTypes = {
CellModel.class,
private final Class<?>[] cTypes = {
CellModel.class,
CellSetModel.class,
ColumnSchemaModel.class,
RowModel.class,
@ -68,22 +68,22 @@ public class JAXBContextResolver implements ContextResolver<JAXBContext> {
StorageClusterStatusModel.class,
StorageClusterVersionModel.class,
TableInfoModel.class,
TableListModel.class,
TableModel.class,
TableRegionModel.class,
TableSchemaModel.class,
VersionModel.class
};
TableListModel.class,
TableModel.class,
TableRegionModel.class,
TableSchemaModel.class,
VersionModel.class
};
@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked")
public JAXBContextResolver() throws Exception {
this.types = new HashSet(Arrays.asList(cTypes));
this.context = new JSONJAXBContext(JSONConfiguration.natural().build(),
cTypes);
}
this.types = new HashSet(Arrays.asList(cTypes));
this.context = new JSONJAXBContext(JSONConfiguration.natural().build(),
cTypes);
}
@Override
public JAXBContext getContext(Class<?> objectType) {
return (types.contains(objectType)) ? context : null;
@Override
public JAXBContext getContext(Class<?> objectType) {
return (types.contains(objectType)) ? context : null;
}
}

View File

@ -54,21 +54,21 @@ public class PlainTextMessageBodyProducer
return true;
}
@Override
public long getSize(Object object, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
@Override
public long getSize(Object object, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
byte[] bytes = object.toString().getBytes();
buffer.set(bytes);
buffer.set(bytes);
return bytes.length;
}
}
@Override
public void writeTo(Object object, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream outStream)
throws IOException, WebApplicationException {
@Override
public void writeTo(Object object, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream outStream)
throws IOException, WebApplicationException {
byte[] bytes = buffer.get();
outStream.write(bytes);
outStream.write(bytes);
buffer.remove();
}
}
}

View File

@ -50,32 +50,32 @@ public class ProtobufMessageBodyProducer
private ThreadLocal<byte[]> buffer = new ThreadLocal<byte[]>();
@Override
public boolean isWriteable(Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
return ProtobufMessageHandler.class.isAssignableFrom(type);
@Override
public boolean isWriteable(Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
return ProtobufMessageHandler.class.isAssignableFrom(type);
}
@Override
public long getSize(ProtobufMessageHandler m, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
baos.write(m.createProtobufOutput());
} catch (IOException e) {
return -1;
}
byte[] bytes = baos.toByteArray();
buffer.set(bytes);
return bytes.length;
}
@Override
public long getSize(ProtobufMessageHandler m, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
baos.write(m.createProtobufOutput());
} catch (IOException e) {
return -1;
}
byte[] bytes = baos.toByteArray();
buffer.set(bytes);
return bytes.length;
}
public void writeTo(ProtobufMessageHandler m, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
throws IOException, WebApplicationException {
public void writeTo(ProtobufMessageHandler m, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
throws IOException, WebApplicationException {
byte[] bytes = buffer.get();
entityStream.write(bytes);
entityStream.write(bytes);
buffer.remove();
}
}
}

View File

@ -26,10 +26,10 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
*/
@InterfaceAudience.Private
public interface HBaseRPCErrorHandler {
/**
* Take actions on the event of an OutOfMemoryError.
* @param e the throwable
* @return if the server should be shut down
*/
/**
* Take actions on the event of an OutOfMemoryError.
* @param e the throwable
* @return if the server should be shut down
*/
boolean checkOOME(final Throwable e) ;
}

View File

@ -976,7 +976,7 @@ public class RegionPlacementMaintainer {
opt.addOption("munkres", false,
"use munkres to place secondaries and tertiaries");
opt.addOption("ld", "locality-dispersion", false, "print locality and dispersion " +
"information for current plan");
"information for current plan");
try {
// Set the log4j
Logger.getLogger("org.apache.zookeeper").setLevel(Level.ERROR);

View File

@ -94,7 +94,7 @@ public class SnapshotOfRegionAssignmentFromMeta {
*/
public void initialize() throws IOException {
LOG.info("Start to scan the hbase:meta for the current region assignment " +
"snappshot");
"snappshot");
// TODO: at some point this code could live in the MetaTableAccessor
Visitor v = new Visitor() {
@Override

View File

@ -183,9 +183,9 @@ public abstract class CleanerChore<T extends FileCleanerDelegate> extends Chore
// if the directory still has children, we can't delete it, so we are done
if (!allChildrenDeleted) return false;
} catch (IOException e) {
e = e instanceof RemoteException ?
((RemoteException)e).unwrapRemoteException() : e;
LOG.warn("Error while listing directory: " + dir, e);
e = e instanceof RemoteException ?
((RemoteException)e).unwrapRemoteException() : e;
LOG.warn("Error while listing directory: " + dir, e);
// couldn't list directory, so don't try to delete, and don't return success
return false;
}

View File

@ -390,9 +390,9 @@ class MemStoreFlusher implements FlushRequester {
this.server.compactSplitThread.requestSystemCompaction(
region, Thread.currentThread().getName());
} catch (IOException e) {
e = e instanceof RemoteException ?
((RemoteException)e).unwrapRemoteException() : e;
LOG.error(
e = e instanceof RemoteException ?
((RemoteException)e).unwrapRemoteException() : e;
LOG.error(
"Cache flush failed for region " + Bytes.toStringBinary(region.getRegionName()),
e);
}

View File

@ -115,7 +115,7 @@ public class SplitLogWorker implements Runnable {
|| cause instanceof ConnectException
|| cause instanceof SocketTimeoutException)) {
LOG.warn("log replaying of " + filename + " can't connect to the target regionserver, "
+ "resigning", e);
+ "resigning", e);
return Status.RESIGNED;
} else if (cause instanceof InterruptedException) {
LOG.warn("log splitting of " + filename + " interrupted, resigning", e);

View File

@ -54,7 +54,7 @@ public class WALSplitterHandler extends EventHandler {
public WALSplitterHandler(final Server server, SplitLogWorkerCoordination coordination,
SplitLogWorkerCoordination.SplitTaskDetails splitDetails, CancelableProgressable reporter,
AtomicInteger inProgressTasks, TaskExecutor splitTaskExecutor, RecoveryMode mode) {
super(server, EventType.RS_LOG_REPLAY);
super(server, EventType.RS_LOG_REPLAY);
this.splitTaskDetails = splitDetails;
this.coordination = coordination;
this.reporter = reporter;

View File

@ -367,8 +367,8 @@ public class HBaseFsck extends Configured {
if (hbckOutFd == null) {
setRetCode(-1);
LOG.error("Another instance of hbck is running, exiting this instance.[If you are sure" +
" no other instance is running, delete the lock file " +
HBCK_LOCK_PATH + " and rerun the tool]");
" no other instance is running, delete the lock file " +
HBCK_LOCK_PATH + " and rerun the tool]");
throw new IOException("Duplicate hbck - Abort");
}
@ -1640,8 +1640,8 @@ public class HBaseFsck extends Configured {
*/
private void checkAndFixConsistency()
throws IOException, KeeperException, InterruptedException {
// Divide the checks in two phases. One for default/primary replicas and another
// for the non-primary ones. Keeps code cleaner this way.
// Divide the checks in two phases. One for default/primary replicas and another
// for the non-primary ones. Keeps code cleaner this way.
for (java.util.Map.Entry<String, HbckInfo> e: regionInfoMap.entrySet()) {
if (e.getValue().getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID) {
checkRegionConsistency(e.getKey(), e.getValue());
@ -1890,8 +1890,8 @@ public class HBaseFsck extends Configured {
private void checkRegionConsistency(final String key, final HbckInfo hbi)
throws IOException, KeeperException, InterruptedException {
if (hbi.isSkipChecks()) return;
String descriptiveName = hbi.toString();
if (hbi.isSkipChecks()) return;
String descriptiveName = hbi.toString();
boolean inMeta = hbi.metaEntry != null;
// In case not checking HDFS, assume the region is on HDFS
boolean inHdfs = !shouldCheckHdfs() || hbi.getHdfsRegionDir() != null;

View File

@ -50,7 +50,7 @@ import org.apache.zookeeper.KeeperException;
public class RegionServerTracker extends ZooKeeperListener {
private static final Log LOG = LogFactory.getLog(RegionServerTracker.class);
private NavigableMap<ServerName, RegionServerInfo> regionServers =
new TreeMap<ServerName, RegionServerInfo>();
new TreeMap<ServerName, RegionServerInfo>();
private ServerManager serverManager;
private Server server;

View File

@ -1032,8 +1032,8 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
* @throws IOException
*/
public Path getDefaultRootDirPath() throws IOException {
FileSystem fs = FileSystem.get(this.conf);
return new Path(fs.makeQualified(fs.getHomeDirectory()),"hbase");
FileSystem fs = FileSystem.get(this.conf);
return new Path(fs.makeQualified(fs.getHomeDirectory()),"hbase");
}
/**

View File

@ -135,7 +135,7 @@ public class TestBigDecimalColumnInterpreter {
Scan scan = new Scan();
scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal median = aClient.median(TEST_TABLE, ci, scan);
assertEquals(new BigDecimal("8.00"), median);
}
@ -154,7 +154,7 @@ public class TestBigDecimalColumnInterpreter {
Scan scan = new Scan();
scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal maximum = aClient.max(TEST_TABLE, ci, scan);
assertEquals(new BigDecimal("19.00"), maximum);
}
@ -203,7 +203,7 @@ public class TestBigDecimalColumnInterpreter {
public void testMaxWithValidRangeWithNullCF() {
AggregationClient aClient = new AggregationClient(conf);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
Scan scan = new Scan();
BigDecimal max = null;
try {
@ -219,7 +219,7 @@ public class TestBigDecimalColumnInterpreter {
public void testMaxWithInvalidRange() {
AggregationClient aClient = new AggregationClient(conf);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
Scan scan = new Scan();
scan.setStartRow(ROWS[4]);
scan.setStopRow(ROWS[2]);
@ -244,7 +244,7 @@ public class TestBigDecimalColumnInterpreter {
try {
AggregationClient aClient = new AggregationClient(conf);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
max = aClient.max(TEST_TABLE, ci, scan);
} catch (Exception e) {
max = BigDecimal.ZERO;
@ -261,7 +261,7 @@ public class TestBigDecimalColumnInterpreter {
Filter f = new PrefixFilter(Bytes.toBytes("foo:bar"));
scan.setFilter(f);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
max = aClient.max(TEST_TABLE, ci, scan);
assertEquals(null, max);
}
@ -281,7 +281,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(HConstants.EMPTY_START_ROW);
scan.setStopRow(HConstants.EMPTY_END_ROW);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal min = aClient.min(TEST_TABLE, ci, scan);
assertEquals(new BigDecimal("0.00"), min);
}
@ -297,7 +297,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[5]);
scan.setStopRow(ROWS[15]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal min = aClient.min(TEST_TABLE, ci, scan);
assertEquals(new BigDecimal("5.00"), min);
}
@ -310,7 +310,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(HConstants.EMPTY_START_ROW);
scan.setStopRow(HConstants.EMPTY_END_ROW);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal min = aClient.min(TEST_TABLE, ci, scan);
assertEquals(new BigDecimal("0.00"), min);
}
@ -323,7 +323,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[7]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal min = aClient.min(TEST_TABLE, ci, scan);
assertEquals(new BigDecimal("0.60"), min);
}
@ -335,7 +335,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[5]);
scan.setStopRow(ROWS[15]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal min = null;
try {
min = aClient.min(TEST_TABLE, ci, scan);
@ -354,7 +354,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[4]);
scan.setStopRow(ROWS[2]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
try {
min = aClient.min(TEST_TABLE, ci, scan);
} catch (Throwable e) {
@ -370,7 +370,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[6]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal min = null;
try {
min = aClient.min(TEST_TABLE, ci, scan);
@ -387,7 +387,7 @@ public class TestBigDecimalColumnInterpreter {
Filter f = new PrefixFilter(Bytes.toBytes("foo:bar"));
scan.setFilter(f);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal min = null;
min = aClient.min(TEST_TABLE, ci, scan);
assertEquals(null, min);
@ -405,7 +405,7 @@ public class TestBigDecimalColumnInterpreter {
Scan scan = new Scan();
scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal sum = aClient.sum(TEST_TABLE, ci, scan);
assertEquals(new BigDecimal("190.00"), sum);
}
@ -421,7 +421,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[5]);
scan.setStopRow(ROWS[15]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal sum = aClient.sum(TEST_TABLE, ci, scan);
assertEquals(new BigDecimal("95.00"), sum);
}
@ -432,7 +432,7 @@ public class TestBigDecimalColumnInterpreter {
Scan scan = new Scan();
scan.addFamily(TEST_FAMILY);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal sum = aClient.sum(TEST_TABLE, ci, scan);
assertEquals(new BigDecimal("209.00"), sum); // 190 + 19
}
@ -445,7 +445,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[7]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal sum = aClient.sum(TEST_TABLE, ci, scan);
assertEquals(new BigDecimal("6.60"), sum); // 6 + 60
}
@ -457,7 +457,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[7]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal sum = null;
try {
sum = aClient.sum(TEST_TABLE, ci, scan);
@ -475,7 +475,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[2]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal sum = null;
try {
sum = aClient.sum(TEST_TABLE, ci, scan);
@ -492,7 +492,7 @@ public class TestBigDecimalColumnInterpreter {
scan.addFamily(TEST_FAMILY);
scan.setFilter(f);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
BigDecimal sum = null;
sum = aClient.sum(TEST_TABLE, ci, scan);
assertEquals(null, sum);
@ -510,7 +510,7 @@ public class TestBigDecimalColumnInterpreter {
Scan scan = new Scan();
scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
double avg = aClient.avg(TEST_TABLE, ci, scan);
assertEquals(9.5, avg, 0);
}
@ -526,7 +526,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[5]);
scan.setStopRow(ROWS[15]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
double avg = aClient.avg(TEST_TABLE, ci, scan);
assertEquals(9.5, avg, 0);
}
@ -537,7 +537,7 @@ public class TestBigDecimalColumnInterpreter {
Scan scan = new Scan();
scan.addFamily(TEST_FAMILY);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
double avg = aClient.avg(TEST_TABLE, ci, scan);
assertEquals(10.45, avg, 0.01);
}
@ -550,7 +550,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[7]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
double avg = aClient.avg(TEST_TABLE, ci, scan);
assertEquals(6 + 0.60, avg, 0);
}
@ -560,7 +560,7 @@ public class TestBigDecimalColumnInterpreter {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
Double avg = null;
try {
avg = aClient.avg(TEST_TABLE, ci, scan);
@ -578,7 +578,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[5]);
scan.setStopRow(ROWS[1]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
Double avg = null;
try {
avg = aClient.avg(TEST_TABLE, ci, scan);
@ -595,7 +595,7 @@ public class TestBigDecimalColumnInterpreter {
Filter f = new PrefixFilter(Bytes.toBytes("foo:bar"));
scan.setFilter(f);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
Double avg = null;
avg = aClient.avg(TEST_TABLE, ci, scan);
assertEquals(Double.NaN, avg, 0);
@ -613,7 +613,7 @@ public class TestBigDecimalColumnInterpreter {
Scan scan = new Scan();
scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
double std = aClient.std(TEST_TABLE, ci, scan);
assertEquals(5.766, std, 0.05d);
}
@ -630,7 +630,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[5]);
scan.setStopRow(ROWS[15]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
double std = aClient.std(TEST_TABLE, ci, scan);
assertEquals(2.87, std, 0.05d);
}
@ -645,7 +645,7 @@ public class TestBigDecimalColumnInterpreter {
Scan scan = new Scan();
scan.addFamily(TEST_FAMILY);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
double std = aClient.std(TEST_TABLE, ci, scan);
assertEquals(6.342, std, 0.05d);
}
@ -658,7 +658,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[7]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
double std = aClient.std(TEST_TABLE, ci, scan);
System.out.println("std is:" + std);
assertEquals(0, std, 0.05d);
@ -671,7 +671,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[17]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
Double std = null;
try {
std = aClient.std(TEST_TABLE, ci, scan);
@ -689,7 +689,7 @@ public class TestBigDecimalColumnInterpreter {
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[1]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
new BigDecimalColumnInterpreter();
Double std = null;
try {
std = aClient.std(TEST_TABLE, ci, scan);

View File

@ -50,18 +50,18 @@ import org.junit.experimental.categories.Category;
public class TestDependentColumnFilter {
private final Log LOG = LogFactory.getLog(this.getClass());
private static final byte[][] ROWS = {
Bytes.toBytes("test1"),Bytes.toBytes("test2")
Bytes.toBytes("test1"),Bytes.toBytes("test2")
};
private static final byte[][] FAMILIES = {
Bytes.toBytes("familyOne"),Bytes.toBytes("familyTwo")
Bytes.toBytes("familyOne"),Bytes.toBytes("familyTwo")
};
private static final long STAMP_BASE = System.currentTimeMillis();
private static final long[] STAMPS = {
STAMP_BASE-100, STAMP_BASE-200, STAMP_BASE-300
STAMP_BASE-100, STAMP_BASE-200, STAMP_BASE-300
};
private static final byte[] QUALIFIER = Bytes.toBytes("qualifier");
private static final byte[][] BAD_VALS = {
Bytes.toBytes("bad1"), Bytes.toBytes("bad2"), Bytes.toBytes("bad3")
Bytes.toBytes("bad1"), Bytes.toBytes("bad2"), Bytes.toBytes("bad3")
};
private static final byte[] MATCH_VAL = Bytes.toBytes("match");
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
@ -119,14 +119,14 @@ public class TestDependentColumnFilter {
}
private List<KeyValue> makeTestVals() {
List<KeyValue> testVals = new ArrayList<KeyValue>();
testVals.add(new KeyValue(ROWS[0], FAMILIES[0], QUALIFIER, STAMPS[0], BAD_VALS[0]));
testVals.add(new KeyValue(ROWS[0], FAMILIES[0], QUALIFIER, STAMPS[1], BAD_VALS[1]));
testVals.add(new KeyValue(ROWS[0], FAMILIES[1], QUALIFIER, STAMPS[1], BAD_VALS[2]));
testVals.add(new KeyValue(ROWS[0], FAMILIES[1], QUALIFIER, STAMPS[0], MATCH_VAL));
testVals.add(new KeyValue(ROWS[0], FAMILIES[1], QUALIFIER, STAMPS[2], BAD_VALS[2]));
List<KeyValue> testVals = new ArrayList<KeyValue>();
testVals.add(new KeyValue(ROWS[0], FAMILIES[0], QUALIFIER, STAMPS[0], BAD_VALS[0]));
testVals.add(new KeyValue(ROWS[0], FAMILIES[0], QUALIFIER, STAMPS[1], BAD_VALS[1]));
testVals.add(new KeyValue(ROWS[0], FAMILIES[1], QUALIFIER, STAMPS[1], BAD_VALS[2]));
testVals.add(new KeyValue(ROWS[0], FAMILIES[1], QUALIFIER, STAMPS[0], MATCH_VAL));
testVals.add(new KeyValue(ROWS[0], FAMILIES[1], QUALIFIER, STAMPS[2], BAD_VALS[2]));
return testVals;
return testVals;
}
/**

View File

@ -615,7 +615,7 @@ public class TestParseFilter {
@Test
public void testUnescapedQuote3 () throws IOException {
String filterString = " InclusiveStopFilter ('''')";
String filterString = " InclusiveStopFilter ('''')";
InclusiveStopFilter inclusiveStopFilter =
doTestFilter(filterString, InclusiveStopFilter.class);
byte [] stopRowKey = inclusiveStopFilter.getStopRowKey();

View File

@ -175,8 +175,8 @@ public class TestHFilePerformance extends AbstractHBaseTool {
if ("HFile".equals(fileType)){
HFileContextBuilder builder = new HFileContextBuilder()
.withCompression(AbstractHFileWriter.compressionByName(codecName))
.withBlockSize(minBlockSize);
.withCompression(AbstractHFileWriter.compressionByName(codecName))
.withBlockSize(minBlockSize);
if (cipherName != "none") {
byte[] cipherKey = new byte[AES.KEY_LENGTH];
new SecureRandom().nextBytes(cipherKey);

View File

@ -104,7 +104,7 @@ public class TestClockSkewDetection {
long warningSkew = c.getLong("hbase.master.warningclockskew", 1000);
try {
//Master Time > Region Server Time
//Master Time > Region Server Time
LOG.debug("Test: Master Time > Region Server Time");
LOG.debug("regionServerStartup 2");
InetAddress ia2 = InetAddress.getLocalHost();

View File

@ -398,7 +398,7 @@ public class TestMajorCompaction {
private void createSmallerStoreFile(final HRegion region) throws IOException {
HRegionIncommon loader = new HRegionIncommon(region);
HBaseTestCase.addContent(loader, Bytes.toString(COLUMN_FAMILY), ("" +
"bbb").getBytes(), null);
"bbb").getBytes(), null);
loader.flushcache();
}

View File

@ -287,11 +287,11 @@ public class TestTags {
put1.add(fam, qual, HConstants.LATEST_TIMESTAMP, value1);
table.put(put1);
admin.flush(tableName);
// We are lacking an API for confirming flush request compaction.
// Just sleep for a short time. We won't be able to confirm flush
// completion but the test won't hang now or in the future if
// default compaction policy causes compaction between flush and
// when we go to confirm it.
// We are lacking an API for confirming flush request compaction.
// Just sleep for a short time. We won't be able to confirm flush
// completion but the test won't hang now or in the future if
// default compaction policy causes compaction between flush and
// when we go to confirm it.
Thread.sleep(1000);
put1 = new Put(row2);

View File

@ -511,7 +511,7 @@ public class TestReplicationSmallTests extends TestReplicationBase {
*/
@Test(timeout = 300000)
public void testVerifyListReplicatedTable() throws Exception {
LOG.info("testVerifyListReplicatedTable");
LOG.info("testVerifyListReplicatedTable");
final String tName = "VerifyListReplicated_";
final String colFam = "cf1";

View File

@ -121,7 +121,7 @@ public class LoadTestTool extends AbstractHBaseTool {
public static final String OPT_INMEMORY = "in_memory";
public static final String OPT_USAGE_IN_MEMORY = "Tries to keep the HFiles of the CF " +
"inmemory as far as possible. Not guaranteed that reads are always served from inmemory";
"inmemory as far as possible. Not guaranteed that reads are always served from inmemory";
public static final String OPT_GENERATOR = "generator";
public static final String OPT_GENERATOR_USAGE = "The class which generates load for the tool."

View File

@ -379,9 +379,9 @@ public class MultiThreadedReader extends MultiThreadedAction
numKeysVerified.incrementAndGet();
}
} else {
HRegionLocation hloc = connection.getRegionLocation(tableName,
get.getRow(), false);
String rowKey = Bytes.toString(get.getRow());
HRegionLocation hloc = connection.getRegionLocation(tableName,
get.getRow(), false);
String rowKey = Bytes.toString(get.getRow());
LOG.info("Key = " + rowKey + ", Region location: " + hloc);
if(isNullExpected) {
nullResult.incrementAndGet();

View File

@ -300,7 +300,7 @@ public class MultiThreadedUpdater extends MultiThreadedWriterBase {
} catch (IOException e) {
if (ignoreNonceConflicts && (e instanceof OperationConflictException)) {
LOG.info("Detected nonce conflict, ignoring: " + e.getMessage());
totalOpTimeMs.addAndGet(System.currentTimeMillis() - start);
totalOpTimeMs.addAndGet(System.currentTimeMillis() - start);
return;
}
failedKeySet.add(keyBase);

View File

@ -59,75 +59,75 @@ public class TestHTablePool {
protected abstract PoolType getPoolType();
@Test
public void testTableWithStringName() throws Exception {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(),
Integer.MAX_VALUE, getPoolType());
String tableName = TABLENAME;
@Test
public void testTableWithStringName() throws Exception {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(),
Integer.MAX_VALUE, getPoolType());
String tableName = TABLENAME;
// Request a table from an empty pool
Table table = pool.getTable(tableName);
Assert.assertNotNull(table);
// Request a table from an empty pool
Table table = pool.getTable(tableName);
Assert.assertNotNull(table);
// Close table (returns table to the pool)
table.close();
// Close table (returns table to the pool)
table.close();
// Request a table of the same name
Table sameTable = pool.getTable(tableName);
Assert.assertSame(
((HTablePool.PooledHTable) table).getWrappedTable(),
((HTablePool.PooledHTable) sameTable).getWrappedTable());
}
// Request a table of the same name
Table sameTable = pool.getTable(tableName);
Assert.assertSame(
((HTablePool.PooledHTable) table).getWrappedTable(),
((HTablePool.PooledHTable) sameTable).getWrappedTable());
}
@Test
public void testTableWithByteArrayName() throws IOException {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(),
Integer.MAX_VALUE, getPoolType());
@Test
public void testTableWithByteArrayName() throws IOException {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(),
Integer.MAX_VALUE, getPoolType());
// Request a table from an empty pool
Table table = pool.getTable(TABLENAME);
Assert.assertNotNull(table);
// Request a table from an empty pool
Table table = pool.getTable(TABLENAME);
Assert.assertNotNull(table);
// Close table (returns table to the pool)
table.close();
// Close table (returns table to the pool)
table.close();
// Request a table of the same name
Table sameTable = pool.getTable(TABLENAME);
Assert.assertSame(
((HTablePool.PooledHTable) table).getWrappedTable(),
((HTablePool.PooledHTable) sameTable).getWrappedTable());
}
// Request a table of the same name
Table sameTable = pool.getTable(TABLENAME);
Assert.assertSame(
((HTablePool.PooledHTable) table).getWrappedTable(),
((HTablePool.PooledHTable) sameTable).getWrappedTable());
}
@Test
public void testTablesWithDifferentNames() throws IOException {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(),
Integer.MAX_VALUE, getPoolType());
@Test
public void testTablesWithDifferentNames() throws IOException {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(),
Integer.MAX_VALUE, getPoolType());
// We add the class to the table name as the HBase cluster is reused
// during the tests: this gives naming unicity.
byte[] otherTable = Bytes.toBytes(
byte[] otherTable = Bytes.toBytes(
"OtherTable_" + getClass().getSimpleName()
);
TEST_UTIL.createTable(otherTable, HConstants.CATALOG_FAMILY);
TEST_UTIL.createTable(otherTable, HConstants.CATALOG_FAMILY);
// Request a table from an empty pool
Table table1 = pool.getTable(TABLENAME);
Table table2 = pool.getTable(otherTable);
Assert.assertNotNull(table2);
// Request a table from an empty pool
Table table1 = pool.getTable(TABLENAME);
Table table2 = pool.getTable(otherTable);
Assert.assertNotNull(table2);
// Close tables (returns tables to the pool)
table1.close();
table2.close();
// Close tables (returns tables to the pool)
table1.close();
table2.close();
// Request tables of the same names
Table sameTable1 = pool.getTable(TABLENAME);
Table sameTable2 = pool.getTable(otherTable);
Assert.assertSame(
((HTablePool.PooledHTable) table1).getWrappedTable(),
((HTablePool.PooledHTable) sameTable1).getWrappedTable());
Assert.assertSame(
((HTablePool.PooledHTable) table2).getWrappedTable(),
((HTablePool.PooledHTable) sameTable2).getWrappedTable());
}
// Request tables of the same names
Table sameTable1 = pool.getTable(TABLENAME);
Table sameTable2 = pool.getTable(otherTable);
Assert.assertSame(
((HTablePool.PooledHTable) table1).getWrappedTable(),
((HTablePool.PooledHTable) sameTable1).getWrappedTable());
Assert.assertSame(
((HTablePool.PooledHTable) table2).getWrappedTable(),
((HTablePool.PooledHTable) sameTable2).getWrappedTable());
}
@Test
public void testProxyImplementationReturned() {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(),
@ -146,8 +146,8 @@ public class TestHTablePool {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(),
Integer.MAX_VALUE);
String tableName = TABLENAME;// Request a table from
// an
// empty pool
// an
// empty pool
// get table will return proxy implementation
HTableInterface table = pool.getTable(tableName);
@ -168,8 +168,8 @@ public class TestHTablePool {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(),
Integer.MAX_VALUE);
String tableName = TABLENAME;// Request a table from
// an
// empty pool
// an
// empty pool
// get table will return proxy implementation
final Table table = pool.getTable(tableName);
@ -213,154 +213,154 @@ public class TestHTablePool {
}
@Category({ClientTests.class, MediumTests.class})
public static class TestHTableReusablePool extends TestHTablePoolType {
@Override
protected PoolType getPoolType() {
return PoolType.Reusable;
}
public static class TestHTableReusablePool extends TestHTablePoolType {
@Override
protected PoolType getPoolType() {
return PoolType.Reusable;
}
@Test
public void testTableWithMaxSize() throws Exception {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(), 2,
getPoolType());
@Test
public void testTableWithMaxSize() throws Exception {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(), 2,
getPoolType());
// Request tables from an empty pool
Table table1 = pool.getTable(TABLENAME);
Table table2 = pool.getTable(TABLENAME);
Table table3 = pool.getTable(TABLENAME);
// Request tables from an empty pool
Table table1 = pool.getTable(TABLENAME);
Table table2 = pool.getTable(TABLENAME);
Table table3 = pool.getTable(TABLENAME);
// Close tables (returns tables to the pool)
table1.close();
table2.close();
// The pool should reject this one since it is already full
table3.close();
// Close tables (returns tables to the pool)
table1.close();
table2.close();
// The pool should reject this one since it is already full
table3.close();
// Request tables of the same name
Table sameTable1 = pool.getTable(TABLENAME);
Table sameTable2 = pool.getTable(TABLENAME);
Table sameTable3 = pool.getTable(TABLENAME);
Assert.assertSame(
((HTablePool.PooledHTable) table1).getWrappedTable(),
((HTablePool.PooledHTable) sameTable1).getWrappedTable());
Assert.assertSame(
((HTablePool.PooledHTable) table2).getWrappedTable(),
((HTablePool.PooledHTable) sameTable2).getWrappedTable());
Assert.assertNotSame(
((HTablePool.PooledHTable) table3).getWrappedTable(),
((HTablePool.PooledHTable) sameTable3).getWrappedTable());
}
// Request tables of the same name
Table sameTable1 = pool.getTable(TABLENAME);
Table sameTable2 = pool.getTable(TABLENAME);
Table sameTable3 = pool.getTable(TABLENAME);
Assert.assertSame(
((HTablePool.PooledHTable) table1).getWrappedTable(),
((HTablePool.PooledHTable) sameTable1).getWrappedTable());
Assert.assertSame(
((HTablePool.PooledHTable) table2).getWrappedTable(),
((HTablePool.PooledHTable) sameTable2).getWrappedTable());
Assert.assertNotSame(
((HTablePool.PooledHTable) table3).getWrappedTable(),
((HTablePool.PooledHTable) sameTable3).getWrappedTable());
}
@Test
public void testCloseTablePool() throws IOException {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(), 4,
getPoolType());
HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
@Test
public void testCloseTablePool() throws IOException {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(), 4,
getPoolType());
HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
if (admin.tableExists(TABLENAME)) {
admin.disableTable(TABLENAME);
admin.deleteTable(TABLENAME);
}
if (admin.tableExists(TABLENAME)) {
admin.disableTable(TABLENAME);
admin.deleteTable(TABLENAME);
}
HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf(TABLENAME));
tableDescriptor.addFamily(new HColumnDescriptor("randomFamily"));
admin.createTable(tableDescriptor);
HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf(TABLENAME));
tableDescriptor.addFamily(new HColumnDescriptor("randomFamily"));
admin.createTable(tableDescriptor);
// Request tables from an empty pool
Table[] tables = new Table[4];
for (int i = 0; i < 4; ++i) {
tables[i] = pool.getTable(TABLENAME);
}
// Request tables from an empty pool
Table[] tables = new Table[4];
for (int i = 0; i < 4; ++i) {
tables[i] = pool.getTable(TABLENAME);
}
pool.closeTablePool(TABLENAME);
pool.closeTablePool(TABLENAME);
for (int i = 0; i < 4; ++i) {
tables[i].close();
}
for (int i = 0; i < 4; ++i) {
tables[i].close();
}
Assert.assertEquals(4,
pool.getCurrentPoolSize(TABLENAME));
Assert.assertEquals(4,
pool.getCurrentPoolSize(TABLENAME));
pool.closeTablePool(TABLENAME);
pool.closeTablePool(TABLENAME);
Assert.assertEquals(0,
pool.getCurrentPoolSize(TABLENAME));
}
}
Assert.assertEquals(0,
pool.getCurrentPoolSize(TABLENAME));
}
}
@Category({ClientTests.class, MediumTests.class})
public static class TestHTableThreadLocalPool extends TestHTablePoolType {
@Override
protected PoolType getPoolType() {
return PoolType.ThreadLocal;
}
public static class TestHTableThreadLocalPool extends TestHTablePoolType {
@Override
protected PoolType getPoolType() {
return PoolType.ThreadLocal;
}
@Test
public void testTableWithMaxSize() throws Exception {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(), 2,
getPoolType());
@Test
public void testTableWithMaxSize() throws Exception {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(), 2,
getPoolType());
// Request tables from an empty pool
Table table1 = pool.getTable(TABLENAME);
Table table2 = pool.getTable(TABLENAME);
Table table3 = pool.getTable(TABLENAME);
// Request tables from an empty pool
Table table1 = pool.getTable(TABLENAME);
Table table2 = pool.getTable(TABLENAME);
Table table3 = pool.getTable(TABLENAME);
// Close tables (returns tables to the pool)
table1.close();
table2.close();
// The pool should not reject this one since the number of threads
// <= 2
table3.close();
// Close tables (returns tables to the pool)
table1.close();
table2.close();
// The pool should not reject this one since the number of threads
// <= 2
table3.close();
// Request tables of the same name
Table sameTable1 = pool.getTable(TABLENAME);
Table sameTable2 = pool.getTable(TABLENAME);
Table sameTable3 = pool.getTable(TABLENAME);
Assert.assertSame(
((HTablePool.PooledHTable) table3).getWrappedTable(),
((HTablePool.PooledHTable) sameTable1).getWrappedTable());
Assert.assertSame(
((HTablePool.PooledHTable) table3).getWrappedTable(),
((HTablePool.PooledHTable) sameTable2).getWrappedTable());
Assert.assertSame(
((HTablePool.PooledHTable) table3).getWrappedTable(),
((HTablePool.PooledHTable) sameTable3).getWrappedTable());
}
// Request tables of the same name
Table sameTable1 = pool.getTable(TABLENAME);
Table sameTable2 = pool.getTable(TABLENAME);
Table sameTable3 = pool.getTable(TABLENAME);
Assert.assertSame(
((HTablePool.PooledHTable) table3).getWrappedTable(),
((HTablePool.PooledHTable) sameTable1).getWrappedTable());
Assert.assertSame(
((HTablePool.PooledHTable) table3).getWrappedTable(),
((HTablePool.PooledHTable) sameTable2).getWrappedTable());
Assert.assertSame(
((HTablePool.PooledHTable) table3).getWrappedTable(),
((HTablePool.PooledHTable) sameTable3).getWrappedTable());
}
@Test
public void testCloseTablePool() throws IOException {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(), 4,
getPoolType());
HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
@Test
public void testCloseTablePool() throws IOException {
HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(), 4,
getPoolType());
HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
if (admin.tableExists(TABLENAME)) {
admin.disableTable(TABLENAME);
admin.deleteTable(TABLENAME);
}
if (admin.tableExists(TABLENAME)) {
admin.disableTable(TABLENAME);
admin.deleteTable(TABLENAME);
}
HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf(TABLENAME));
tableDescriptor.addFamily(new HColumnDescriptor("randomFamily"));
admin.createTable(tableDescriptor);
HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf(TABLENAME));
tableDescriptor.addFamily(new HColumnDescriptor("randomFamily"));
admin.createTable(tableDescriptor);
// Request tables from an empty pool
Table[] tables = new Table[4];
for (int i = 0; i < 4; ++i) {
tables[i] = pool.getTable(TABLENAME);
}
// Request tables from an empty pool
Table[] tables = new Table[4];
for (int i = 0; i < 4; ++i) {
tables[i] = pool.getTable(TABLENAME);
}
pool.closeTablePool(TABLENAME);
pool.closeTablePool(TABLENAME);
for (int i = 0; i < 4; ++i) {
tables[i].close();
}
for (int i = 0; i < 4; ++i) {
tables[i].close();
}
Assert.assertEquals(1,
pool.getCurrentPoolSize(TABLENAME));
Assert.assertEquals(1,
pool.getCurrentPoolSize(TABLENAME));
pool.closeTablePool(TABLENAME);
pool.closeTablePool(TABLENAME);
Assert.assertEquals(0,
pool.getCurrentPoolSize(TABLENAME));
}
}
Assert.assertEquals(0,
pool.getCurrentPoolSize(TABLENAME));
}
}
}