本文整理汇总了Java中org.apache.hadoop.hbase.Waiter类的典型用法代码示例。如果您正苦于以下问题:Java Waiter类的具体用法?Java Waiter怎么用?Java Waiter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Waiter类属于org.apache.hadoop.hbase包,在下文中一共展示了Waiter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testWALEntryFilterFromReplicationEndpoint
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
@Test (timeout=120000)
public void testWALEntryFilterFromReplicationEndpoint() throws Exception {
admin.addPeer("testWALEntryFilterFromReplicationEndpoint",
new ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))
.setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName()), null);
// now replicate some data.
try (Connection connection = ConnectionFactory.createConnection(conf1)) {
doPut(connection, Bytes.toBytes("row1"));
doPut(connection, row);
doPut(connection, Bytes.toBytes("row2"));
}
Waiter.waitFor(conf1, 60000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return ReplicationEndpointForTest.replicateCount.get() >= 1;
}
});
Assert.assertNull(ReplicationEndpointWithWALEntryFilter.ex.get());
admin.removePeer("testWALEntryFilterFromReplicationEndpoint");
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:TestReplicationEndpoint.java
示例2: waitForCounterBoolean
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
private boolean waitForCounterBoolean(final AtomicLong ctr, final long oldval, final long newval,
long timems, boolean failIfTimeout) throws Exception {
long timeWaited = TEST_UTIL.waitFor(timems, 10, failIfTimeout,
new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return (ctr.get() >= newval);
}
});
if( timeWaited > 0) {
// when not timed out
assertEquals(newval, ctr.get());
}
return true;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:TestSplitLogWorker.java
示例3: testWALEntryFilterFromReplicationEndpoint
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
@Test (timeout=120000)
public void testWALEntryFilterFromReplicationEndpoint() throws Exception {
admin.addPeer("testWALEntryFilterFromReplicationEndpoint",
new ReplicationPeerConfig().setClusterKey(ZKUtil.getZooKeeperClusterKey(conf1))
.setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName()), null);
// now replicate some data.
try (Connection connection = ConnectionFactory.createConnection(conf1)) {
doPut(connection, Bytes.toBytes("row1"));
doPut(connection, row);
doPut(connection, Bytes.toBytes("row2"));
}
Waiter.waitFor(conf1, 60000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return ReplicationEndpointForTest.replicateCount.get() >= 1;
}
});
Assert.assertNull(ReplicationEndpointWithWALEntryFilter.ex.get());
admin.removePeer("testWALEntryFilterFromReplicationEndpoint");
}
开发者ID:grokcoder,项目名称:pbase,代码行数:23,代码来源:TestReplicationEndpoint.java
示例4: waitForTableToBeOnline
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
public static void waitForTableToBeOnline(final HBaseTestingUtility util,
final TableName tableName)
throws IOException, InterruptedException {
HRegionServer rs = util.getRSForFirstRegionInTable(tableName);
List<HRegion> onlineRegions = rs.getOnlineRegions(tableName);
for (HRegion region : onlineRegions) {
region.waitForFlushesAndCompactions();
}
// Wait up to 60 seconds for a table to be available.
final HBaseAdmin hBaseAdmin = util.getHBaseAdmin();
util.waitFor(60000, new Waiter.Predicate<IOException>() {
@Override
public boolean evaluate() throws IOException {
return hBaseAdmin.isTableAvailable(tableName);
}
});
}
开发者ID:grokcoder,项目名称:pbase,代码行数:18,代码来源:SnapshotTestingUtils.java
示例5: waitForLogAdvance
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
/**
* Waits until there is only one log(the current writing one) in the replication queue
* @param numRs number of regionservers
*/
private void waitForLogAdvance(int numRs) throws Exception {
Waiter.waitFor(conf1, 10000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
for (int i = 0; i < numRs; i++) {
HRegionServer hrs = utility1.getHBaseCluster().getRegionServer(i);
RegionInfo regionInfo =
utility1.getHBaseCluster().getRegions(htable1.getName()).get(0).getRegionInfo();
WAL wal = hrs.getWAL(regionInfo);
Path currentFile = ((AbstractFSWAL<?>) wal).getCurrentFileName();
Replication replicationService = (Replication) utility1.getHBaseCluster()
.getRegionServer(i).getReplicationSourceService();
for (ReplicationSourceInterface rsi : replicationService.getReplicationManager()
.getSources()) {
ReplicationSource source = (ReplicationSource) rsi;
if (!currentFile.equals(source.getCurrentPath())) {
return false;
}
}
}
return true;
}
});
}
开发者ID:apache,项目名称:hbase,代码行数:29,代码来源:TestReplicationEmptyWALRecovery.java
示例6: waitPeer
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
private static void waitPeer(final String peerId,
ReplicationSourceManager manager, final boolean waitForSource) {
ReplicationPeers rp = manager.getReplicationPeers();
Waiter.waitFor(conf, 20000, () -> {
if (waitForSource) {
ReplicationSourceInterface rs = manager.getSource(peerId);
if (rs == null) {
return false;
}
if (rs instanceof ReplicationSourceDummy) {
return ((ReplicationSourceDummy)rs).isStartup();
}
return true;
} else {
return (rp.getPeer(peerId) != null);
}
});
}
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:TestReplicationSourceManager.java
示例7: removePeerAndWait
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
/**
* Remove a peer and wait for it to get cleaned up
* @param peerId
* @throws Exception
*/
private void removePeerAndWait(final String peerId) throws Exception {
final ReplicationPeers rp = manager.getReplicationPeers();
if (rp.getPeerStorage().listPeerIds().contains(peerId)) {
rp.getPeerStorage().removePeer(peerId);
try {
manager.removePeer(peerId);
} catch (Exception e) {
// ignore the failed exception and continue.
}
}
Waiter.waitFor(conf, 20000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
Collection<String> peers = rp.getPeerStorage().listPeerIds();
return (!manager.getAllQueues().contains(peerId)) && (rp.getPeer(peerId) == null)
&& (!peers.contains(peerId)) && manager.getSource(peerId) == null;
}
});
}
开发者ID:apache,项目名称:hbase,代码行数:25,代码来源:TestReplicationSourceManager.java
示例8: testRace
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
@Test
public void testRace() throws Exception {
ProcedureExecutor<?> executor =
UTIL.getMiniHBaseCluster().getMaster().getMasterProcedureExecutor();
DummyProcedure p = new DummyProcedure();
long procId = executor.submitProcedure(p);
p.failureSet.await();
assertEquals(GetProcedureResultResponse.State.RUNNING, getState(procId));
p.canRollback.countDown();
UTIL.waitFor(30000, new Waiter.ExplainingPredicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return getState(procId) == GetProcedureResultResponse.State.FINISHED;
}
@Override
public String explainFailure() throws Exception {
return "Procedure pid=" + procId + " is still in " + getState(procId) +
" state, expected " + GetProcedureResultResponse.State.FINISHED;
}
});
}
开发者ID:apache,项目名称:hbase,代码行数:24,代码来源:TestGetProcedureResult.java
示例9: checkExistence
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
private static void checkExistence(final Table htable, final byte[] row, final byte[] family,
final byte[] quality,
final byte[] value) throws Exception {
// verify that the Get returns the correct result
TEST_UTIL.waitFor(30000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
Result r;
Get get = new Get(row);
get.addColumn(family, quality);
r = htable.get(get);
return r != null && r.getValue(family, quality) != null
&& Bytes.toStringBinary(value).equals(
Bytes.toStringBinary(r.getValue(family, quality)));
}
});
}
开发者ID:apache,项目名称:hbase,代码行数:18,代码来源:TestHTableMultiplexerFlushCache.java
示例10: testCreateAndDelete
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
@Test(timeout = 60000)
public void testCreateAndDelete() throws Exception {
String testName = "testCreateAndDelete";
String nsName = prefix + "_" + testName;
// create namespace and verify
admin.createNamespace(NamespaceDescriptor.create(nsName).build()).join();
assertEquals(3, admin.listNamespaceDescriptors().get().size());
TEST_UTIL.waitFor(60000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return zkNamespaceManager.list().size() == 3;
}
});
assertNotNull(zkNamespaceManager.get(nsName));
// delete namespace and verify
admin.deleteNamespace(nsName).join();
assertEquals(2, admin.listNamespaceDescriptors().get().size());
assertEquals(2, zkNamespaceManager.list().size());
assertNull(zkNamespaceManager.get(nsName));
}
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:TestAsyncNamespaceAdminApi.java
示例11: waitForTableToEnterQuotaViolation
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
private void waitForTableToEnterQuotaViolation(TableName tn) throws Exception {
// Verify that the RegionServer has the quota in violation
final HRegionServer rs = TEST_UTIL.getHBaseCluster().getRegionServer(0);
Waiter.waitFor(TEST_UTIL.getConfiguration(), 30 * 1000, 1000, new Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
Map<TableName,SpaceQuotaSnapshot> snapshots =
rs.getRegionServerSpaceQuotaManager().copyQuotaSnapshots();
SpaceQuotaSnapshot snapshot = snapshots.get(tn);
if (snapshot == null) {
LOG.info("Found no snapshot for " + tn);
return false;
}
LOG.info("Found snapshot " + snapshot);
return snapshot.getQuotaStatus().isInViolation();
}
});
}
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:TestSuperUserQuotaPermissions.java
示例12: testRegionSizesFromMaster
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
@Test
public void testRegionSizesFromMaster() throws Exception {
final long tableSize = 1024L * 10L; // 10KB
final int numRegions = 10;
final TableName tn = helper.createTableWithRegions(numRegions);
// Will write at least `tableSize` data
helper.writeData(tn, tableSize);
final HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster();
final MasterQuotaManager quotaManager = master.getMasterQuotaManager();
// Make sure the master has all of the reports
Waiter.waitFor(TEST_UTIL.getConfiguration(), 30 * 1000, new Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
Map<RegionInfo,Long> regionSizes = quotaManager.snapshotRegionSizes();
LOG.trace("Region sizes=" + regionSizes);
return numRegions == countRegionsForTable(tn, regionSizes) &&
tableSize <= getTableSize(tn, regionSizes);
}
});
Map<TableName,Long> sizes = QuotaTableUtil.getMasterReportedTableSizes(TEST_UTIL.getConnection());
Long size = sizes.get(tn);
assertNotNull("No reported size for " + tn, size);
assertTrue("Reported table size was " + size, size.longValue() >= tableSize);
}
开发者ID:apache,项目名称:hbase,代码行数:27,代码来源:TestQuotaStatusRPCs.java
示例13: stopServersAndWaitUntilProcessed
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
private void stopServersAndWaitUntilProcessed(List<ServerName> currentFN) throws Exception {
for (ServerName sn : currentFN) {
for (JVMClusterUtil.RegionServerThread rst : cluster.getLiveRegionServerThreads()) {
if (ServerName.isSameAddress(sn, rst.getRegionServer().getServerName())) {
LOG.info("Shutting down server: " + sn);
cluster.stopRegionServer(rst.getRegionServer().getServerName());
cluster.waitForRegionServerToStop(rst.getRegionServer().getServerName(), 60000);
}
}
}
// Wait until dead servers are processed.
TEST_UTIL.waitFor(60000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return !master.getServerManager().areDeadServersInProgress();
}
});
assertEquals("Not all servers killed",
SLAVES - currentFN.size(), cluster.getLiveRegionServerThreads().size());
}
开发者ID:apache,项目名称:hbase,代码行数:23,代码来源:TestFavoredStochasticLoadBalancer.java
示例14: startCluster
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
private void startCluster(int numRS) throws Exception {
SplitLogCounters.resetCounters();
LOG.info("Starting cluster");
conf.setLong("hbase.splitlog.max.resubmit", 0);
// Make the failure test faster
conf.setInt("zookeeper.recovery.retry", 0);
conf.setInt(HConstants.REGIONSERVER_INFO_PORT, -1);
conf.setFloat(HConstants.LOAD_BALANCER_SLOP_KEY, (float) 100.0); // no load balancing
conf.setInt("hbase.regionserver.wal.max.splitters", 3);
conf.setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 10);
conf.set("hbase.wal.provider", getWalProvider());
TEST_UTIL.startMiniHBaseCluster(NUM_MASTERS, numRS);
cluster = TEST_UTIL.getHBaseCluster();
LOG.info("Waiting for active/ready master");
cluster.waitForActiveAndReadyMaster();
master = cluster.getMaster();
TEST_UTIL.waitFor(120000, 200, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return cluster.getLiveRegionServerThreads().size() >= numRS;
}
});
}
开发者ID:apache,项目名称:hbase,代码行数:24,代码来源:AbstractTestDLS.java
示例15: waitForCounterBoolean
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
private boolean waitForCounterBoolean(final LongAdder ctr, final long oldval, final long newval,
long timems, boolean failIfTimeout) throws Exception {
long timeWaited = TEST_UTIL.waitFor(timems, 10, failIfTimeout,
new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return (ctr.sum() >= newval);
}
});
if( timeWaited > 0) {
// when not timed out
assertEquals(newval, ctr.sum());
}
return true;
}
开发者ID:apache,项目名称:hbase,代码行数:18,代码来源:TestSplitLogWorker.java
示例16: setUp
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
TEST_UTIL = new HBaseTestingUtility();
TEST_UTIL.getConfiguration().set(
HConstants.HBASE_MASTER_LOADBALANCER_CLASS,
RSGroupBasedLoadBalancer.class.getName());
TEST_UTIL.getConfiguration().set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
RSGroupAdminEndpoint.class.getName());
TEST_UTIL.getConfiguration().set(
ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART,
"1");
TEST_UTIL.startMiniCluster(2, 3);
cluster = TEST_UTIL.getHBaseCluster();
master = ((MiniHBaseCluster)cluster).getMaster();
master.balanceSwitch(false);
hbaseAdmin = TEST_UTIL.getAdmin();
//wait till the balancer is in online mode
TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return master.isInitialized() &&
((RSGroupBasedLoadBalancer) master.getLoadBalancer()).isOnline() &&
master.getServerManager().getOnlineServersList().size() >= 3;
}
});
}
开发者ID:apache,项目名称:hbase,代码行数:27,代码来源:TestRSGroupsOfflineMode.java
示例17: testNamespaceCreateAndAssign
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
@Test
public void testNamespaceCreateAndAssign() throws Exception {
LOG.info("testNamespaceCreateAndAssign");
String nsName = tablePrefix+"_foo";
final TableName tableName = TableName.valueOf(nsName, tablePrefix + "_testCreateAndAssign");
RSGroupInfo appInfo = addGroup("appInfo", 1);
admin.createNamespace(NamespaceDescriptor.create(nsName)
.addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, "appInfo").build());
final HTableDescriptor desc = new HTableDescriptor(tableName);
desc.addFamily(new HColumnDescriptor("f"));
admin.createTable(desc);
//wait for created table to be assigned
TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return getTableRegionMap().get(desc.getTableName()) != null;
}
});
ServerName targetServer =
ServerName.parseServerName(appInfo.getServers().iterator().next().toString());
AdminProtos.AdminService.BlockingInterface rs =
((ClusterConnection) admin.getConnection()).getAdmin(targetServer);
//verify it was assigned to the right group
Assert.assertEquals(1, ProtobufUtil.getOnlineRegions(rs).size());
}
开发者ID:apache,项目名称:hbase,代码行数:26,代码来源:TestRSGroups.java
示例18: testDefaultNamespaceCreateAndAssign
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
@Test
public void testDefaultNamespaceCreateAndAssign() throws Exception {
LOG.info("testDefaultNamespaceCreateAndAssign");
String tableName = tablePrefix + "_testCreateAndAssign";
admin.modifyNamespace(NamespaceDescriptor.create("default")
.addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, "default").build());
final HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName));
desc.addFamily(new HColumnDescriptor("f"));
admin.createTable(desc);
//wait for created table to be assigned
TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return getTableRegionMap().get(desc.getTableName()) != null;
}
});
}
开发者ID:apache,项目名称:hbase,代码行数:18,代码来源:TestRSGroups.java
示例19: setUpBeforeClass
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
conf = TEST_UTIL.getConfiguration();
TEST_UTIL.startMiniCluster(1, 1);
TEST_UTIL.createTable(TableName.valueOf("TestStatusResource"), Bytes.toBytes("D"));
TEST_UTIL.createTable(TableName.valueOf("TestStatusResource2"), Bytes.toBytes("D"));
REST_TEST_UTIL.startServletContainer(conf);
Cluster cluster = new Cluster();
cluster.add("localhost", REST_TEST_UTIL.getServletPort());
client = new Client(cluster);
context = JAXBContext.newInstance(StorageClusterStatusModel.class);
TEST_UTIL.waitFor(6000, new Waiter.Predicate<IOException>() {
@Override
public boolean evaluate() throws IOException {
return TEST_UTIL.getMiniHBaseCluster().getClusterStatus().getAverageLoad() > 0;
}
});
}
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:TestStatusResource.java
示例20: waitForCounterBoolean
import org.apache.hadoop.hbase.Waiter; //导入依赖的package包/类
private boolean waitForCounterBoolean(final AtomicLong ctr, final long oldval, long newval,
long timems, boolean failIfTimeout) throws Exception {
long timeWaited = TEST_UTIL.waitFor(timems, 10, failIfTimeout,
new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return (ctr.get() != oldval);
}
});
if( timeWaited > 0) {
// when not timed out
assertEquals(newval, ctr.get());
}
return true;
}
开发者ID:daidong,项目名称:DominoHBase,代码行数:18,代码来源:TestSplitLogWorker.java
注:本文中的org.apache.hadoop.hbase.Waiter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论