Search in sources :

Example 1 with DeadServerList

use of org.apache.accumulo.server.master.state.DeadServerList in project accumulo by apache.

the class Master method update.

@Override
public void update(LiveTServerSet current, Set<TServerInstance> deleted, Set<TServerInstance> added) {
    DeadServerList obit = new DeadServerList(ZooUtil.getRoot(getInstance()) + Constants.ZDEADTSERVERS);
    if (added.size() > 0) {
        log.info("New servers: {}", added);
        for (TServerInstance up : added) obit.delete(up.hostPort());
    }
    for (TServerInstance dead : deleted) {
        String cause = "unexpected failure";
        if (serversToShutdown.contains(dead))
            // maybe an incorrect assumption
            cause = "clean shutdown";
        if (!getMasterGoalState().equals(MasterGoalState.CLEAN_STOP))
            obit.post(dead.hostPort(), cause);
    }
    Set<TServerInstance> unexpected = new HashSet<>(deleted);
    unexpected.removeAll(this.serversToShutdown);
    if (unexpected.size() > 0) {
        if (stillMaster() && !getMasterGoalState().equals(MasterGoalState.CLEAN_STOP)) {
            log.warn("Lost servers {}", unexpected);
        }
    }
    serversToShutdown.removeAll(deleted);
    badServers.keySet().removeAll(deleted);
    // clear out any bad server with the same host/port as a new server
    synchronized (badServers) {
        cleanListByHostAndPort(badServers.keySet(), deleted, added);
    }
    synchronized (serversToShutdown) {
        cleanListByHostAndPort(serversToShutdown, deleted, added);
    }
    synchronized (migrations) {
        Iterator<Entry<KeyExtent, TServerInstance>> iter = migrations.entrySet().iterator();
        while (iter.hasNext()) {
            Entry<KeyExtent, TServerInstance> entry = iter.next();
            if (deleted.contains(entry.getValue())) {
                log.info("Canceling migration of {} to {}", entry.getKey(), entry.getValue());
                iter.remove();
            }
        }
    }
    nextEvent.event("There are now %d tablet servers", current.size());
}
Also used : Entry(java.util.Map.Entry) DeadServerList(org.apache.accumulo.server.master.state.DeadServerList) KeyExtent(org.apache.accumulo.core.data.impl.KeyExtent) TServerInstance(org.apache.accumulo.server.master.state.TServerInstance) HashSet(java.util.HashSet)

Example 2 with DeadServerList

use of org.apache.accumulo.server.master.state.DeadServerList in project accumulo by apache.

the class Master method getMasterMonitorInfo.

public MasterMonitorInfo getMasterMonitorInfo() {
    final MasterMonitorInfo result = new MasterMonitorInfo();
    result.tServerInfo = new ArrayList<>();
    result.tableMap = new DefaultMap<>(new TableInfo());
    for (Entry<TServerInstance, TabletServerStatus> serverEntry : tserverStatus.entrySet()) {
        final TabletServerStatus status = serverEntry.getValue();
        result.tServerInfo.add(status);
        for (Entry<String, TableInfo> entry : status.tableMap.entrySet()) {
            TableInfoUtil.add(result.tableMap.get(entry.getKey()), entry.getValue());
        }
    }
    result.badTServers = new HashMap<>();
    synchronized (badServers) {
        for (TServerInstance bad : badServers.keySet()) {
            result.badTServers.put(bad.hostPort(), TabletServerState.UNRESPONSIVE.getId());
        }
    }
    result.state = getMasterState();
    result.goalState = getMasterGoalState();
    result.unassignedTablets = displayUnassigned();
    result.serversShuttingDown = new HashSet<>();
    synchronized (serversToShutdown) {
        for (TServerInstance server : serversToShutdown) result.serversShuttingDown.add(server.hostPort());
    }
    DeadServerList obit = new DeadServerList(ZooUtil.getRoot(getInstance()) + Constants.ZDEADTSERVERS);
    result.deadTabletServers = obit.getList();
    result.bulkImports = bulkImportStatus.getBulkLoadStatus();
    return result;
}
Also used : MasterMonitorInfo(org.apache.accumulo.core.master.thrift.MasterMonitorInfo) TableInfo(org.apache.accumulo.core.master.thrift.TableInfo) DeadServerList(org.apache.accumulo.server.master.state.DeadServerList) TServerInstance(org.apache.accumulo.server.master.state.TServerInstance) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus)

Example 3 with DeadServerList

use of org.apache.accumulo.server.master.state.DeadServerList in project accumulo by apache.

the class TabletServerResource method clearDeadServer.

/**
 * REST call to clear dead servers from list
 *
 * @param server
 *          Dead server to clear
 */
@POST
@Consumes(MediaType.TEXT_PLAIN)
public void clearDeadServer(@QueryParam("server") @NotNull @Pattern(regexp = SERVER_REGEX) String server) {
    DeadServerList obit = new DeadServerList(ZooUtil.getRoot(Monitor.getContext().getInstance()) + Constants.ZDEADTSERVERS);
    obit.delete(server);
}
Also used : DeadServerList(org.apache.accumulo.server.master.state.DeadServerList) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes)

Aggregations

DeadServerList (org.apache.accumulo.server.master.state.DeadServerList)3 TServerInstance (org.apache.accumulo.server.master.state.TServerInstance)2 HashSet (java.util.HashSet)1 Entry (java.util.Map.Entry)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 KeyExtent (org.apache.accumulo.core.data.impl.KeyExtent)1 MasterMonitorInfo (org.apache.accumulo.core.master.thrift.MasterMonitorInfo)1 TableInfo (org.apache.accumulo.core.master.thrift.TableInfo)1 TabletServerStatus (org.apache.accumulo.core.master.thrift.TabletServerStatus)1