Search in sources :

Example 1 with ServerCrashProcedure

use of org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure in project hbase by apache.

the class ServerManager method expireServer.

/*
   * Expire the passed server.  Add it to list of dead servers and queue a
   * shutdown processing.
   */
public synchronized void expireServer(final ServerName serverName) {
    if (serverName.equals(master.getServerName())) {
        if (!(master.isAborted() || master.isStopped())) {
            master.stop("We lost our znode?");
        }
        return;
    }
    if (!master.isServerCrashProcessingEnabled()) {
        LOG.info("Master doesn't enable ServerShutdownHandler during initialization, " + "delay expiring server " + serverName);
        this.queuedDeadServers.add(serverName);
        return;
    }
    if (this.deadservers.isDeadServer(serverName)) {
        // TODO: Can this happen?  It shouldn't be online in this case?
        LOG.warn("Expiration of " + serverName + " but server shutdown already in progress");
        return;
    }
    moveFromOnlineToDeadServers(serverName);
    // process as a dead server
    if (this.clusterShutdown) {
        LOG.info("Cluster shutdown set; " + serverName + " expired; onlineServers=" + this.onlineServers.size());
        if (this.onlineServers.isEmpty()) {
            master.stop("Cluster shutdown set; onlineServer=0");
        }
        return;
    }
    boolean carryingMeta = master.getAssignmentManager().isCarryingMeta(serverName);
    ProcedureExecutor<MasterProcedureEnv> procExec = this.master.getMasterProcedureExecutor();
    procExec.submitProcedure(new ServerCrashProcedure(procExec.getEnvironment(), serverName, true, carryingMeta));
    LOG.debug("Added=" + serverName + " to dead servers, submitted shutdown handler to be executed meta=" + carryingMeta);
    // Tell our listeners that a server was removed
    if (!this.listeners.isEmpty()) {
        for (ServerListener listener : this.listeners) {
            listener.serverRemoved(serverName);
        }
    }
}
Also used : ServerCrashProcedure(org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure) MasterProcedureEnv(org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv)

Example 2 with ServerCrashProcedure

use of org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure in project hbase by apache.

the class TestDeadServer method testCrashProcedureReplay.

@Test(timeout = 15000)
public void testCrashProcedureReplay() {
    HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
    final ProcedureExecutor<MasterProcedureEnv> pExecutor = master.getMasterProcedureExecutor();
    ServerCrashProcedure proc = new ServerCrashProcedure(pExecutor.getEnvironment(), hostname123, false, false);
    ProcedureTestingUtility.submitAndWait(pExecutor, proc);
    assertFalse(master.getServerManager().getDeadServers().areDeadServersInProgress());
}
Also used : ServerCrashProcedure(org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure) MasterProcedureEnv(org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv) Test(org.junit.Test)

Example 3 with ServerCrashProcedure

use of org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure in project hbase by apache.

the class ServerManager method processDeadServer.

public synchronized void processDeadServer(final ServerName serverName, boolean shouldSplitWal) {
    // the corresponding server is down. So we queue them up here instead.
    if (!master.getAssignmentManager().isFailoverCleanupDone()) {
        requeuedDeadServers.put(serverName, shouldSplitWal);
        return;
    }
    this.deadservers.add(serverName);
    ProcedureExecutor<MasterProcedureEnv> procExec = this.master.getMasterProcedureExecutor();
    procExec.submitProcedure(new ServerCrashProcedure(procExec.getEnvironment(), serverName, shouldSplitWal, false));
}
Also used : ServerCrashProcedure(org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure) MasterProcedureEnv(org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv)

Aggregations

MasterProcedureEnv (org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv)3 ServerCrashProcedure (org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure)3 Test (org.junit.Test)1