use of org.apache.accumulo.core.manager.thrift.ManagerClientService.Client in project accumulo by apache.
the class DetectDeadTabletServersIT method getStats.
private ManagerMonitorInfo getStats(AccumuloClient c) throws Exception {
ClientContext context = (ClientContext) c;
Client client = null;
while (true) {
try {
client = ManagerClient.getConnectionWithRetry(context);
log.info("Fetching manager stats");
return client.getManagerStats(TraceUtil.traceInfo(), context.rpcCreds());
} catch (ThriftNotActiveServiceException e) {
// Let it loop, fetching a new location
sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
if (client != null) {
ManagerClient.close(client, context);
}
}
}
}
use of org.apache.accumulo.core.manager.thrift.ManagerClientService.Client in project accumulo by apache.
the class MetadataMaxFilesIT method test.
@Test
public void test() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProperties()).build()) {
SortedSet<Text> splits = new TreeSet<>();
for (int i = 0; i < 1000; i++) {
splits.add(new Text(String.format("%03d", i)));
}
c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10000");
// propagation time
sleepUninterruptibly(5, TimeUnit.SECONDS);
for (int i = 0; i < 2; i++) {
String tableName = "table" + i;
log.info("Creating {} with splits", tableName);
NewTableConfiguration ntc = new NewTableConfiguration().withSplits(splits);
c.tableOperations().create(tableName, ntc);
log.info("flushing");
c.tableOperations().flush(MetadataTable.NAME, null, null, true);
c.tableOperations().flush(RootTable.NAME, null, null, true);
}
while (true) {
ManagerMonitorInfo stats;
Client client = null;
try {
ClientContext context = (ClientContext) c;
client = ManagerClient.getConnectionWithRetry(context);
log.info("Fetching stats");
stats = client.getManagerStats(TraceUtil.traceInfo(), context.rpcCreds());
} catch (ThriftNotActiveServiceException e) {
// Let it loop, fetching a new location
sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
continue;
} finally {
if (client != null)
ManagerClient.close(client, (ClientContext) c);
}
int tablets = 0;
for (TabletServerStatus tserver : stats.tServerInfo) {
for (Entry<String, TableInfo> entry : tserver.tableMap.entrySet()) {
if (entry.getKey().startsWith("!") || entry.getKey().startsWith("+"))
continue;
tablets += entry.getValue().onlineTablets;
}
}
log.info("Online tablets " + tablets);
if (tablets == 2002)
break;
sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
}
Aggregations