name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
hbase_SnapshotManifest_addTableDescriptor_rdh | /**
* Add the table descriptor to the snapshot manifest
*/
public void addTableDescriptor(final TableDescriptor htd) throws IOException {
this.htd = htd;
} | 3.26 |
hbase_SnapshotManifest_getRegionManifests_rdh | /**
* Get all the Region Manifest from the snapshot
*/
public List<SnapshotRegionManifest> getRegionManifests() {
return this.regionManifests;
} | 3.26 |
hbase_ByteArrayOutputStream_reset_rdh | /**
* Resets the <code>pos</code> field of this byte array output stream to zero. The output stream
* can be used again.
*/
public void reset() {
this.pos = 0;
} | 3.26 |
hbase_ByteArrayOutputStream_size_rdh | /**
* Returns The current size of the buffer.
*/
public int size() {
return this.pos;
} | 3.26 |
hbase_ByteArrayOutputStream_getBuffer_rdh | /**
* Returns the underlying array where the data gets accumulated
*/
public byte[] getBuffer() {return this.f0;
} | 3.26 |
hbase_ByteArrayOutputStream_toByteArray_rdh | /**
* Copies the content of this Stream into a new byte array.
*
* @return the contents of this output stream, as new byte array.
*/
public byte[] toByteArray() {
return Arrays.copyOf(f0, pos);
} | 3.26 |
hbase_JvmVersion_isBadJvmVersion_rdh | /**
* Return true if the current JVM version is known to be unstable with HBase.
*/
public static boolean isBadJvmVersion() {
String version = System.getProperty("java.version");
return (version != null) && BAD_JVM_VERSIONS.contains(version);
} | 3.26 |
hbase_JvmVersion_getVersion_rdh | /**
* Return the current JVM version information.
*/
public static String getVersion() {
return (((System.getProperty("java.vm.vendor", "UNKNOWN_VM_VENDOR") + ' ') + System.getProperty("java.version",
"UNKNOWN_JAVA_VERSION")) + '-') + System.getProperty("java.vm.version", "UNKNOWN_VM_VERSION");
} | 3.26 |
hbase_HBaseTestingUtility_bloomAndCompressionCombinations_rdh | /**
* Create all combinations of Bloom filters and compression algorithms for testing.
*/
private static List<Object[]> bloomAndCompressionCombinations() {
List<Object[]> v2 = new ArrayList<>();
for (Compression.Algorithm comprAlgo : HBaseCommonTestingUtility.COMPRESSION_ALGORITHMS) { for (BloomType bloomTyp... | 3.26 |
hbase_HBaseTestingUtility_getConnection_rdh | /**
* Get a assigned Connection to the cluster. this method is thread safe.
*
* @param user
* assigned user
* @return A Connection with assigned user.
*/
public Connection getConnection(User user) throws IOException {
return getAsyncConnection(user).toConnection();
} | 3.26 |
hbase_HBaseTestingUtility_expireSession_rdh | /**
* Expire a ZooKeeper session as recommended in ZooKeeper documentation
* http://hbase.apache.org/book.html#trouble.zookeeper There are issues when doing this: [1]
* http://www.mail-archive.com/dev@zookeeper.apache.org/msg01942.html [2]
* https://issues.apache.org/jira/browse/ZOOKEEPER-1105
*
* @param nodeZK
... | 3.26 |
hbase_HBaseTestingUtility_getAdmin_rdh | /**
* Returns an Admin instance which is shared between HBaseTestingUtility instance users. Closing
* it has no effect, it will be closed automatically when the cluster shutdowns
*/
public Admin getAdmin() throws IOException {
if (hbaseAdmin == null) {
this.hbaseAdmin = getConnection().getAdmin();
}
return hbaseAdmi... | 3.26 |
hbase_HBaseTestingUtility_ensureSomeRegionServersAvailable_rdh | /**
* Make sure that at least the specified number of region servers are running
*
* @param num
* minimum number of region servers that should be running
* @return true if we started some servers
*/
public boolean ensureSomeRegionServersAvailable(final int num) throws
IOException {
boolean startedServer = false... | 3.26 |
hbase_HBaseTestingUtility_startMiniMapReduceCluster_rdh | /**
* Starts a <code>MiniMRCluster</code>. Call {@link #setFileSystemURI(String)} to use a different
* filesystem.
*
* @param servers
* The number of <code>TaskTracker</code>'s to start.
* @throws IOException
* When starting the cluster fails.
*/
private void startMiniMapReduceCluster(final int servers) thr... | 3.26 |
hbase_HBaseTestingUtility_createRootDir_rdh | /**
* Same as {@link HBaseTestingUtility#createRootDir(boolean create)} except that
* <code>create</code> flag is false.
*
* @return Fully qualified path to hbase root dir
*/
public Path createRootDir() throws IOException {
return createRootDir(false);
} | 3.26 |
hbase_HBaseTestingUtility_waitUntilAllRegionsAssigned_rdh | /**
* Wait until all regions for a table in hbase:meta have a non-empty info:server, or until
* timeout. This means all regions have been deployed, master has been informed and updated
* hbase:meta with the regions deployed server.
*
* @param tableName
* the table name
* @param timeout
* timeout, in millise... | 3.26 |
hbase_HBaseTestingUtility_memStoreTSAndTagsCombination_rdh | /**
* Create combination of memstoreTS and tags
*/
private static List<Object[]> memStoreTSAndTagsCombination() {List<Object[]> configurations = new ArrayList<>();
configurations.add(new Object[]{ false, false });
configurations.add(new Object[]{ false, true });
configurations.add(new Object[]{ true, f... | 3.26 |
hbase_HBaseTestingUtility_getConfiguration_rdh | /**
* Returns this classes's instance of {@link Configuration}. Be careful how you use the returned
* Configuration since {@link Connection} instances can be shared. The Map of Connections is keyed
* by the Configuration. If say, a Connection was being used against a cluster that had been
* shutdown, see {@link #sh... | 3.26 |
hbase_HBaseTestingUtility_createWALRootDir_rdh | /**
* Creates a hbase walDir in the user's home directory. Normally you won't make use of this
* method. Root hbaseWALDir is created for you as part of mini cluster startup. You'd only use
* this method if you were doing manual operation.
*
* @return Fully qualified path to hbase root dir
*/
public Path createWAL... | 3.26 |
hbase_HBaseTestingUtility_waitLabelAvailable_rdh | /**
* Wait until labels is ready in VisibilityLabelsCache.
*/
public void waitLabelAvailable(long timeoutMillis, final String... labels) {
final VisibilityLabelsCache labelsCache = VisibilityLabelsCache.get();
waitFor(timeoutMillis, new Waiter.ExplainingPredicate<RuntimeException>() {
@Override
public boolean evaluat... | 3.26 |
hbase_HBaseTestingUtility_m2_rdh | /**
* Create a table.
*
* @param htd
* table descriptor
* @param splitRows
* array of split keys
* @return A Table instance for the created table.
*/
public Table m2(TableDescriptor htd, byte[][] splitRows) throws IOException {
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(htd);
if (i... | 3.26 |
hbase_HBaseTestingUtility_validate_rdh | /**
* Validate that all the rows between startRow and stopRow are seen exactly once, and all other
* rows none
*/
public void validate() {
for (byte b1 = 'a'; b1 <= 'z'; b1++) {
for (byte b2 = 'a'; b2 <= 'z'; b2++) {
for (byte b3 = 'a'; b3 <= 'z'; b3++) {
int count = seenRows[i(b1)][i(b2)][i(b3)];
int expectedCoun... | 3.26 |
hbase_HBaseTestingUtility_createDirsAndSetProperties_rdh | /**
* This is used before starting HDFS and map-reduce mini-clusters Run something like the below to
* check for the likes of '/tmp' references -- i.e. references outside of the test data dir -- in
* the conf.
*
* <pre>
* Configuration conf = TEST_UTIL.getConfiguration();
* for (Iterator<Map.Entry<String, ... | 3.26 |
hbase_HBaseTestingUtility_countRows_rdh | /**
* Return the number of rows in the given table.
*/
public int countRows(final TableName tableName) throws IOException {
Table table = getConnection().getTable(tableName);
try {
return countRows(table);
} finally {
table.close();
}
} | 3.26 |
hbase_HBaseTestingUtility_isReadShortCircuitOn_rdh | /**
* Get the HBase setting for dfs.client.read.shortcircuit from the conf or a system property. This
* allows to specify this parameter on the command line. If not set, default is true.
*/ public boolean isReadShortCircuitOn() {
final String propName = "hbase.tests.use.shortcircuit.reads";
String readOnProp = Syste... | 3.26 |
hbase_HBaseTestingUtility_getMetaTableRows_rdh | /**
* Returns all rows from the hbase:meta table for a given user table
*
* @throws IOException
* When reading the rows fails.
*/
public List<byte[]> getMetaTableRows(TableName tableName)
throws IOException {
// TODO: Redo using MetaTableAccessor.
Table t = getConnection().getTable(TableName.META_TABLE_NAME);
Li... | 3.26 |
hbase_HBaseTestingUtility_getHBaseCluster_rdh | /**
* Get the Mini HBase cluster.
*
* @return hbase cluster
* @see #getHBaseClusterInterface()
*/
public MiniHBaseCluster getHBaseCluster() {return getMiniHBaseCluster();
} | 3.26 |
hbase_HBaseTestingUtility_getFromStoreFile_rdh | /**
* Do a small get/scan against one store. This is required because store has no actual methods of
* querying itself, and relies on StoreScanner.
*/
public static List<Cell> getFromStoreFile(HStore store, byte[] row, NavigableSet<byte[]> columns) throws IOException {
Get get = new Get(row);
Map<byte[], NavigableSe... | 3.26 |
hbase_HBaseTestingUtility_setDFSCluster_rdh | /**
* Set the MiniDFSCluster
*
* @param cluster
* cluster to use
* @param requireDown
* require the that cluster not be "up" (MiniDFSCluster#isClusterUp) before it
* is set.
* @throws IllegalStateException
* if the passed cluster is up when it is required to be down
* @throws IOException
* if the F... | 3.26 |
hbase_HBaseTestingUtility_waitTableAvailable_rdh | /**
* Wait until all regions in a table have been assigned
*
* @param table
* Table to wait on.
* @param timeoutMillis
* Timeout.
*/
public void waitTableAvailable(byte[] table, long timeoutMillis) throws InterruptedException, IOException {
waitFor(timeoutMillis, predicateTableAvailable(TableName.valueOf(tab... | 3.26 |
hbase_HBaseTestingUtility_predicateTableEnabled_rdh | /**
* Returns a {@link Predicate} for checking that table is enabled
*/
public Waiter.Predicate<IOException> predicateTableEnabled(final TableName tableName) {
return new ExplainingPredicate<IOException>() {
@Override
public String explainFailure() throws
IOException {
return explainTableState(tableName, State.ENABLE... | 3.26 |
hbase_HBaseTestingUtility_getDifferentUser_rdh | /**
* This method clones the passed <code>c</code> configuration setting a new user into the clone.
* Use it getting new instances of FileSystem. Only works for DistributedFileSystem w/o Kerberos.
*
* @param c
* Initial configuration
* @param differentiatingSuffix
* Suffix to differentiate this user from oth... | 3.26 |
hbase_HBaseTestingUtility_deleteTableData_rdh | //
// ==========================================================================
/**
* Provide an existing table name to truncate. Scans the table and issues a delete for each row
* read.
*
* @param tableName
* existing table
* @return HTable to that new table
*/
public Table deleteTableData(TableName tableN... | 3.26 |
hbase_HBaseTestingUtility_unassignRegionByRow_rdh | /**
* Closes the region containing the given row.
*
* @param row
* The row to find the containing region.
* @param table
* The table to find the region.
*/
public void unassignRegionByRow(byte[] row, RegionLocator table) throws IOException
{
HRegionLocation hrl = table.getRegionLocation(row);
unassignRegion(... | 3.26 |
hbase_HBaseTestingUtility_ensureSomeNonStoppedRegionServersAvailable_rdh | /**
* Make sure that at least the specified number of region servers are running. We don't count the
* ones that are currently stopping or are stopped.
*
* @param num
* minimum number of region servers that should be running
* @return true if we started some servers
*/
public boolean ensureSomeNonStoppedRegion... | 3.26 |
hbase_HBaseTestingUtility_m3_rdh | /**
* Set the number of Region replicas.
*/
public static void m3(Admin admin, TableName table, int replicaCount) throws IOException, InterruptedException {
TableDescriptor desc = TableDescriptorBuilder.newBuilder(admin.getDescriptor(table)).setRegionReplication(replicaCount).build();
admin.modifyTable(desc);} | 3.26 |
hbase_HBaseTestingUtility_invalidateConnection_rdh | /**
* Resets the connections so that the next time getConnection() is called, a new connection is
* created. This is needed in cases where the entire cluster / all the masters are shutdown and
* the connection is not valid anymore. TODO: There should be a more coherent way of doing this.
* Unfortunately the way tes... | 3.26 |
hbase_HBaseTestingUtility_setupMiniKdc_rdh | /**
* Sets up {@link MiniKdc} for testing security. Uses {@link HBaseKerberosUtils} to set the given
* keytab file as {@link HBaseKerberosUtils#KRB_KEYTAB_FILE}. FYI, there is also the easier-to-use
* kerby KDC server and utility for using it,
* {@link org.apache.hadoop.hbase.util.SimpleKdcServerUtil}. The kerby KD... | 3.26 |
hbase_HBaseTestingUtility_deleteTableIfAny_rdh | /**
* Drop an existing table
*
* @param tableName
* existing table
*/
public void
deleteTableIfAny(TableName tableName) throws IOException {
try {
deleteTable(tableName);
} catch (TableNotFoundException e) {
// ignore
}
} | 3.26 |
hbase_HBaseTestingUtility_waitTableDisabled_rdh | /**
* Waits for a table to be 'disabled'. Disabled means that table is set as 'disabled'
*
* @param table
* Table to wait on.
* @param timeoutMillis
* Time to wait on it being marked disabled.
*/
public void waitTableDisabled(byte[] table, long timeoutMillis) throws InterruptedException, IOException {
waitT... | 3.26 |
hbase_HBaseTestingUtility_isNewVersionBehaviorEnabled_rdh | /**
* Check whether the tests should assume NEW_VERSION_BEHAVIOR when creating new column families.
* Default to false.
*/
public boolean isNewVersionBehaviorEnabled() {
final String propName = "hbase.tests.new.version.behavior";
String v = System.getProperty(propName);
if (v != null) {
return Boolean.parseBoolean(... | 3.26 |
hbase_HBaseTestingUtility_getSplittableRegion_rdh | /**
* Retrieves a splittable region randomly from tableName
*
* @param tableName
* name of table
* @param maxAttempts
* maximum number of attempts, unlimited for value of -1
* @return the HRegion chosen, null if none was found within limit of maxAttempts
*/
public HRegion getSplittableRegion(TableName table... | 3.26 |
hbase_HBaseTestingUtility_expireMasterSession_rdh | /**
* Expire the Master's session
*/
public void expireMasterSession() throws Exception
{
HMaster master = getMiniHBaseCluster().getMaster();
expireSession(master.getZooKeeper(), false);
} | 3.26 |
hbase_HBaseTestingUtility_generateColumnDescriptors_rdh | /**
* Create a set of column descriptors with the combination of compression, encoding, bloom codecs
* available.
*
* @param prefix
* family names prefix
* @return the list of column descriptors
*/
public static List<ColumnFamilyDescriptor> generateColumnDescriptors(final String prefix) {
List<ColumnFamilyDe... | 3.26 |
hbase_HBaseTestingUtility_createTable_rdh | /**
* Create a table.
*
* @return A Table instance for the created table.
*/
public Table createTable(TableName tableName, byte[] family, byte[][] splitRows) throws IOException {
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableName);
ColumnFamilyDescriptorBuilder cfBuilder = ColumnFamilyDesc... | 3.26 |
hbase_HBaseTestingUtility_getAsyncConnection_rdh | /**
* Get a assigned AsyncClusterConnection to the cluster. this method is thread safe.
*
* @param user
* assigned user
* @return An AsyncClusterConnection with assigned user.
*/
public AsyncClusterConnection getAsyncConnection(User user) throws IOException {
return ClusterConnectionFactory.createAsyncClusterCo... | 3.26 |
hbase_HBaseTestingUtility_createLocalHRegion_rdh | /**
* Return a region on which you must call {@link HBaseTestingUtility#closeRegionAndWAL(HRegion)}
* when done.
*/
public HRegion createLocalHRegion(TableName tableName, byte[] startKey, byte[] stopKey, Configuration conf, boolean isReadOnly, Durability durability, WAL wal, byte[]... families) throws IOException {
... | 3.26 |
hbase_HBaseTestingUtility_predicateNoRegionsInTransition_rdh | /**
* Returns a {@link Predicate} for checking that there are no regions in transition in master
*/
public ExplainingPredicate<IOException> predicateNoRegionsInTransition() {
return new ExplainingPredicate<IOException>() {@Override
public String explainFailure() throws IOException {
final RegionStates regionStates =... | 3.26 |
hbase_HBaseTestingUtility_getHbck_rdh | /**
* Returns an {@link Hbck} instance. Needs be closed when done.
*/
public Hbck getHbck() throws IOException {
return getConnection().getHbck();
} | 3.26 |
hbase_HBaseTestingUtility_enableShortCircuit_rdh | /**
* Enable the short circuit read, unless configured differently. Set both HBase and HDFS settings,
* including skipping the hdfs checksum checks.
*/
private void enableShortCircuit() {if (isReadShortCircuitOn()) {
String curUser = System.getProperty("user.name");
LOG.info("read short circuit is ON for user " + cu... | 3.26 |
hbase_HBaseTestingUtility_shutdownMiniCluster_rdh | /**
* Stops mini hbase, zk, and hdfs clusters.
*
* @see #startMiniCluster(int)
*/
public void shutdownMiniCluster() throws IOException {
LOG.info("Shutting down minicluster");
shutdownMiniHBaseCluster();
shutdownMiniDFSCluster();
shutdownMiniZKCluster();
cleanupTestDir();
miniClusterRunning = false;
LOG.info("Minic... | 3.26 |
hbase_HBaseTestingUtility_truncateTable_rdh | /**
* Truncate a table using the admin command. Effectively disables, deletes, and recreates the
* table. For previous behavior of issuing row deletes, see deleteTableData. Expressly does not
* preserve regions of existing table.
*
* @param tableName
* table which must exist.
* @return HTable for the new table... | 3.26 |
hbase_HBaseTestingUtility_killMiniHBaseCluster_rdh | /**
* Abruptly Shutdown HBase mini cluster. Does not shutdown zk or dfs if running.
*
* @throws java.io.IOException
* throws in case command is unsuccessful
*/
public void killMiniHBaseCluster() throws IOException {
cleanup();
if (this.hbaseCluster != null) {
getMiniHBaseCluster().killAll();
this.hbaseCluster ... | 3.26 |
hbase_HBaseTestingUtility_forceChangeTaskLogDir_rdh | /**
* Tasktracker has a bug where changing the hadoop.log.dir system property will not change its
* internal static LOG_DIR variable.
*/
private void
forceChangeTaskLogDir() {
Field logDirField;
try {
logDirField = TaskLog.class.getDeclaredField("LOG_DIR");
logDirField.setAccessible(true);
Field modifiersField = R... | 3.26 |
hbase_HBaseTestingUtility_shutdownMiniDFSCluster_rdh | /**
* Shuts down instance created by call to {@link #startMiniDFSCluster(int)} or does nothing.
*/
public void shutdownMiniDFSCluster() throws IOException {
if (this.dfsCluster != null) {
// The below throws an exception per dn, AsynchronousCloseException.
this.dfsCluster.shutdown();
dfsCluster
= null;
// It is possi... | 3.26 |
hbase_HBaseTestingUtility_cleanup_rdh | // close hbase admin, close current connection and reset MIN MAX configs for RS.
private void cleanup() throws IOException {
closeConnection();
// unset the configuration for MIN and MAX RS to start
conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, -1);
conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTA... | 3.26 |
hbase_HBaseTestingUtility_waitUntilNoRegionsInTransition_rdh | /**
* Wait until no regions in transition. (time limit 15min)
*/
public void waitUntilNoRegionsInTransition() throws IOException {
waitUntilNoRegionsInTransition(15 * 60000);
} | 3.26 |
hbase_HBaseTestingUtility_cleanupDataTestDirOnTestFS_rdh | /**
* Cleans a subdirectory under the test data directory on the test filesystem.
*
* @return True if we removed child
*/public boolean cleanupDataTestDirOnTestFS(String subdirName) throws IOException {
Path
cpath =
getDataTestDirOnTestFS(subdirName);
return getTestFileSystem().delete(cpath, true)... | 3.26 |
hbase_HBaseTestingUtility_createRegionAndWAL_rdh | /**
* Create a region with it's own WAL. Be sure to call
* {@link HBaseTestingUtility#closeRegionAndWAL(HRegion)} to clean up all resources.
*/
public static HRegion createRegionAndWAL(final RegionInfo info, final Path rootDir, final Configuration conf, final TableDescriptor htd, boolean initialize) throws IOExcepti... | 3.26 |
hbase_HBaseTestingUtility_m1_rdh | /**
* Create a table.
*
* @return A Table instance for the created table.
*/
public Table m1(TableName tableName, byte[][] families) throws IOException {
return createTable(tableName, families, ((byte[][]) (null)));
} | 3.26 |
hbase_HBaseTestingUtility_deleteTable_rdh | /**
* Drop an existing table
*
* @param tableName
* existing table
*/
public void deleteTable(TableName tableName) throws IOException {
try {
getAdmin().disableTable(tableName);
} catch (TableNotEnabledException e) {
LOG.debug(("Table: " + tableName) + " already disabled, so just deleting it.");
}
getAdmin().d... | 3.26 |
hbase_HBaseTestingUtility_shutdownMiniHBaseCluster_rdh | /**
* Shutdown HBase mini cluster.Does not shutdown zk or dfs if running.
*
* @throws java.io.IOException
* in case command is unsuccessful
*/
public void shutdownMiniHBaseCluster() throws IOException {
cleanup();
if (this.hbaseCluster != null) {
this.hbaseCluster.shutdown();
// Wait till hbase is down before g... | 3.26 |
hbase_HBaseTestingUtility_createRandomTable_rdh | /**
* Creates a random table with the given parameters
*/
public Table createRandomTable(TableName tableName, final Collection<String> families, final int maxVersions, final int numColsPerRow, final int numFlushes, final int numRegions, final int numRowsPerFlush) throws IOException, InterruptedException {
LOG.info((... | 3.26 |
hbase_HBaseTestingUtility_createWal_rdh | /**
* Create an unmanaged WAL. Be sure to close it when you're through.
*/
public static WAL createWal(final Configuration conf, final Path rootDir, final RegionInfo hri) throws IOException {
// The WAL subsystem will use the default rootDir rather than the passed in rootDir
// unless I pass along via the conf.
Con... | 3.26 |
hbase_HBaseTestingUtility_waitUntilAllSystemRegionsAssigned_rdh | /**
* Waith until all system table's regions get assigned
*/
public void waitUntilAllSystemRegionsAssigned() throws IOException {
waitUntilAllRegionsAssigned(TableName.META_TABLE_NAME);
} | 3.26 |
hbase_HBaseTestingUtility_m5_rdh | /**
* Create a stubbed out RegionServerService, mainly for getting FS. This version is used by
* TestTokenAuthentication
*/
public RegionServerServices m5(RpcServerInterface rpc) throws IOException {
final MockRegionServerServices rss = new MockRegionServerServices(getZooKeeperWatcher());
rss.setFileSystem(getTestF... | 3.26 |
hbase_HBaseTestingUtility_closeRegionAndWAL_rdh | /**
* Close both the HRegion {@code r} and it's underlying WAL. For use in tests.
*/
public static void closeRegionAndWAL(final HRegion r) throws IOException {
if (r == null)
return;
r.close();
if (r.getWAL() == null)
return;
r.getWAL().close();
} | 3.26 |
hbase_HBaseTestingUtility_loadTable_rdh | /**
* Load table of multiple column families with rows from 'aaa' to 'zzz'.
*
* @param t
* Table
* @param f
* Array of Families to load
* @param value
* the values of the cells. If null is passed, the row key is used as value
* @return Count of rows loaded.
*/
public int loadTable(final Table t, final b... | 3.26 |
hbase_HBaseTestingUtility_unassignRegion_rdh | /**
* Unassign the named region.
*
* @param regionName
* The region to unassign.
*/public void unassignRegion(byte[] regionName) throws IOException {
getAdmin().unassign(regionName, true);
} | 3.26 |
hbase_HBaseTestingUtility_moveRegionAndWait_rdh | /**
* Move region to destination server and wait till region is completely moved and online
*
* @param destRegion
* region to move
* @param destServer
* destination server of the region
*/
public void moveRegionAndWait(RegionInfo destRegion, ServerName destServer) throws InterruptedException, IOException {... | 3.26 |
hbase_HBaseTestingUtility_setupDataTestDir_rdh | /**
* Home our data in a dir under {@link #DEFAULT_BASE_TEST_DIRECTORY}. Give it a random name so can
* have many concurrent tests running if we need to. It needs to amend the
* {@link #TEST_DIRECTORY_KEY} System property, as it's what minidfscluster bases it data dir on.
* Moding a System property is not the way t... | 3.26 |
hbase_HBaseTestingUtility_await_rdh | /**
* Await the successful return of {@code condition}, sleeping {@code sleepMillis} between
* invocations.
*/
public static void await(final long sleepMillis, final BooleanSupplier condition) throws InterruptedException {
try {
while (!condition.getAsBoolean()) {
Thread.sleep(sleepMillis);
}
} catch (RuntimeExcep... | 3.26 |
hbase_HBaseTestingUtility_compact_rdh | /**
* Compact all of a table's reagion in the mini hbase cluster
*/
public void compact(TableName tableName, boolean major) throws IOException {
getMiniHBaseCluster().compact(tableName, major);
} | 3.26 |
hbase_HBaseTestingUtility_startMiniHBaseCluster_rdh | /**
* Starts up mini hbase cluster using default options. Default options can be found in
* {@link StartMiniClusterOption.Builder}.
*
* @see #startMiniHBaseCluster(StartMiniClusterOption)
* @see #shutdownMiniHBaseCluster()
*/
public MiniHBaseCluster startMiniHBaseCluster() throws IOException, InterruptedExceptio... | 3.26 |
hbase_HBaseTestingUtility_setMaxRecoveryErrorCount_rdh | /**
* Set maxRecoveryErrorCount in DFSClient. In 0.20 pre-append its hard-coded to 5 and makes tests
* linger. Here is the exception you'll see:
*
* <pre>
* 2010-06-15 11:52:28,511 WARN [DataStreamer for file /hbase/.logs/wal.1276627923013 block
* blk_928005470262850423_1021] hdfs.DFSClient$DFSOutputStream(2657)... | 3.26 |
hbase_HBaseTestingUtility_setupDataTestDirOnTestFS_rdh | /**
* Sets up a path in test filesystem to be used by tests. Creates a new directory if not already
* setup.
*/
private void setupDataTestDirOnTestFS() throws IOException {
if (dataTestDirOnTestFS != null) {
LOG.warn("Data test on test fs dir already setup in " + dataTestDirOnTestFS.toString());
... | 3.26 |
hbase_HBaseTestingUtility_restartHBaseCluster_rdh | /**
* Starts the hbase cluster up again after shutting it down previously in a test. Use this if you
* want to keep dfs/zk up and just stop/start hbase.
*
* @param servers
* number of region servers
*/
public void restartHBaseCluster(int servers) throws IOException, InterruptedException {
this.restartHBaseClust... | 3.26 |
hbase_HBaseTestingUtility_startMiniCluster_rdh | /**
* Start up a mini cluster of hbase, optionally dfs and zookeeper if needed. It modifies
* Configuration. It homes the cluster data directory under a random subdirectory in a directory
* under System property test.build.data, to be cleaned up on exit.
*
* @see #shutdownMiniDFSCluster()
*/
public MiniHBaseClus... | 3.26 |
hbase_HBaseTestingUtility_getDataTestDirOnTestFS_rdh | /**
* Returns a Path in the test filesystem, obtained from {@link #getTestFileSystem()} to write
* temporary test data. Call this method after setting up the mini dfs cluster if the test relies
* on it.
*
* @return a unique path in the test filesystem
* @param subdirName
* name of the subdir to create under th... | 3.26 |
hbase_HBaseTestingUtility_getRSForFirstRegionInTable_rdh | /**
* Tool to get the reference to the region server object that holds the region of the specified
* user table.
*
* @param tableName
* user table to lookup in hbase:meta
* @return region server that holds it, null if the row doesn't exist
*/
public HRegionServer getRSForFirstRegionInTable(TableName tableName)... | 3.26 |
hbase_HBaseTestingUtility_checksumRows_rdh | /**
* Return an md5 digest of the entire contents of a table.
*/
public String checksumRows(final Table table) throws Exception {
Scan scan = new Scan();
ResultScanner v163 = table.getScanner(scan);
MessageDigest digest = MessageDigest.getInstance("MD5");
for (Result res : v163) {
digest.update(res.getRow());
}
v163.... | 3.26 |
hbase_HBaseTestingUtility_waitTableEnabled_rdh | /**
* Waits for a table to be 'enabled'. Enabled means that table is set as 'enabled' and the regions
* have been all assigned.
*
* @see #waitTableEnabled(TableName, long)
* @param table
* Table to wait on.
* @param timeoutMillis
* Time to wait on it being marked enabled.
*/
public void waitTableEnabled(by... | 3.26 |
hbase_HBaseTestingUtility_predicateTableAvailable_rdh | /**
* Returns a {@link Predicate} for checking that table is enabled
*/
public Waiter.Predicate<IOException> predicateTableAvailable(final TableName tableName) {
return new ExplainingPredicate<IOException>() {
@Override
public String explainFailure() throws IOException {
return explainTableAvailability(tableName);
... | 3.26 |
hbase_HBaseTestingUtility_createPreSplitLoadTestTable_rdh | /**
* Creates a pre-split table for load testing. If the table already exists, logs a warning and
* continues.
*
* @return the number of regions the table was split into
*/
public static int createPreSplitLoadTestTable(Configuration conf, TableDescriptor td, ColumnFamilyDescriptor[] cds, SplitAlgorithm splitte... | 3.26 |
hbase_HBaseTestingUtility_getRegionSplitStartKeys_rdh | /**
* Create region split keys between startkey and endKey
*
* @param numRegions
* the number of regions to be created. it has to be greater than 3.
* @return resulting split keys
*/
public byte[][] getRegionSplitStartKeys(byte[] startKey, byte[] endKey, int numRegions) {
if (numRegions <= 3) {
throw new Assert... | 3.26 |
hbase_HBaseTestingUtility_assertRegionOnServer_rdh | /**
* Due to async racing issue, a region may not be in the online region list of a region server
* yet, after the assignment znode is deleted and the new assignment is recorded in master.
*/public void assertRegionOnServer(final RegionInfo hri, final ServerName
server, final long timeout) throws IOException, Inter... | 3.26 |
hbase_HBaseTestingUtility_createMultiRegionsInMeta_rdh | /**
* Create rows in hbase:meta for regions of the specified table with the specified start keys. The
* first startKey should be a 0 length byte array if you want to form a proper range of regions.
*
* @return list of region info for regions added to meta
*/
public List<RegionInfo> createMultiRegionsInMeta(final ... | 3.26 |
hbase_HBaseTestingUtility_getDefaultRootDirPath_rdh | /**
* Same as {{@link HBaseTestingUtility#getDefaultRootDirPath(boolean create)} except that
* <code>create</code> flag is false. Note: this does not cause the root dir to be created.
*
* @return Fully qualified path for the default hbase root dir
*/
public Path getDefaultRootDirPath() throws IOException {
return ... | 3.26 |
hbase_HBaseTestingUtility_getRegions_rdh | /**
* Returns all regions of the specified table
*
* @param tableName
* the table name
* @return all regions of the specified table
* @throws IOException
* when getting the regions fails.
*/
private List<RegionInfo> getRegions(TableName tableName) throws IOException {
try (Admin admin = getConnection().ge... | 3.26 |
hbase_HBaseTestingUtility_getNewDataTestDirOnTestFS_rdh | /**
* Sets up a new path in test filesystem to be used by tests.
*/
private Path getNewDataTestDirOnTestFS() throws IOException {
// The file system can be either local, mini dfs, or if the configuration
// is supplied externally, it can be an external cluster FS. If it is a local
// file system, the test... | 3.26 |
hbase_HBaseTestingUtility_getOtherRegionServer_rdh | /**
* Find any other region server which is different from the one identified by parameter
*
* @return another region server
*/
public HRegionServer getOtherRegionServer(HRegionServer rs) {
for (JVMClusterUtil.RegionServerThread rst : getMiniHBaseCluster().getRegionServerThreads()) {
if (!(rst.getRegionServer() ==... | 3.26 |
hbase_HBaseTestingUtility_startMiniDFSCluster_rdh | /**
* Start a minidfscluster. Can only create one.
*
* @param servers
* How many DNs to start.
* @param hosts
* hostnames DNs to run on.
* @see #shutdownMiniDFSCluster()
* @return The mini dfs cluster created.
*/
public MiniDFSCluster startMiniDFSCluster(int servers, final String[] hosts) throws Exception ... | 3.26 |
hbase_HBaseTestingUtility_available_rdh | /**
* Checks to see if a specific port is available.
*
* @param port
* the port number to check for availability
* @return <tt>true</tt> if the port is available, or <tt>false</tt> if not
*/
public static boolean available(int port) {
ServerSocket ss = null;
DatagramSocket ds = null;
try {
... | 3.26 |
hbase_HBaseTestingUtility_shutdownMiniMapReduceCluster_rdh | /**
* Stops the previously started <code>MiniMRCluster</code>.
*/
public void shutdownMiniMapReduceCluster() {
if (mrCluster !=
null) {
LOG.info("Stopping mini mapreduce cluster...");
mrCluster.shutdown();
mrCluster = null;
LOG.info("Mini mapreduce cluster stopped");
}
// Restore configuration to point to local jobtr... | 3.26 |
hbase_HBaseTestingUtility_getHBaseClusterInterface_rdh | /**
* Returns the HBaseCluster instance.
* <p>
* Returned object can be any of the subclasses of HBaseCluster, and the tests referring this
* should not assume that the cluster is a mini cluster or a distributed one. If the test only
* works on a mini cluster, then specific method {@link #getMiniHBaseCluster()} ca... | 3.26 |
hbase_HBaseTestingUtility_assertRegionOnlyOnServer_rdh | /**
* Check to make sure the region is open on the specified region server, but not on any other one.
*/
public void assertRegionOnlyOnServer(final RegionInfo hri, final ServerName server, final long timeout) throws IOException, InterruptedException {
long timeoutTime = EnvironmentEdgeManager.currentTime() + timeout... | 3.26 |
hbase_HBaseTestingUtility_createTableDescriptor_rdh | /**
* Create a table of name <code>name</code>.
*
* @param name
* Name to give table.
* @return Column descriptor.
*/public TableDescriptor createTableDescriptor(final TableName name) {
return createTableDescriptor(name, ColumnFamilyDescriptorBuilder.DEFAULT_MIN_VERSIONS, f1, HConstants.FOREVER, ColumnFamilyDes... | 3.26 |
hbase_HBaseTestingUtility_predicateTableDisabled_rdh | /**
* Returns a {@link Predicate} for checking that table is enabled
*/
public Waiter.Predicate<IOException> predicateTableDisabled(final TableName tableName) {
return new ExplainingPredicate<IOException>() {
@Override
public String explainFailure() throws IOException {
return
explainTableState(tableName, State.DISA... | 3.26 |
hbase_HBaseTestingUtility_flush_rdh | /**
* Flushes all caches in the mini hbase cluster
*/
public void flush(TableName tableName) throws IOException {
getMiniHBaseCluster().flushcache(tableName);
} | 3.26 |
hbase_HBaseTestingUtility_createMultiRegionTable_rdh | /**
* Create a table with multiple regions.
*
* @return A Table instance for the created table.
*/
public Table createMultiRegionTable(TableName tableName, byte[][] families, int numVersions) throws IOException {
return createTable(tableName, families, numVersions, KEYS_FOR_HBA_CREATE_TABLE);
} | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.