synchronized void setMasterState(MasterState newState) { if (state.equals(newState)) return; if (!transitionOK[state.ordinal()][newState.ordinal()]) { log.error("Programmer error: master should not transition from {} to {}", state, newState); } MasterState oldState = state; state = newState; nextEvent.event("State changed from %s to %s", oldState, newState); if (newState == MasterState.STOP) { // Give the server a little time before shutdown so the client // thread requesting the stop can return SimpleTimer.getInstance(getConfiguration()).schedule(new Runnable() { @Override public void run() { // This frees the main thread and will cause the master to exit clientService.stop(); Master.this.nextEvent.event("stopped event loop"); } }, 100L, 1000L); } if (oldState != newState && (newState == MasterState.HAVE_LOCK)) { upgradeZookeeper(); } if (oldState != newState && (newState == MasterState.NORMAL)) { upgradeMetadata(); } }
/** * Returns the current state of the master * * @return master state */ public static String getState() { MasterMonitorInfo mmi = getMmi(); if (mmi == null) { return NO_MASTERS; } return mmi.state.toString(); }
case 6: // STATE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.state = org.apache.accumulo.core.master.thrift.MasterState.findByValue(iprot.readI32()); struct.setStateIsSet(true); } else {
public void assignedTablet(KeyExtent extent) { if (extent.isMeta()) { if (getMasterState().equals(MasterState.UNLOAD_ROOT_TABLET)) { setMasterState(MasterState.UNLOAD_METADATA_TABLETS); } } if (extent.isRootTablet()) { // probably too late, but try anyhow if (getMasterState().equals(MasterState.STOP)) { setMasterState(MasterState.UNLOAD_ROOT_TABLET); } } }
sb.append("<span class='warning'>Master State: " + Monitor.getMmi().state.name() + " Goal: " + Monitor.getMmi().goalState.name() + "</span>\n");
oprot.writeI32(struct.state.getValue()); oprot.writeFieldEnd();
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); current = parseServers(options.get(SERVERS_OPTION)); onlineTables = parseTableIDs(options.get(TABLES_OPTION)); merges = parseMerges(options.get(MERGES_OPTION)); debug = options.containsKey(DEBUG_OPTION); migrations = parseMigrations(options.get(MIGRATIONS_OPTION)); try { masterState = MasterState.valueOf(options.get(MASTER_STATE_OPTION)); } catch (Exception ex) { if (options.get(MASTER_STATE_OPTION) != null) { log.error("Unable to decode masterState {}", options.get(MASTER_STATE_OPTION)); } } Set<TServerInstance> shuttingDown = parseServers(options.get(SHUTTING_DOWN_OPTION)); if (current != null && shuttingDown != null) { current.removeAll(shuttingDown); } }
if (!(this_present_state && that_present_state)) return false; if (!this.state.equals(that.state)) return false;
MasterClient.close(client); out(0, "State: " + stats.state.name()); out(0, "Goal State: " + stats.goalState.name()); if (stats.serversShuttingDown != null && stats.serversShuttingDown.size() > 0) {
@Override public int hashCode() { int hashCode = 1; hashCode = hashCode * 8191 + ((isSetTableMap()) ? 131071 : 524287); if (isSetTableMap()) hashCode = hashCode * 8191 + tableMap.hashCode(); hashCode = hashCode * 8191 + ((isSetTServerInfo()) ? 131071 : 524287); if (isSetTServerInfo()) hashCode = hashCode * 8191 + tServerInfo.hashCode(); hashCode = hashCode * 8191 + ((isSetBadTServers()) ? 131071 : 524287); if (isSetBadTServers()) hashCode = hashCode * 8191 + badTServers.hashCode(); hashCode = hashCode * 8191 + ((isSetState()) ? 131071 : 524287); if (isSetState()) hashCode = hashCode * 8191 + state.getValue(); hashCode = hashCode * 8191 + ((isSetGoalState()) ? 131071 : 524287); if (isSetGoalState()) hashCode = hashCode * 8191 + goalState.getValue(); hashCode = hashCode * 8191 + unassignedTablets; hashCode = hashCode * 8191 + ((isSetServersShuttingDown()) ? 131071 : 524287); if (isSetServersShuttingDown()) hashCode = hashCode * 8191 + serversShuttingDown.hashCode(); hashCode = hashCode * 8191 + ((isSetDeadTabletServers()) ? 131071 : 524287); if (isSetDeadTabletServers()) hashCode = hashCode * 8191 + deadTabletServers.hashCode(); hashCode = hashCode * 8191 + ((isSetBulkImports()) ? 131071 : 524287); if (isSetBulkImports()) hashCode = hashCode * 8191 + bulkImports.hashCode(); return hashCode; }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); current = parseServers(options.get(SERVERS_OPTION)); onlineTables = parseTables(options.get(TABLES_OPTION)); merges = parseMerges(options.get(MERGES_OPTION)); debug = options.containsKey(DEBUG_OPTION); migrations = parseMigrations(options.get(MIGRATIONS_OPTION)); try { masterState = MasterState.valueOf(options.get(MASTER_STATE_OPTION)); } catch (Exception ex) { if (options.get(MASTER_STATE_OPTION) != null) { log.error("Unable to decode masterState " + options.get(MASTER_STATE_OPTION)); } } Set<TServerInstance> shuttingDown = parseServers(options.get(SHUTTING_DOWN_OPTION)); if (current != null && shuttingDown != null) { current.removeAll(shuttingDown); } }
synchronized private void setMasterState(MasterState newState) { if (state.equals(newState)) return; if (!transitionOK[state.ordinal()][newState.ordinal()]) { log.error("Programmer error: master should not transition from " + state + " to " + newState); } MasterState oldState = state; state = newState; nextEvent.event("State changed from %s to %s", oldState, newState); if (newState == MasterState.STOP) { // Give the server a little time before shutdown so the client // thread requesting the stop can return SimpleTimer.getInstance().schedule(new Runnable() { @Override public void run() { // This frees the main thread and will cause the master to exit clientService.stop(); Master.this.nextEvent.event("stopped event loop"); } }, 100l, 1000l); } if (oldState != newState && (newState == MasterState.HAVE_LOCK)) { upgradeZookeeper(); } if (oldState != newState && (newState == MasterState.NORMAL)) { upgradeMetadata(); } }
public void assignedTablet(KeyExtent extent) { if (extent.isMeta()) { if (getMasterState().equals(MasterState.UNLOAD_ROOT_TABLET)) { setMasterState(MasterState.UNLOAD_METADATA_TABLETS); } } if (extent.isRootTablet()) { // probably too late, but try anyhow if (getMasterState().equals(MasterState.STOP)) { setMasterState(MasterState.UNLOAD_ROOT_TABLET); } } }
sb.append("<span class='warning'>Master State: " + Monitor.getMmi().state.name() + " Goal: " + Monitor.getMmi().goalState.name() + "</span>\n");
public static void setMasterState(IteratorSetting cfg, MasterState state) { cfg.addOption(MASTER_STATE_OPTION, state.toString()); }
oprot.writeI32(struct.state.getValue());
struct.state = org.apache.accumulo.core.master.thrift.MasterState.findByValue(iprot.readI32()); struct.setStateIsSet(true);
synchronized void setMasterState(MasterState newState) { if (state.equals(newState)) return; if (!transitionOK[state.ordinal()][newState.ordinal()]) { log.error("Programmer error: master should not transition from " + state + " to " + newState); } MasterState oldState = state; state = newState; nextEvent.event("State changed from %s to %s", oldState, newState); if (newState == MasterState.STOP) { // Give the server a little time before shutdown so the client // thread requesting the stop can return SimpleTimer.getInstance(getConfiguration()).schedule(new Runnable() { @Override public void run() { // This frees the main thread and will cause the master to exit clientService.stop(); Master.this.nextEvent.event("stopped event loop"); } }, 100l, 1000l); } if (oldState != newState && (newState == MasterState.HAVE_LOCK)) { upgradeZookeeper(); } if (oldState != newState && (newState == MasterState.NORMAL)) { upgradeMetadata(); } }
if (!(this_present_state && that_present_state)) return false; if (!this.state.equals(that.state)) return false;
public static void setMasterState(IteratorSetting cfg, MasterState state) { cfg.addOption(MASTER_STATE_OPTION, state.toString()); }