Search in sources :

Example 11 with MasterMonitorInfo

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");
}
Also used : Connector(org.apache.accumulo.core.client.Connector) MasterMonitorInfo(org.apache.accumulo.core.master.thrift.MasterMonitorInfo) ThriftNotActiveServiceException(org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException) BatchWriterOpts(org.apache.accumulo.core.cli.BatchWriterOpts) ClientContext(org.apache.accumulo.core.client.impl.ClientContext) TestIngest(org.apache.accumulo.test.TestIngest) MasterClientService(org.apache.accumulo.core.master.thrift.MasterClientService) BatchWriterOpts(org.apache.accumulo.core.cli.BatchWriterOpts) TableInfo(org.apache.accumulo.core.master.thrift.TableInfo) ClientConfiguration(org.apache.accumulo.core.client.ClientConfiguration) Credentials(org.apache.accumulo.core.client.impl.Credentials) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus) Test(org.junit.Test)

Example 12 with MasterMonitorInfo

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;
}
Also used : MasterMonitorInfo(org.apache.accumulo.core.master.thrift.MasterMonitorInfo) DeadServerInformation(org.apache.accumulo.monitor.rest.tservers.DeadServerInformation) DeadServerList(org.apache.accumulo.monitor.rest.tservers.DeadServerList) DeadServer(org.apache.accumulo.core.master.thrift.DeadServer)

Example 13 with MasterMonitorInfo

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;
}
Also used : MasterMonitorInfo(org.apache.accumulo.core.master.thrift.MasterMonitorInfo) DeadLoggerList(org.apache.accumulo.monitor.rest.logs.DeadLoggerList) DeadLoggerInformation(org.apache.accumulo.monitor.rest.logs.DeadLoggerInformation) DeadServer(org.apache.accumulo.core.master.thrift.DeadServer)

Example 14 with MasterMonitorInfo

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;
}
Also used : MasterMonitorInfo(org.apache.accumulo.core.master.thrift.MasterMonitorInfo) TabletServerState(org.apache.accumulo.server.master.state.TabletServerState) BadTabletServerInformation(org.apache.accumulo.monitor.rest.tservers.BadTabletServerInformation) BadTabletServers(org.apache.accumulo.monitor.rest.tservers.BadTabletServers)

Example 15 with MasterMonitorInfo

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;
}
Also used : MasterMonitorInfo(org.apache.accumulo.core.master.thrift.MasterMonitorInfo) WebApplicationException(javax.ws.rs.WebApplicationException) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus) GET(javax.ws.rs.GET)

Aggregations

MasterMonitorInfo (org.apache.accumulo.core.master.thrift.MasterMonitorInfo)19 TabletServerStatus (org.apache.accumulo.core.master.thrift.TabletServerStatus)10 Test (org.junit.Test)8 ThriftNotActiveServiceException (org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException)7 TableInfo (org.apache.accumulo.core.master.thrift.TableInfo)7 Connector (org.apache.accumulo.core.client.Connector)6 MasterClientService (org.apache.accumulo.core.master.thrift.MasterClientService)6 ArrayList (java.util.ArrayList)5 ClientContext (org.apache.accumulo.core.client.impl.ClientContext)5 Credentials (org.apache.accumulo.core.client.impl.Credentials)5 DeadServer (org.apache.accumulo.core.master.thrift.DeadServer)4 TreeSet (java.util.TreeSet)3 GET (javax.ws.rs.GET)3 WebApplicationException (javax.ws.rs.WebApplicationException)3 BatchWriterOpts (org.apache.accumulo.core.cli.BatchWriterOpts)3 Instance (org.apache.accumulo.core.client.Instance)3 PasswordToken (org.apache.accumulo.core.client.security.tokens.PasswordToken)3 Text (org.apache.hadoop.io.Text)3 Callable (java.util.concurrent.Callable)2 ExecutorService (java.util.concurrent.ExecutorService)2