org.apache.hadoop.hbase.util.test
Class LoadTestDataGenerator

java.lang.Object
  extended by org.apache.hadoop.hbase.util.test.LoadTestDataGenerator

public abstract class LoadTestDataGenerator
extends Object

A generator of random data (keys/cfs/columns/values) for load testing. Contains LoadTestKVGenerator as a matter of convenience...


Field Summary
protected  LoadTestKVGenerator kvGenerator
           
 
Constructor Summary
LoadTestDataGenerator(int minValueSize, int maxValueSize)
          Initializes the object.
 
Method Summary
abstract  byte[][] generateColumnsForCf(byte[] rowKey, byte[] cf)
          Generates an applicable set of columns to be used for a particular key and family.
abstract  byte[] generateValue(byte[] rowKey, byte[] cf, byte[] column)
          Generates a value to be used for a particular row/cf/column.
abstract  byte[][] getColumnFamilies()
          Gets column families for the load test table.
abstract  byte[] getDeterministicUniqueKey(long keyBase)
          Generates a deterministic, unique hashed row key from a number.
abstract  boolean verify(byte[] rowKey, byte[] cf, byte[] column, byte[] value)
          Checks that value for a rowKey/cf/column is valid if generated via generateValue(byte[], byte[], byte[])
abstract  boolean verify(byte[] rowKey, byte[] cf, Set<byte[]> columnSet)
          Checks that columns for a rowKey and cf are valid if generated via generateColumnsForCf(byte[], byte[])
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kvGenerator

protected final LoadTestKVGenerator kvGenerator
Constructor Detail

LoadTestDataGenerator

public LoadTestDataGenerator(int minValueSize,
                             int maxValueSize)
Initializes the object.

Parameters:
minValueSize - minimum size of the value generated by generateValue(byte[], byte[], byte[]).
maxValueSize - maximum size of the value generated by generateValue(byte[], byte[], byte[]).
Method Detail

getDeterministicUniqueKey

public abstract byte[] getDeterministicUniqueKey(long keyBase)
Generates a deterministic, unique hashed row key from a number. That way, the user can keep track of numbers, without messing with byte array and ensuring key distribution.

Parameters:
keyBase - Base number for a key, such as a loop counter.

getColumnFamilies

public abstract byte[][] getColumnFamilies()
Gets column families for the load test table.

Returns:
The array of byte[]s representing column family names.

generateColumnsForCf

public abstract byte[][] generateColumnsForCf(byte[] rowKey,
                                              byte[] cf)
Generates an applicable set of columns to be used for a particular key and family.

Parameters:
rowKey - The row key to generate for.
cf - The column family name to generate for.
Returns:
The array of byte[]s representing column names.

generateValue

public abstract byte[] generateValue(byte[] rowKey,
                                     byte[] cf,
                                     byte[] column)
Generates a value to be used for a particular row/cf/column.

Parameters:
rowKey - The row key to generate for.
cf - The column family name to generate for.
column - The column name to generate for.
Returns:
The value to use.

verify

public abstract boolean verify(byte[] rowKey,
                               byte[] cf,
                               Set<byte[]> columnSet)
Checks that columns for a rowKey and cf are valid if generated via generateColumnsForCf(byte[], byte[])

Parameters:
rowKey - The row key to verify for.
cf - The column family name to verify for.
columnSet - The column set (for example, encountered by read).
Returns:
True iff valid.

verify

public abstract boolean verify(byte[] rowKey,
                               byte[] cf,
                               byte[] column,
                               byte[] value)
Checks that value for a rowKey/cf/column is valid if generated via generateValue(byte[], byte[], byte[])

Parameters:
rowKey - The row key to verify for.
cf - The column family name to verify for.
column - The column name to verify for.
value - The value (for example, encountered by read).
Returns:
True iff valid.


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.