NodeInfo implements Comparable<NodeInfo> { public NodeState getWantedState() { NodeState retiredState = new NodeState(node.getType(), State.RETIRED); if (configuredRetired && wantedState.above(retiredState)) { return retiredState; } return wantedState; } NodeInfo(ContentCluster cluster, Node n, boolean configuredRetired, String rpcAddress, Distribution distribution); void setRpcAddress(String rpcAddress); long getWentDownWithStartTime(); long getStartTimestamp(); void setStartTimestamp(long ts); void setTransitionTime(long time); long getTransitionTime(); void setInitProgressTime(long time); long getInitProgressTime(); long getUpStableStateTime(); long getDownStableStateTime(); int getConnectionAttemptCount(); boolean recentlyObservedUnstableDuringInit(); void setRecentlyObservedUnstableDuringInit(boolean unstable); void setPrematureCrashCount(int count); int getPrematureCrashCount(); boolean isPendingGetNodeStateRequest(GetNodeStateRequest r); void setConfiguredRetired(boolean retired); void setNextGetStateAttemptTime(long timeInMillis); @Override int compareTo(NodeInfo info); @Override int hashCode(); @Override String toString(); void setGroup(Distribution distribution); Group getGroup(); int getLatestVersion(); String getSlobrokAddress(); void markRpcAddressOutdated(Timer timer); void markRpcAddressLive(); Node getNode(); boolean isDistributor(); boolean isStorage(); int getNodeIndex(); ContentCluster getCluster(); boolean isRpcAddressOutdated(); Long getRpcAddressOutdatedTimestamp(); void abortCurrentNodeStateRequests(); void setCurrentNodeStateRequest(GetNodeStateRequest r, long timeInMS); String getRpcAddress(); NodeState getReportedState(); NodeState getWantedState(); NodeState getUserWantedState(); long getTimeOfFirstFailingConnectionAttempt(); Long getLatestNodeStateRequestTime(); void setTimeOfFirstFailingConnectionAttempt(long timeInMS); void removePendingGetNodeStateRequest(GetNodeStateRequest request); void setReportedState(NodeState state, long time); void setWantedState(NodeState state); long getTimeForNextStateRequestAttempt(); boolean notifyNoSuchMethodError(String methodName, Timer timer); Target getConnection(); Target setConnection(Target t); int getVersion(); ClusterState getNewestSystemStateSent(); int getNewestSystemStateVersionSent(); int getClusterStateVersionBundleAcknowledged(); void setClusterStateVersionBundleSent(ClusterStateBundle stateBundle); void setClusterStateBundleVersionAcknowledged(Integer version, boolean success); void setClusterStateVersionActivationSent(int version); int getClusterStateVersionActivationSent(); int getClusterStateVersionActivationAcked(); void setSystemStateVersionActivationAcked(Integer version, boolean success); void setHostInfo(HostInfo hostInfo); HostInfo getHostInfo(); String getVtag(); static Logger log; public Target lastRequestInfoConnection; }
@Test public void down_wanted_state_overrides_config_retired_state() { ClusterFixture fixture = ClusterFixture.forFlatCluster(3) .markNodeAsConfigRetired(1) .proposeStorageNodeWantedState(1, State.DOWN); NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1)); assertEquals(State.DOWN, nodeInfo.getWantedState().getState()); }
@Test public void maintenance_wanted_state_overrides_config_retired_state() { ClusterFixture fixture = ClusterFixture.forFlatCluster(3) .markNodeAsConfigRetired(1) .proposeStorageNodeWantedState(1, State.MAINTENANCE); NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1)); assertEquals(State.MAINTENANCE, nodeInfo.getWantedState().getState()); }
@Test public void retired_state_overrides_default_up_wanted_state() { final ClusterFixture fixture = ClusterFixture.forFlatCluster(3).markNodeAsConfigRetired(1); NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1)); assertEquals(State.RETIRED, nodeInfo.getWantedState().getState()); }