use of org.apache.accumulo.core.master.thrift.MasterMonitorInfo in project accumulo by apache.
the class DynamicThreadPoolsIT method test.
@Test
public void test() throws Exception {
final String[] tables = getUniqueNames(15);
String firstTable = tables[0];
Connector c = getConnector();
c.instanceOperations().setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "5");
TestIngest.Opts opts = new TestIngest.Opts();
opts.rows = 500 * 1000;
opts.createTable = true;
opts.setTableName(firstTable);
ClientConfiguration clientConf = cluster.getClientConfig();
if (clientConf.hasSasl()) {
opts.updateKerberosCredentials(clientConf);
} else {
opts.setPrincipal(getAdminPrincipal());
}
TestIngest.ingest(c, opts, new BatchWriterOpts());
c.tableOperations().flush(firstTable, null, null, true);
for (int i = 1; i < tables.length; i++) c.tableOperations().clone(firstTable, tables[i], true, null, null);
// time between checks of the thread pool sizes
sleepUninterruptibly(11, TimeUnit.SECONDS);
Credentials creds = new Credentials(getAdminPrincipal(), getAdminToken());
for (int i = 1; i < tables.length; i++) c.tableOperations().compact(tables[i], null, null, true, false);
for (int i = 0; i < 30; i++) {
int count = 0;
MasterClientService.Iface client = null;
MasterMonitorInfo stats = null;
while (true) {
try {
client = MasterClient.getConnectionWithRetry(new ClientContext(c.getInstance(), creds, clientConf));
stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
break;
} catch (ThriftNotActiveServiceException e) {
// Let it loop, fetching a new location
sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
if (client != null)
MasterClient.close(client);
}
}
for (TabletServerStatus server : stats.tServerInfo) {
for (TableInfo table : server.tableMap.values()) {
count += table.majors.running;
}
}
System.out.println("count " + count);
if (count > 3)
return;
sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
}
fail("Could not observe higher number of threads after changing the config");
}
use of org.apache.accumulo.core.master.thrift.MasterMonitorInfo in project accumulo by apache.
the class MasterResource method getDeadTservers.
/**
* Generates a dead server list as a JSON object
*
* @return dead server list
*/
public static DeadServerList getDeadTservers() {
MasterMonitorInfo mmi = getMmi();
if (null == mmi) {
return new DeadServerList();
}
DeadServerList deadServers = new DeadServerList();
// Add new dead servers to the list
for (DeadServer dead : mmi.deadTabletServers) {
deadServers.addDeadServer(new DeadServerInformation(dead.server, dead.lastStatus, dead.status));
}
return deadServers;
}
use of org.apache.accumulo.core.master.thrift.MasterMonitorInfo in project accumulo by apache.
the class MasterResource method getDeadLoggers.
/**
* Generates a dead logger list as a JSON object
*
* @return dead logger list
*/
public static DeadLoggerList getDeadLoggers() {
MasterMonitorInfo mmi = getMmi();
if (null == mmi) {
return new DeadLoggerList();
}
DeadLoggerList deadLoggers = new DeadLoggerList();
// Add new dead loggers to the list
for (DeadServer dead : mmi.deadTabletServers) {
deadLoggers.addDeadLogger(new DeadLoggerInformation(dead.server, dead.lastStatus, dead.status));
}
return deadLoggers;
}
use of org.apache.accumulo.core.master.thrift.MasterMonitorInfo in project accumulo by apache.
the class MasterResource method getNumBadTservers.
/**
* Generates bad tserver lists as a JSON object
*
* @return bad tserver list
*/
public static BadTabletServers getNumBadTservers() {
MasterMonitorInfo mmi = getMmi();
if (null == mmi) {
return new BadTabletServers();
}
Map<String, Byte> badServers = mmi.getBadTServers();
if (null == badServers || badServers.isEmpty()) {
return new BadTabletServers();
}
BadTabletServers readableBadServers = new BadTabletServers();
// Add new bad tservers to the list
for (Entry<String, Byte> badServer : badServers.entrySet()) {
try {
TabletServerState state = TabletServerState.getStateById(badServer.getValue());
readableBadServers.addBadServer(new BadTabletServerInformation(badServer.getKey(), state.name()));
} catch (IndexOutOfBoundsException e) {
readableBadServers.addBadServer(new BadTabletServerInformation(badServer.getKey(), "Unknown state"));
}
}
return readableBadServers;
}
use of org.apache.accumulo.core.master.thrift.MasterMonitorInfo in project accumulo by apache.
the class TabletServerResource method getTserverSummary.
/**
* Generates tserver summary
*
* @return tserver summary
*/
@GET
public TabletServers getTserverSummary() {
MasterMonitorInfo mmi = Monitor.getMmi();
if (null == mmi) {
throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
}
TabletServers tserverInfo = new TabletServers(mmi.tServerInfo.size());
for (TabletServerStatus status : mmi.tServerInfo) {
tserverInfo.addTablet(new TabletServer(status));
}
tserverInfo.addBadTabletServer(MasterResource.getTables());
return tserverInfo;
}
Aggregations