Search in sources :

Example 1 with TabletServerState

use of org.apache.accumulo.server.master.state.TabletServerState 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)

Aggregations

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