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 bloomType : BloomType.values()) {
v2.add(new Object[]{ comprAlgo, bloomType });
}
}
return Collections.unmodifiableList(v2);
} | 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/[email protected]/msg01942.html [2]
* https://issues.apache.org/jira/browse/ZOOKEEPER-1105
*
* @param nodeZK
* - the ZK watcher to expire
* @param checkStatus
* - true to check if we can create a Table with the current configuration.
*/
public void expireSession(ZKWatcher nodeZK, boolean checkStatus) throws Exception {
Configuration c = new Configuration(this.conf);
String quorumServers = ZKConfig.getZKQuorumServersString(c);
ZooKeeper zk = nodeZK.getRecoverableZooKeeper().getZooKeeper();
byte[] password = zk.getSessionPasswd();
long sessionID = zk.getSessionId();
// Expiry seems to be asynchronous (see comment from P. Hunt in [1]),
// so we create a first watcher to be sure that the
// event was sent. We expect that if our watcher receives the event
// other watchers on the same machine will get is as well.
// When we ask to close the connection, ZK does not close it before
// we receive all the events, so don't have to capture the event, just
// closing the connection should be enough.
ZooKeeper monitor = new ZooKeeper(quorumServers, 1000, new Watcher() {
@Override
public void process(WatchedEvent watchedEvent) {
LOG.info("Monitor ZKW received event=" + watchedEvent);
}
}, sessionID, password);
// Making it expire
ZooKeeper newZK = new ZooKeeper(quorumServers, 1000, EmptyWatcher.instance, sessionID, password);
// ensure that we have connection to the server before closing down, otherwise
// the close session event will be eaten out before we start CONNECTING state
long start = EnvironmentEdgeManager.currentTime();
while ((newZK.getState() != States.CONNECTED) && ((EnvironmentEdgeManager.currentTime() - start) < 1000)) {
Thread.sleep(1);
}
newZK.close();
LOG.info("ZK Closed Session 0x" + Long.toHexString(sessionID));
// Now closing & waiting to be sure that the clients get it.
monitor.close();
if (checkStatus) {
getConnection().getTable(TableName.META_TABLE_NAME).close();
}
} | 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 hbaseAdmin;
} | 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;MiniHBaseCluster hbaseCluster = getMiniHBaseCluster();
for (int i = hbaseCluster.getLiveRegionServerThreads().size(); i < num; ++i) {
LOG.info("Started new server=" + hbaseCluster.startRegionServer());
startedServer = true;
}
return startedServer;
} | 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) throws IOException {
if (mrCluster != null) {
throw new IllegalStateException("MiniMRCluster is already running");
}
LOG.info("Starting mini mapreduce cluster...");
setupClusterTestDir();
createDirsAndSetProperties();
forceChangeTaskLogDir();
// // hadoop2 specific settings
// Tests were failing because this process used 6GB of virtual memory and was getting killed.
// we up the VM usable so that processes don't get killed.
conf.setFloat("yarn.nodemanager.vmem-pmem-ratio", 8.0F);
// Tests were failing due to MAPREDUCE-4880 / MAPREDUCE-4607 against hadoop 2.0.2-alpha and
// this avoids the problem by disabling speculative task execution in tests.
conf.setBoolean("mapreduce.map.speculative", false);
conf.setBoolean("mapreduce.reduce.speculative", false);
// //
// Allow the user to override FS URI for this map-reduce cluster to use.
mrCluster = new MiniMRCluster(servers, FS_URI != null ? FS_URI : FileSystem.get(conf).getUri().toString(), 1, null, null, new JobConf(this.conf));
JobConf jobConf = MapreduceTestingShim.getJobConf(mrCluster);
if (jobConf == null) {
jobConf = mrCluster.createJobConf();
}
// Hadoop MiniMR overwrites this while it should not
jobConf.set("mapreduce.cluster.local.dir", conf.get("mapreduce.cluster.local.dir"));
LOG.info("Mini mapreduce cluster started");
// In hadoop2, YARN/MR2 starts a mini cluster with its own conf instance and updates settings.
// Our HBase MR jobs need several of these settings in order to properly run. So we copy the
// necessary config properties here. YARN-129 required adding a few properties.
conf.set("mapreduce.jobtracker.address", jobConf.get("mapreduce.jobtracker.address"));
// this for mrv2 support; mr1 ignores this
conf.set("mapreduce.framework.name", "yarn");
conf.setBoolean("yarn.is.minicluster", true);
String rmAddress = jobConf.get("yarn.resourcemanager.address");
if (rmAddress != null) {conf.set("yarn.resourcemanager.address", rmAddress);
}
String historyAddress = jobConf.get("mapreduce.jobhistory.address");
if (historyAddress != null) {
conf.set("mapreduce.jobhistory.address", historyAddress);
}
String schedulerAddress = jobConf.get("yarn.resourcemanager.scheduler.address");if (schedulerAddress != null) {
conf.set("yarn.resourcemanager.scheduler.address", schedulerAddress);
}
String mrJobHistoryWebappAddress = jobConf.get("mapreduce.jobhistory.webapp.address");
if (mrJobHistoryWebappAddress != null) {
conf.set("mapreduce.jobhistory.webapp.address", mrJobHistoryWebappAddress);
}
String yarnRMWebappAddress = jobConf.get("yarn.resourcemanager.webapp.address");
if (yarnRMWebappAddress != null) {
conf.set("yarn.resourcemanager.webapp.address", yarnRMWebappAddress);
}
} | 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 milliseconds
*/
public void waitUntilAllRegionsAssigned(final TableName tableName, final long timeout) throws IOException {
if (!TableName.isMetaTableName(tableName)) {
try (final Table meta = getConnection().getTable(TableName.META_TABLE_NAME)) {
LOG.debug(((("Waiting until all regions of table " + tableName) + " get assigned. Timeout = ") + timeout) + "ms");
waitFor(timeout, 200, true, new ExplainingPredicate<IOException>() {
@Override
public String explainFailure() throws IOException {
return explainTableAvailability(tableName);
}
@Override
public boolean evaluate() throws IOException {
Scan scan = new Scan();
scan.addFamily(HConstants.CATALOG_FAMILY);
boolean tableFound = false;
try (ResultScanner v263 = meta.getScanner(scan)) {
for (Result r; (r = v263.next()) != null;) {
byte[] v265 = r.getValue(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER);
RegionInfo info = RegionInfo.parseFromOrNull(v265);
if ((info != null) && info.getTable().equals(tableName)) {
// Get server hosting this region from catalog family. Return false if no server
// hosting this region, or if the server hosting this region was recently killed
// (for fault tolerance testing).
tableFound = true;
byte[] server = r.getValue(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
if (server == null) {
return false;
} else {
byte[] startCode = r.getValue(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER);
ServerName serverName = ServerName.valueOf((Bytes.toString(server).replaceFirst(":", ",") + ",") + Bytes.toLong(startCode));
if ((!getHBaseClusterInterface().isDistributedCluster()) && getHBaseCluster().isKilledRS(serverName)) {
return false;
}
}
if (RegionStateStore.getRegionState(r, info) != State.OPEN) {
return false;
}
}
}
}
if (!tableFound) {
LOG.warn(("Didn't find the entries for table " + tableName) + " in meta, already deleted?"); }
return tableFound;
}
});
}
}
LOG.info(("All regions for table " + tableName) + " assigned to meta. Checking AM states.");
// check from the master state if we are using a mini cluster
if (!getHBaseClusterInterface().isDistributedCluster()) {
// So, all regions are in the meta table but make sure master knows of the assignments before
// returning -- sometimes this can lag.
HMaster master = getHBaseCluster().getMaster();
final RegionStates states = master.getAssignmentManager().getRegionStates();
waitFor(timeout, 200, new ExplainingPredicate<IOException>() {
@Override
public String explainFailure() throws IOException {
return explainTableAvailability(tableName);
}
@Override
public boolean evaluate() throws IOException {
List<RegionInfo> hris = states.getRegionsOfTable(tableName);
return (hris != null) && (!hris.isEmpty());
}
});
}
LOG.info(("All regions for table " + tableName) +
" assigned.");
} | 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, false });configurations.add(new Object[]{ true, true });
return Collections.unmodifiableList(configurations);
} | 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 #shutdownMiniCluster()}, then the Connection will no longer be wholesome.
* Rather than use the return direct, its usually best to make a copy and use that. Do
* <code>Configuration c = new Configuration(INSTANCE.getConfiguration());</code>
*
* @return Instance of Configuration.
*/
@Override
public Configuration getConfiguration() {
return super.getConfiguration();
} | 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 createWALRootDir() throws IOException {
FileSystem fs = FileSystem.get(this.conf);
Path walDir = getNewDataTestDirOnTestFS();CommonFSUtils.setWALRootDir(this.conf, walDir);
fs.mkdirs(walDir);
return walDir;
} | 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 evaluate() {
for (String label : labels) {
if (labelsCache.getLabelOrdinal(label) == 0) {
return false;
}
}
return true;
}
@Override
public
String explainFailure() {
for (String label : labels) {
if (labelsCache.getLabelOrdinal(label) == 0) {
return label + " is not available yet";
}
}
return "";
}
});
} | 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 (isNewVersionBehaviorEnabled()) {
for (ColumnFamilyDescriptor family : htd.getColumnFamilies()) {
builder.setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(family).setNewVersionBehavior(true).build());
}
}
if (splitRows != null) {
getAdmin().createTable(builder.build(), splitRows);
} else {
getAdmin().createTable(builder.build());
}
// HBaseAdmin only waits for regions to appear in hbase:meta
// we should wait until they are assigned
waitUntilAllRegionsAssigned(htd.getTableName());
return getConnection().getTable(htd.getTableName());
} | 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 expectedCount = 0;
if ((Bytes.compareTo(new byte[]{
b1, b2, b3 }, startRow) >= 0) && (Bytes.compareTo(new byte[]{ b1, b2, b3 }, stopRow) < 0)) {
expectedCount = 1;
}
if (count != expectedCount) {
String row = new String(new byte[]{ b1, b2, b3 },
StandardCharsets.UTF_8);
throw new RuntimeException(((((("Row:" +
row) + " has a seen count of ") + count) + " ")
+ "instead of ") + expectedCount);
}
}
}
}
} | 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, String>> i = conf.iterator(); i.hasNext();) {
* Map.Entry<String, String> e = i.next();
* assertFalse(e.getKey() + " " + e.getValue(), e.getValue().contains("/tmp"));
* }
* </pre>
*/private void createDirsAndSetProperties() throws IOException {
setupClusterTestDir();
conf.set(TEST_DIRECTORY_KEY, clusterTestDir.getPath());
System.setProperty(TEST_DIRECTORY_KEY, clusterTestDir.getPath());
createDirAndSetProperty("test.cache.data");
createDirAndSetProperty("hadoop.tmp.dir");
hadoopLogDir = createDirAndSetProperty("hadoop.log.dir");
createDirAndSetProperty("mapreduce.cluster.local.dir");
createDirAndSetProperty("mapreduce.cluster.temp.dir");
enableShortCircuit();
Path root = getDataTestDirOnTestFS("hadoop");
conf.set(MapreduceTestingShim.getMROutputDirProp(), new Path(root, "mapred-output-dir").toString());
conf.set("mapreduce.jobtracker.system.dir", new Path(root, "mapred-system-dir").toString());
conf.set("mapreduce.jobtracker.staging.root.dir", new Path(root, "mapreduce-jobtracker-staging-root-dir").toString());
conf.set("mapreduce.job.working.dir", new Path(root, "mapred-working-dir").toString());
conf.set("yarn.app.mapreduce.am.staging-dir", new Path(root, "mapreduce-am-staging-root-dir").toString());
// Frustrate yarn's and hdfs's attempts at writing /tmp.
// Below is fragile. Make it so we just interpolate any 'tmp' reference.
createDirAndSetProperty("yarn.node-labels.fs-store.root-dir");
createDirAndSetProperty("yarn.node-attribute.fs-store.root-dir");
createDirAndSetProperty("yarn.nodemanager.log-dirs");createDirAndSetProperty("yarn.nodemanager.remote-app-log-dir");
createDirAndSetProperty("yarn.timeline-service.entity-group-fs-store.active-dir");
createDirAndSetProperty("yarn.timeline-service.entity-group-fs-store.done-dir");
createDirAndSetProperty("yarn.nodemanager.remote-app-log-dir");
createDirAndSetProperty("dfs.journalnode.edits.dir");
createDirAndSetProperty("dfs.datanode.shared.file.descriptor.paths");
createDirAndSetProperty("nfs.dump.dir");
createDirAndSetProperty("java.io.tmpdir");
createDirAndSetProperty("dfs.journalnode.edits.dir");
createDirAndSetProperty("dfs.provided.aliasmap.inmemory.leveldb.dir");
createDirAndSetProperty("fs.s3a.committer.staging.tmp.path");
} | 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 = System.getProperty(propName);
if (readOnProp != null) {
return Boolean.parseBoolean(readOnProp);
} else {
return conf.getBoolean(propName, false);
}
} | 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);
List<byte[]> rows = new ArrayList<>();
ResultScanner s = t.getScanner(new Scan());
for (Result result : s) {
RegionInfo info = CatalogFamilyFormat.getRegionInfo(result);
if (info == null) {
LOG.error("No region info for row " + Bytes.toString(result.getRow()));
// TODO figure out what to do for this new hosed case.
continue;
}
if (info.getTable().equals(tableName)) {
LOG.info(("getMetaTableRows: row -> " + Bytes.toStringBinary(result.getRow())) + info);
rows.add(result.getRow());
}
}
s.close();
t.close();
return rows;
} | 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[], NavigableSet<byte[]>> s = get.getFamilyMap();
s.put(store.getColumnFamilyDescriptor().getName(), columns);
return getFromStoreFile(store, get);
} | 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 FileSystem could not be set from the passed dfs cluster
*/
public void
setDFSCluster(MiniDFSCluster cluster, boolean requireDown) throws IllegalStateException, IOException {
if (((dfsCluster != null) && requireDown) && dfsCluster.isClusterUp()) {
throw new IllegalStateException("DFSCluster is already running! Shut it down first.");
}
this.dfsCluster = cluster;
this.setFs();
} | 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(table)));
} | 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.ENABLED);
}
@Override
public boolean evaluate() throws IOException {
return getAdmin().tableExists(tableName) && getAdmin().isTableEnabled(tableName);
}
};
} | 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 others.
* @return A new configuration instance with a different user set into it.
*/
public static User getDifferentUser(final Configuration c, final String differentiatingSuffix) throws IOException {
FileSystem currentfs = FileSystem.get(c);
if ((!(currentfs instanceof DistributedFileSystem)) || User.isHBaseSecurityEnabled(c)) {
return
User.getCurrent();
}
// Else distributed filesystem. Make a new instance per daemon. Below
// code is taken from the AppendTestUtil over in hdfs.
String username = User.getCurrent().getName() + differentiatingSuffix;
User user = User.createUserForTesting(c, username, new String[]{ "supergroup" });
return user;
} | 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 tableName) throws IOException {
Table table = getConnection().getTable(tableName);
Scan scan = new Scan(); ResultScanner resScan = table.getScanner(scan);
for (Result res : resScan) {
Delete del = new Delete(res.getRow());
table.delete(del);
}
resScan = table.getScanner(scan);
resScan.close();return table;
} | 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(hrl.getRegion().getRegionName());
} | 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 ensureSomeNonStoppedRegionServersAvailable(final int num) throws IOException {
boolean startedServer = ensureSomeRegionServersAvailable(num);
int nonStoppedServers = 0;
for
(JVMClusterUtil.RegionServerThread v244
: getMiniHBaseCluster().getRegionServerThreads()) {
HRegionServer v245 = v244.getRegionServer();if (v245.isStopping() || v245.isStopped()) {
LOG.info("A region server is stopped or stopping:" + v245);
} else {
nonStoppedServers++;
}
}
for (int i = nonStoppedServers; i < num; ++i) {
LOG.info("Started new server=" + getMiniHBaseCluster().startRegionServer());
startedServer = true;
}
return startedServer;
} | 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 tests are written, not all start() stop() calls go through this class.
* Most tests directly operate on the underlying mini/local hbase cluster. That makes it difficult
* for this wrapper class to maintain the connection state automatically. Cleaning this is a much
* bigger refactor.
*/
public void invalidateConnection() throws IOException {
closeConnection();
// Update the master addresses if they changed.
final String masterConfigBefore = conf.get(HConstants.MASTER_ADDRS_KEY);
final String masterConfAfter = getMiniHBaseCluster().conf.get(HConstants.MASTER_ADDRS_KEY);
LOG.info("Invalidated connection. Updating master addresses before: {} after: {}", masterConfigBefore, masterConfAfter);
conf.set(HConstants.MASTER_ADDRS_KEY, getMiniHBaseCluster().conf.get(HConstants.MASTER_ADDRS_KEY));
} | 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 KDC server is preferred;
* less baggage. It came in in HBASE-5291.
*/
public MiniKdc setupMiniKdc(File keytabFile)
throws Exception {
Properties conf = MiniKdc.createConf();
conf.put(MiniKdc.DEBUG, true);
MiniKdc
kdc = null;
File dir = null;
// There is time lag between selecting a port and trying to bind with it. It's possible that
// another service captures the port in between which'll result in BindException.
boolean
bindException;
int numTries = 0;
do {
try {
bindException = false;
dir = new File(getDataTestDir("kdc").toUri().getPath());
kdc = new MiniKdc(conf, dir);
kdc.start();
} catch (BindException e) {
FileUtils.deleteDirectory(dir);// clean directory
numTries++;
if (numTries == 3) {
LOG.error(("Failed setting up MiniKDC. Tried " + numTries) + " times.");
throw e;
}
LOG.error("BindException encountered when setting up MiniKdc. Trying again.");
bindException = true;
}
} while (bindException );
HBaseKerberosUtils.setKeytabFileForTesting(keytabFile.getAbsolutePath());
return kdc;
} | 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 {
waitTableDisabled(TableName.valueOf(table), timeoutMillis);
} | 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(v);
}
return false;
} | 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 tableName, int maxAttempts) {
List<HRegion> regions = getHBaseCluster().getRegions(tableName);int regCount = regions.size();
Set<Integer> attempted = new HashSet<>();
int idx;
int attempts = 0;
do {
regions = getHBaseCluster().getRegions(tableName);
if (regCount != regions.size()) {
// if there was region movement, clear attempted Set
attempted.clear();
}
regCount = regions.size();
// There are chances that before we get the region for the table from an RS the region may
// be going for CLOSE. This may be because online schema change is enabled
if (regCount > 0) {
idx = ThreadLocalRandom.current().nextInt(regCount);
// if we have just tried this region, there is no need to try again
if (attempted.contains(idx)) {
continue;}
HRegion region = regions.get(idx);
if (region.checkSplit().isPresent()) {
return region;
}
attempted.add(idx);
}
attempts++;
} while ((maxAttempts == (-1)) || (attempts < maxAttempts) );return null;
} | 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<ColumnFamilyDescriptor> columnFamilyDescriptors = new ArrayList<>();
long familyId = 0;
for (Compression.Algorithm compressionType : getSupportedCompressionAlgorithms()) {
for (DataBlockEncoding encodingType : DataBlockEncoding.values()) {
for (BloomType bloomType : BloomType.values()) {
String name = String.format("%s-cf-!@#&-%d!@#", prefix, familyId);
ColumnFamilyDescriptorBuilder columnFamilyDescriptorBuilder = ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes(name));
columnFamilyDescriptorBuilder.setCompressionType(compressionType);
columnFamilyDescriptorBuilder.setDataBlockEncoding(encodingType);
columnFamilyDescriptorBuilder.setBloomFilterType(bloomType);
columnFamilyDescriptors.add(columnFamilyDescriptorBuilder.build());
familyId++;
}
}
}
return columnFamilyDescriptors;
} | 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 = ColumnFamilyDescriptorBuilder.newBuilder(family);
if (isNewVersionBehaviorEnabled()) {
cfBuilder.setNewVersionBehavior(true);
}
builder.setColumnFamily(cfBuilder.build());
getAdmin().createTable(builder.build(), splitRows);
// HBaseAdmin only waits for regions to appear in hbase:meta we should wait until they are
// assigned
waitUntilAllRegionsAssigned(tableName);
return getConnection().getTable(tableName);
} | 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.createAsyncClusterConnection(conf, null, user);} | 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 {
return createLocalHRegionWithInMemoryFlags(tableName, startKey, stopKey, conf, isReadOnly, durability, wal, null, families);
} | 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 = getMiniHBaseCluster().getMaster().getAssignmentManager().getRegionStates();
return "found in transition: " + regionStates.getRegionsInTransition().toString();
}
@Override
public boolean evaluate() throws IOException {
HMaster master = getMiniHBaseCluster().getMaster();
if (master == null)
return false;
AssignmentManager am =
master.getAssignmentManager();
if (am == null)
return false;
return !am.hasRegionsInTransition();
}
};
} | 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 " + curUser);
// read short circuit, for hdfs
conf.set("dfs.block.local-path-access.user",
curUser);
// read short circuit, for hbase
conf.setBoolean("dfs.client.read.shortcircuit", true);// Skip checking checksum, for the hdfs client and the datanode
conf.setBoolean("dfs.client.read.shortcircuit.skip.checksum", true);
} else {
LOG.info("read short circuit is OFF");
}
} | 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("Minicluster is down");
} | 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
*/
public Table truncateTable(final TableName tableName) throws IOException {
return truncateTable(tableName, false);
} | 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 = null;
}
if (zooKeeperWatcher != null) {
zooKeeperWatcher.close();
zooKeeperWatcher = null;
}
} | 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 = ReflectionUtils.getModifiersField();
modifiersField.setAccessible(true);
modifiersField.setInt(logDirField, logDirField.getModifiers() & (~Modifier.FINAL));
logDirField.set(null, new File(hadoopLogDir, "userlogs"));
} catch (SecurityException e) {
throw new RuntimeException(e);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | 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 possible that the dfs cluster is set through setDFSCluster method, where we will not
// have a fixer
if (dfsClusterFixer != null) {
this.dfsClusterFixer.shutdown();
dfsClusterFixer = null;
}
dataTestDirOnTestFS = null;
CommonFSUtils.setFsDefault(this.conf, new Path("file:///"));
}
}
/**
* Start up a minicluster of hbase, dfs, and zookeeper where WAL's walDir is created separately.
* All other options will use default values, defined in {@link StartMiniClusterOption.Builder}.
*
* @param createWALDir
* Whether to create a new WAL directory.
* @return The mini HBase cluster created.
* @see #shutdownMiniCluster()
* @deprecated since 2.2.0 and will be removed in 4.0.0. Use
{@link #startMiniCluster(StartMiniClusterOption)} | 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_MAXTOSTART,
-1);
} | 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 IOException {
ChunkCreator.initialize(MemStoreLAB.CHUNK_SIZE_DEFAULT, false, 0, 0, 0, null, MemStoreLAB.INDEX_CHUNK_SIZE_PERCENTAGE_DEFAULT);
WAL wal = createWal(conf, rootDir, info);
return HRegion.createHRegion(info, rootDir, conf, htd, wal, initialize);
} | 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().deleteTable(tableName);
} | 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 going on to shutdown zk.
this.hbaseCluster.waitUntilShutDown();
this.hbaseCluster = null;
}
if (zooKeeperWatcher != null) {
zooKeeperWatcher.close();
zooKeeperWatcher = null;
}
} | 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(((((((((("\n\nCreating random table " + tableName) + " with ") + numRegions) + " regions, ") + numFlushes) + " storefiles per region, ") + numRowsPerFlush) + " rows per flush, maxVersions=") + maxVersions) + "\n");
final int v285 = families.size();
final byte[][] cfBytes = new byte[v285][];
{
int cfIndex = 0;
for (String cf : families) {
cfBytes[cfIndex++] = Bytes.toBytes(cf);
}
}
final int actualStartKey = 0;
final int actualEndKey = Integer.MAX_VALUE;
final int
keysPerRegion = (actualEndKey - actualStartKey) / numRegions;final int splitStartKey = actualStartKey + keysPerRegion;
final int splitEndKey = actualEndKey - keysPerRegion;final String keyFormat = "%08x";
final Table table = createTable(tableName, cfBytes, maxVersions, Bytes.toBytes(String.format(keyFormat, splitStartKey)), Bytes.toBytes(String.format(keyFormat, splitEndKey)), numRegions);
if (hbaseCluster != null) {
getMiniHBaseCluster().flushcache(TableName.META_TABLE_NAME);
}
BufferedMutator mutator = getConnection().getBufferedMutator(tableName);
final Random rand = ThreadLocalRandom.current();
for (int iFlush = 0; iFlush < numFlushes; ++iFlush) {
for (int
iRow = 0; iRow < numRowsPerFlush; ++iRow) {
final byte[] row = Bytes.toBytes(String.format(keyFormat, actualStartKey +
rand.nextInt(actualEndKey - actualStartKey)));
Put put = new Put(row);
Delete del = new Delete(row);
for (int iCol = 0; iCol < numColsPerRow; ++iCol) {
final
byte[] cf = cfBytes[rand.nextInt(v285)];
final long ts = rand.nextInt();
final byte[] qual = Bytes.toBytes("col" + iCol);
if (rand.nextBoolean()) {
final byte[] value = Bytes.toBytes((((((((("value_for_row_" + iRow) + "_cf_") + Bytes.toStringBinary(cf)) + "_col_") + iCol) + "_ts_") + ts) + "_random_") + rand.nextLong());
put.addColumn(cf, qual, ts, value);
} else if (rand.nextDouble() < 0.8) {
del.addColumn(cf,
qual, ts);
} else {
del.addColumns(cf, qual, ts);
}
}
if (!put.isEmpty()) {
mutator.mutate(put);
}
if (!del.isEmpty()) {
mutator.mutate(del);
}
}
LOG.info((("Initiating flush #" + iFlush) + " for table ") + tableName);
mutator.flush();
if (hbaseCluster != null) {
getMiniHBaseCluster().flushcache(table.getName());
}
}
mutator.close();
return table;
} | 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.
Configuration confForWAL = new Configuration(conf);
confForWAL.set(HConstants.HBASE_DIR, rootDir.toString());
return new
WALFactory(confForWAL, "hregion-" + RandomStringUtils.randomNumeric(8)).getWAL(hri);
} | 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(getTestFileSystem());
rss.setRpcServer(rpc);
return rss;
} | 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 byte[][] f, byte[] value, boolean writeToWAL) throws IOException {
List<Put> puts = new ArrayList<>();
for (byte[] row : HBaseTestingUtility.ROWS) {
Put put = new Put(row);
put.setDurability(writeToWAL ? Durability.USE_DEFAULT : Durability.SKIP_WAL);
for (int i = 0; i < f.length; i++) {
byte[] value1 = (value != null) ? value : row;
put.addColumn(f[i], f[i], value1);
}
puts.add(put);
}
t.put(puts);
return puts.size();
} | 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 {
HMaster master = getMiniHBaseCluster().getMaster();
// TODO: Here we start the move. The move can take a while.
getAdmin().move(destRegion.getEncodedNameAsBytes(), destServer);
while (true) {
ServerName serverName = master.getAssignmentManager().getRegionStates().getRegionServerOfRegion(destRegion);
if ((serverName != null) && serverName.equals(destServer)) {
assertRegionOnServer(destRegion, serverName, 2000);
break;
}
Thread.sleep(10);
}
} | 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 to do concurrent instances -- another instance could
* grab the temporary value unintentionally -- but not anything can do about it at moment; single
* instance only is how the minidfscluster works. We also create the underlying directory names
* for hadoop.log.dir, mapreduce.cluster.local.dir and hadoop.tmp.dir, and set the values in the
* conf, and as a system property for hadoop.tmp.dir (We do not create them!).
*
* @return The calculated data test build directory, if newly-created.
*/
@Override
protected Path setupDataTestDir() {Path testPath = super.setupDataTestDir();
if (null == testPath) {
return null;
}
createSubDirAndSystemProperty("hadoop.log.dir", testPath, "hadoop-log-dir");
// This is defaulted in core-default.xml to /tmp/hadoop-${user.name}, but
// we want our own value to ensure uniqueness on the same machine
createSubDirAndSystemProperty("hadoop.tmp.dir",
testPath, "hadoop-tmp-dir");
// Read and modified in org.apache.hadoop.mapred.MiniMRCluster
createSubDir("mapreduce.cluster.local.dir", testPath, "mapred-local-dir");
return testPath;
} | 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 (RuntimeException e) {
if (e.getCause() instanceof AssertionError) {
throw ((AssertionError) (e.getCause()));
}throw e;
}
} | 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, InterruptedException {
return startMiniHBaseCluster(StartMiniClusterOption.builder().build());
}
/**
* Starts up mini hbase cluster. Usually you won't want this. You'll usually want
* {@link #startMiniCluster()}. All other options will use default values, defined in
* {@link StartMiniClusterOption.Builder}.
*
* @param numMasters
* Master node number.
* @param numRegionServers
* Number of region servers.
* @return The mini HBase cluster created.
* @see #shutdownMiniHBaseCluster()
* @deprecated since 2.2.0 and will be removed in 4.0.0. Use
{@link #startMiniHBaseCluster(StartMiniClusterOption)} | 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): Error Recovery for block
* blk_928005470262850423_1021 failed because recovery from primary datanode 127.0.0.1:53683
* failed 4 times. Pipeline was 127.0.0.1:53687, 127.0.0.1:53683. Will retry...
* </pre>
*
* @param stream
* A DFSClient.DFSOutputStream.
*/
public static void setMaxRecoveryErrorCount(final OutputStream stream, final int max) {
try {
Class<?>[] clazzes = DFSClient.class.getDeclaredClasses();
for (Class<?> clazz : clazzes) {
String className = clazz.getSimpleName();
if (className.equals("DFSOutputStream")) {
if (clazz.isInstance(stream)) {
Field maxRecoveryErrorCountField = stream.getClass().getDeclaredField("maxRecoveryErrorCount");
maxRecoveryErrorCountField.setAccessible(true);
maxRecoveryErrorCountField.setInt(stream, max);
break;
}
}
}
} catch (Exception e) {
LOG.info("Could not set max recovery field", e);
}
} | 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());
return;
}
dataTestDirOnTestFS = getNewDataTestDirOnTestFS();
} | 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.restartHBaseCluster(servers, null);
} | 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 MiniHBaseCluster startMiniCluster(StartMiniClusterOption option) throws Exception { LOG.info("Starting up minicluster with option: {}", option);
// If we already put up a cluster, fail.
if (miniClusterRunning) {
throw new IllegalStateException("A mini-cluster is already running");
}
miniClusterRunning
= true;
setupClusterTestDir();
System.setProperty(TEST_DIRECTORY_KEY, this.clusterTestDir.getPath());
// Bring up mini dfs cluster. This spews a bunch of warnings about missing
// scheme. Complaints are 'Scheme is undefined for build/test/data/dfs/name1'.
if (dfsCluster == null) {
LOG.info("STARTING DFS");
dfsCluster =
startMiniDFSCluster(option.getNumDataNodes(), option.getDataNodeHosts());
} else {LOG.info("NOT STARTING DFS");
}
// Start up a zk cluster.
if (getZkCluster() == null) {
startMiniZKCluster(option.getNumZkServers());
}
// Start the MiniHBaseCluster
return startMiniHBaseCluster(option);
} | 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 the base test dir
*/
public Path getDataTestDirOnTestFS(final String subdirName) throws IOException {
return new Path(getDataTestDirOnTestFS(), subdirName);
} | 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) throws IOException, InterruptedException
{
List<RegionInfo> regions = getRegions(tableName);
if ((regions == null) || regions.isEmpty()) {
return null;}
LOG.debug((("Found " + regions.size()) + " regions for table ") + tableName);
byte[] firstRegionName = regions.stream().filter(r -> !r.isOffline()).map(RegionInfo::getRegionName).findFirst().orElseThrow(() -> new IOException("online regions not found in table " + tableName));
LOG.debug("firstRegionName=" + Bytes.toString(firstRegionName));
long pause = getConfiguration().getLong(HConstants.HBASE_CLIENT_PAUSE, HConstants.DEFAULT_HBASE_CLIENT_PAUSE);
int numRetries = getConfiguration().getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
RetryCounter retrier = new RetryCounter(numRetries + 1,
((int) (pause)), TimeUnit.MICROSECONDS);
while (retrier.shouldRetry()) {
int index = getMiniHBaseCluster().getServerWith(firstRegionName);
if (index != (-1)) {
return getMiniHBaseCluster().getRegionServerThreads().get(index).getRegionServer();
}
// Came back -1. Region may not be online yet. Sleep a while.
retrier.sleepUntilNextRetry();
}
return null;
} | 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.close();
return digest.toString();
} | 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(byte[] table, long timeoutMillis) throws InterruptedException, IOException {
waitTableEnabled(TableName.valueOf(table), timeoutMillis);
} | 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);
}
@Override
public boolean evaluate() throws IOException {
boolean tableAvailable = getAdmin().isTableAvailable(tableName);
if (tableAvailable) {
try (Table table = getConnection().getTable(tableName)) {
TableDescriptor htd =
table.getDescriptor();
for (HRegionLocation loc : getConnection().getRegionLocator(tableName).getAllRegionLocations()) {
Scan scan = new Scan().withStartRow(loc.getRegion().getStartKey()).withStopRow(loc.getRegion().getEndKey()).setOneRowLimit().setMaxResultsPerColumnFamily(1).setCacheBlocks(false);
for (byte[] family : htd.getColumnFamilyNames()) {
scan.addFamily(family);
}
try (ResultScanner scanner = table.getScanner(scan)) {
scanner.next();
} }
}
}
return tableAvailable;
}
};
} | 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 splitter, int numRegionsPerServer) throws IOException {
TableDescriptorBuilder builder =
TableDescriptorBuilder.newBuilder(td);
for (ColumnFamilyDescriptor cd : cds) {
if (!td.hasColumnFamily(cd.getName())) {
builder.setColumnFamily(cd);
}
}
td = builder.build();int totalNumberOfRegions = 0;
Connection unmanagedConnection = ConnectionFactory.createConnection(conf);
Admin v323 = unmanagedConnection.getAdmin();
try {
// create a table a pre-splits regions.
// The number of splits is set as:
// region servers * regions per region server).
int numberOfServers = v323.getRegionServers().size();
if (numberOfServers == 0) {
throw new IllegalStateException("No live regionservers");}
totalNumberOfRegions = numberOfServers * numRegionsPerServer;
LOG.info(((((((("Number of live regionservers: " + numberOfServers) +
", ") + "pre-splitting table into ") + totalNumberOfRegions) + " regions ") + "(regions per server: ") + numRegionsPerServer) + ")");
byte[][] splits = splitter.split(totalNumberOfRegions);
v323.createTable(td, splits);
} catch (MasterNotRunningException e) {
LOG.error("Master not running", e);
throw new IOException(e);
} catch (TableExistsException e) {
LOG.warn(("Table " + td.getTableName())
+ " already exists, continuing");
} finally {
v323.close();
unmanagedConnection.close();
}
return totalNumberOfRegions;
} | 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 AssertionError();
}
byte[][] v277 = Bytes.split(startKey, endKey, numRegions - 3);
byte[][] result = new byte[v277.length + 1][];
System.arraycopy(v277, 0, result, 1, v277.length);
result[0] = HConstants.EMPTY_BYTE_ARRAY;
return result;
} | 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, InterruptedException {
long timeoutTime = EnvironmentEdgeManager.currentTime() + timeout;
while (true) {
List<RegionInfo> regions = getAdmin().getRegions(server);
if (regions.stream().anyMatch(r -> RegionInfo.COMPARATOR.compare(r, hri) == 0))
return;
long now = EnvironmentEdgeManager.currentTime();
if (now > timeoutTime)
break;
Thread.sleep(10);
}
throw new AssertionError((("Could not find region " + hri.getRegionNameAsString()) + " on server ") + server);
} | 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 Configuration conf, final TableDescriptor htd, byte[][] startKeys) throws IOException {
Table meta = getConnection().getTable(TableName.META_TABLE_NAME);
Arrays.sort(startKeys, Bytes.BYTES_COMPARATOR);
List<RegionInfo> newRegions = new ArrayList<>(startKeys.length);
MetaTableAccessor.updateTableState(getConnection(), htd.getTableName(), State.ENABLED);
// add custom ones
for (int i = 0; i < startKeys.length; i++) {
int j = (i + 1) % startKeys.length;
RegionInfo hri = RegionInfoBuilder.newBuilder(htd.getTableName()).setStartKey(startKeys[i]).setEndKey(startKeys[j]).build();
MetaTableAccessor.addRegionsToMeta(getConnection(), Collections.singletonList(hri), 1);
newRegions.add(hri);
}
meta.close();
return newRegions;
} | 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 getDefaultRootDirPath(false);
} | 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().getAdmin()) {
return admin.getRegions(tableName);
}} | 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 tests should use getBaseTestDir, otherwise, we can use
// the working directory, and create a unique sub dir there
FileSystem fs = getTestFileSystem();
Path newDataTestDir;
String randomStr = getRandomUUID().toString();
if (fs.getUri().getScheme().equals(FileSystem.getLocal(conf).getUri().getScheme())) {
newDataTestDir = new Path(getDataTestDir(), randomStr);
File
dataTestDir = new File(newDataTestDir.toString());if (deleteOnExit())
dataTestDir.deleteOnExit();
} else {
Path base
= getBaseTestDirOnTestFS();
newDataTestDir = new Path(base, randomStr);
if (deleteOnExit())
fs.deleteOnExit(newDataTestDir);
}
return newDataTestDir;
} | 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() == rs)) {
return rst.getRegionServer();
}
}
return null;} | 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 {
return startMiniDFSCluster(servers, null, hosts);
} | 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 {
ss = new ServerSocket(port);
ss.setReuseAddress(true);
ds = new DatagramSocket(port);
ds.setReuseAddress(true);
return true;
} catch (IOException e) {
// Do nothing
} finally {
if (ds != null) {
ds.close();
}
if (ss != null) {
try {
ss.close();
} catch (IOException e) {
/* should not be thrown */
}
}
}
return false;
} | 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 jobtracker
conf.set("mapreduce.jobtracker.address", "local");
} | 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()} can be used
* instead w/o the need to type-cast.
*/
public HBaseCluster getHBaseClusterInterface() {
// implementation note: we should rename this method as #getHBaseCluster(),
// but this would require refactoring 90+ calls.
return hbaseCluster;
} | 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;
while (true) {
List<RegionInfo> regions = getAdmin().getRegions(server);
if (regions.stream().anyMatch(r -> RegionInfo.COMPARATOR.compare(r, hri) == 0)) {
List<JVMClusterUtil.RegionServerThread> rsThreads = getHBaseCluster().getLiveRegionServerThreads();
for (JVMClusterUtil.RegionServerThread rsThread : rsThreads) {
HRegionServer rs = rsThread.getRegionServer();
if (server.equals(rs.getServerName())) {
continue;
}
Collection<HRegion> hrs = rs.getOnlineRegionsLocalContext();
for (HRegion r : hrs) {
if (r.getRegionInfo().getRegionId() == hri.getRegionId()) {
throw new AssertionError("Region should not be double assigned");
}
}
}
return;// good, we are happy
}
long now = EnvironmentEdgeManager.currentTime();
if (now > timeoutTime)
break;
Thread.sleep(10);
}
throw new AssertionError((("Could not find region " + hri.getRegionNameAsString()) +
" on server ") + server);
} | 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, ColumnFamilyDescriptorBuilder.DEFAULT_KEEP_DELETED);
} | 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.DISABLED);
}
@Override
public boolean evaluate() throws IOException {
return getAdmin().isTableDisabled(tableName);
}
};
} | 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 saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.