Search in sources :

Example 1 with TabletServerState

use of org.apache.accumulo.server.manager.state.TabletServerState in project accumulo by apache.

the class ManagerResource method getNumBadTservers.

/**
 * Generates bad tserver lists as a JSON object
 *
 * @return bad tserver list
 */
public static BadTabletServers getNumBadTservers(Monitor monitor) {
    ManagerMonitorInfo mmi = monitor.getMmi();
    if (mmi == null) {
        return new BadTabletServers();
    }
    Map<String, Byte> badServers = mmi.getBadTServers();
    if (badServers == null || 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 : TabletServerState(org.apache.accumulo.server.manager.state.TabletServerState) ManagerMonitorInfo(org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo) BadTabletServerInformation(org.apache.accumulo.monitor.rest.tservers.BadTabletServerInformation) BadTabletServers(org.apache.accumulo.monitor.rest.tservers.BadTabletServers)

Aggregations

ManagerMonitorInfo (org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo)1 BadTabletServerInformation (org.apache.accumulo.monitor.rest.tservers.BadTabletServerInformation)1 BadTabletServers (org.apache.accumulo.monitor.rest.tservers.BadTabletServers)1 TabletServerState (org.apache.accumulo.server.manager.state.TabletServerState)1