/** * Byte array comparator class. */ @InterfaceAudience.Public @InterfaceStability.Stable public static class ByteArrayComparator implements RawComparator<byte []> { /** * Constructor */ public ByteArrayComparator() { super(); } @Override public int compare(byte [] left, byte [] right) { return compareTo(left, right); } @Override public int compare(byte [] b1, int s1, int l1, byte [] b2, int s2, int l2) { return LexicographicalComparerHolder.BEST_COMPARER. compareTo(b1, s1, l1, b2, s2, l2); } }
@InterfaceAudience.Public @InterfaceStability.Stable public interface Attributes { /** * Sets an attribute. * In case value = null attribute is removed from the attributes map. * Attribute names starting with _ indicate system attributes. * @param name attribute name * @param value attribute value */ Attributes setAttribute(String name, byte[] value); /** * Gets an attribute * @param name attribute name * @return attribute value if attribute is set, <tt>null</tt> otherwise */ byte[] getAttribute(String name); /** * Gets all attributes * @return unmodifiable map of all attributes */ Map<String, byte[]> getAttributesMap(); }
/** * Thrown when a table exists but should not */ @InterfaceAudience.Public @InterfaceStability.Stable public class TableExistsException extends DoNotRetryIOException { private static final long serialVersionUID = 1L << 7 - 1L; /** default constructor */ public TableExistsException() { super(); } /** * Constructor * * @param s message */ public TableExistsException(String s) { super(s); } public TableExistsException(TableName t) { this(t.getNameAsString()); } }
/** * Thrown if a region server is passed an unknown scanner id. * Usually means the client has take too long between checkins and so the * scanner lease on the serverside has expired OR the serverside is closing * down and has cancelled all leases. */ @InterfaceAudience.Public @InterfaceStability.Stable public class UnknownScannerException extends DoNotRetryIOException { private static final long serialVersionUID = 993179627856392526L; /** constructor */ public UnknownScannerException() { super(); } /** * Constructor * @param s message */ public UnknownScannerException(String s) { super(s); } }
/** * Driver for hbase mapreduce jobs. Select which to run by passing name of job * to this main. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.TOOLS) @InterfaceStability.Stable public class Driver { private static ProgramDriver pgd = new ProgramDriver(); @VisibleForTesting static void setProgramDriver(ProgramDriver pgd0) { pgd = pgd0; } /** * @param args * @throws Throwable */ public static void main(String[] args) throws Throwable { pgd.addClass(RowCounter.NAME, RowCounter.class, "Count rows in HBase table"); ProgramDriver.class.getMethod("driver", new Class[] { String[].class }) .invoke(pgd, new Object[] { args }); } }
/** * Thrown during flush if the possibility snapshot content was not properly * persisted into store files. Response should include replay of wal content. */ @InterfaceAudience.Public @InterfaceStability.Stable public class DroppedSnapshotException extends IOException { private static final long serialVersionUID = -5463156580831677374L; /** * @param msg */ public DroppedSnapshotException(String msg) { super(msg); } /** * default constructor */ public DroppedSnapshotException() { super(); } }
/** * Thrown when a snapshot could not be exported due to an error during the operation. */ @InterfaceAudience.Public @InterfaceStability.Stable @SuppressWarnings("serial") public class ExportSnapshotException extends HBaseSnapshotException { /** * @param msg message describing the exception */ public ExportSnapshotException(String msg) { super(msg); } /** * @param message message describing the exception * @param e cause */ public ExportSnapshotException(String message, Exception e) { super(message, e); } }
/** * Defines a unit of work to be executed. * * <p> * When used with * {@link org.apache.hadoop.hbase.client.HTable#coprocessorService(Class, byte[], byte[], org.apache.hadoop.hbase.client.coprocessor.Batch.Call)} * the implementations {@link Batch.Call#call(Object)} method will be invoked * with a proxy to each region's coprocessor {@link com.facebook.presto.hbase.$internal.com.google.protobuf.Service} implementation. * </p> * @see org.apache.hadoop.hbase.client.coprocessor * @see org.apache.hadoop.hbase.client.HTable#coprocessorService(byte[]) * @see org.apache.hadoop.hbase.client.HTable#coprocessorService(Class, byte[], byte[], org.apache.hadoop.hbase.client.coprocessor.Batch.Call) * @param <T> the instance type to be passed to * {@link Batch.Call#call(Object)} * @param <R> the return type from {@link Batch.Call#call(Object)} */ @InterfaceAudience.Public @InterfaceStability.Stable public interface Call<T,R> { R call(T instance) throws IOException; }
/** * Certain JVM versions are known to be unstable with HBase. This * class has a utility function to determine whether the current JVM * is known to be unstable. */ @InterfaceAudience.Private @InterfaceStability.Stable public abstract class JvmVersion { private static Set<String> BAD_JVM_VERSIONS = new HashSet<String>(); static { BAD_JVM_VERSIONS.add("1.6.0_18"); } /** * Return true if the current JVM is known to be unstable. */ public static boolean isBadJvmVersion() { String version = System.getProperty("java.version"); return version != null && BAD_JVM_VERSIONS.contains(version); } }
/** Thrown when a table can not be located */ @InterfaceAudience.Public @InterfaceStability.Stable public class TableNotFoundException extends DoNotRetryIOException { private static final long serialVersionUID = 993179627856392526L; /** default constructor */ public TableNotFoundException() { super(); } /** @param s message */ public TableNotFoundException(String s) { super(s); } public TableNotFoundException(byte[] tableName) { super(Bytes.toString(tableName)); } public TableNotFoundException(TableName tableName) { super(tableName.getNameAsString()); } }
/** * Extends the basic <code>Reducer</code> class to add the required key and * value input/output classes. While the input key and value as well as the * output key can be anything handed in from the previous map phase the output * value <u>must</u> be either a {@link org.apache.hadoop.hbase.client.Put Put} * or a {@link org.apache.hadoop.hbase.client.Delete Delete} instance when * using the {@link TableOutputFormat} class. * <p> * This class is extended by {@link IdentityTableReducer} but can also be * subclassed to implement similar features or any custom code needed. It has * the advantage to enforce the output value to a specific basic type. * * @param <KEYIN> The type of the input key. * @param <VALUEIN> The type of the input value. * @param <KEYOUT> The type of the output key. * @see org.apache.hadoop.mapreduce.Reducer */ @InterfaceAudience.Public @InterfaceStability.Stable public abstract class TableReducer<KEYIN, VALUEIN, KEYOUT> extends Reducer<KEYIN, VALUEIN, KEYOUT, Mutation> { }
/** * Thrown when something happens related to region handling. * Subclasses have to be more specific. */ @InterfaceAudience.Public @InterfaceStability.Stable public class RegionException extends HBaseIOException { private static final long serialVersionUID = 1473510258071111371L; /** default constructor */ public RegionException() { super(); } /** * Constructor * @param s message */ public RegionException(String s) { super(s); } }
/** * Defines a generic callback to be triggered for each {@link Batch.Call#call(Object)} * result. * * <p> * When used with * {@link org.apache.hadoop.hbase.client.HTable#coprocessorService(Class, byte[], byte[], org.apache.hadoop.hbase.client.coprocessor.Batch.Call)} * the implementation's {@link Batch.Callback#update(byte[], byte[], Object)} * method will be called with the {@link Batch.Call#call(Object)} return value * from each region in the selected range. * </p> * @param <R> the return type from the associated {@link Batch.Call#call(Object)} * @see org.apache.hadoop.hbase.client.HTable#coprocessorService(Class, byte[], byte[], org.apache.hadoop.hbase.client.coprocessor.Batch.Call) */ @InterfaceAudience.Public @InterfaceStability.Stable public interface Callback<R> { void update(byte[] region, byte[] row, R result); } }
/** * Thrown when the lease was expected to be recovered, * but the file can't be opened. */ @InterfaceAudience.Public @InterfaceStability.Stable public class LeaseNotRecoveredException extends HBaseIOException { public LeaseNotRecoveredException() { super(); } public LeaseNotRecoveredException(String message) { super(message); } public LeaseNotRecoveredException(String message, Throwable cause) { super(message, cause); } public LeaseNotRecoveredException(Throwable cause) { super(cause); } }
/** * Used to indicate a filter incompatibility */ @InterfaceAudience.Public @InterfaceStability.Stable public class IncompatibleFilterException extends RuntimeException { private static final long serialVersionUID = 3236763276623198231L; /** constructor */ public IncompatibleFilterException() { super(); } /** * constructor * @param s message */ public IncompatibleFilterException(String s) { super(s); } }
/** * Used to indicate an invalid RowFilter. */ @InterfaceAudience.Public @InterfaceStability.Stable public class InvalidRowFilterException extends RuntimeException { private static final long serialVersionUID = 2667894046345657865L; /** constructor */ public InvalidRowFilterException() { super(); } /** * constructor * @param s message */ public InvalidRowFilterException(String s) { super(s); } }
/** * Thrown when a request contains a key which is not part of this region */ @InterfaceAudience.Public @InterfaceStability.Stable public class WrongRegionException extends IOException { private static final long serialVersionUID = 993179627856392526L; /** constructor */ public WrongRegionException() { super(); } /** * Constructor * @param s message */ public WrongRegionException(String s) { super(s); } }
/** A Comparator optimized for ImmutableBytesWritable. */ @InterfaceAudience.Public @InterfaceStability.Stable public static class Comparator extends WritableComparator { private BytesWritable.Comparator comparator = new BytesWritable.Comparator(); /** constructor */ public Comparator() { super(ImmutableBytesWritable.class); } /** * @see org.apache.hadoop.io.WritableComparator#compare(byte[], int, int, byte[], int, int) */ @Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { return comparator.compare(b1, s1, l1, b2, s2, l2); } }
/** * This exception is thrown by the master when a region server was shut down and * restarted so fast that the master still hasn't processed the server shutdown * of the first instance, or when master is initializing and client call admin * operations, or when an operation is performed on a region server that is still starting. */ @SuppressWarnings("serial") @InterfaceAudience.Public @InterfaceStability.Stable public class PleaseHoldException extends HBaseIOException { public PleaseHoldException(String message) { super(message); } public PleaseHoldException(String message, Throwable cause) { super(message, cause); } public PleaseHoldException(Throwable cause) { super(cause); } }
/** * Thrown when an operation requires the root and all meta regions to be online */ @InterfaceAudience.Public @InterfaceStability.Stable public class NotAllMetaRegionsOnlineException extends DoNotRetryIOException { private static final long serialVersionUID = 6439786157874827523L; /** * default constructor */ public NotAllMetaRegionsOnlineException() { super(); } /** * @param message */ public NotAllMetaRegionsOnlineException(String message) { super(message); } }