public void addBootstrapTokens(Collection<Token> tokens, InetAddress endpoint) { addBootstrapTokens(tokens, endpoint, null); }
public void addBootstrapTokens(Collection<Token> tokens, InetAddress endpoint) { addBootstrapTokens(tokens, endpoint, null); }
public void addBootstrapTokens(Collection<Token> tokens, InetAddress endpoint) { addBootstrapTokens(tokens, endpoint, null); }
@Deprecated public void addBootstrapToken(Token token, InetAddress endpoint) { addBootstrapTokens(Collections.singleton(token), endpoint); }
@Deprecated public void addBootstrapToken(Token token, InetAddress endpoint) { addBootstrapTokens(Collections.singleton(token), endpoint); }
@Deprecated public void addBootstrapToken(Token token, InetAddress endpoint) { addBootstrapTokens(Collections.singleton(token), endpoint); }
@Deprecated public void addBootstrapToken(Token token, InetAddress endpoint) { addBootstrapTokens(Collections.singleton(token), endpoint); }
public void addReplaceTokens(Collection<Token> replacingTokens, InetAddress newNode, InetAddress oldNode) { assert replacingTokens != null && !replacingTokens.isEmpty(); assert newNode != null && oldNode != null; lock.writeLock().lock(); try { Collection<Token> oldNodeTokens = tokenToEndpointMap.inverse().get(oldNode); if (!replacingTokens.containsAll(oldNodeTokens) || !oldNodeTokens.containsAll(replacingTokens)) { throw new RuntimeException(String.format("Node %s is trying to replace node %s with tokens %s with a " + "different set of tokens %s.", newNode, oldNode, oldNodeTokens, replacingTokens)); } logger.debug("Replacing {} with {}", newNode, oldNode); replacementToOriginal.put(newNode, oldNode); addBootstrapTokens(replacingTokens, newNode, oldNode); } finally { lock.writeLock().unlock(); } }
public void addReplaceTokens(Collection<Token> replacingTokens, InetAddress newNode, InetAddress oldNode) { assert replacingTokens != null && !replacingTokens.isEmpty(); assert newNode != null && oldNode != null; lock.writeLock().lock(); try { Collection<Token> oldNodeTokens = tokenToEndpointMap.inverse().get(oldNode); if (!replacingTokens.containsAll(oldNodeTokens) || !oldNodeTokens.containsAll(replacingTokens)) { throw new RuntimeException(String.format("Node %s is trying to replace node %s with tokens %s with a " + "different set of tokens %s.", newNode, oldNode, oldNodeTokens, replacingTokens)); } logger.debug("Replacing {} with {}", newNode, oldNode); replacementToOriginal.put(newNode, oldNode); addBootstrapTokens(replacingTokens, newNode, oldNode); } finally { lock.writeLock().unlock(); } }
public void addReplaceTokens(Collection<Token> replacingTokens, InetAddress newNode, InetAddress oldNode) { assert replacingTokens != null && !replacingTokens.isEmpty(); assert newNode != null && oldNode != null; lock.writeLock().lock(); try { Collection<Token> oldNodeTokens = tokenToEndpointMap.inverse().get(oldNode); if (!replacingTokens.containsAll(oldNodeTokens) || !oldNodeTokens.containsAll(replacingTokens)) { throw new RuntimeException(String.format("Node %s is trying to replace node %s with tokens %s with a " + "different set of tokens %s.", newNode, oldNode, oldNodeTokens, replacingTokens)); } logger.debug("Replacing {} with {}", newNode, oldNode); replacementToOriginal.put(newNode, oldNode); addBootstrapTokens(replacingTokens, newNode, oldNode); } finally { lock.writeLock().unlock(); } }
/** * Handle node bootstrap * * @param endpoint bootstrapping node */ private void handleStateBootstrap(InetAddress endpoint) { Collection<Token> tokens; // explicitly check for TOKENS, because a bootstrapping node might be bootstrapping in legacy mode; that is, not using vnodes and no token specified tokens = getTokensFor(endpoint); if (logger.isDebugEnabled()) logger.debug("Node {} state bootstrapping, token {}", endpoint, tokens); // if this node is present in token metadata, either we have missed intermediate states // or the node had crashed. Print warning if needed, clear obsolete stuff and // continue. if (tokenMetadata.isMember(endpoint)) { // If isLeaving is false, we have missed both LEAVING and LEFT. However, if // isLeaving is true, we have only missed LEFT. Waiting time between completing // leave operation and rebootstrapping is relatively short, so the latter is quite // common (not enough time for gossip to spread). Therefore we report only the // former in the log. if (!tokenMetadata.isLeaving(endpoint)) logger.info("Node {} state jump to bootstrap", endpoint); tokenMetadata.removeEndpoint(endpoint); } tokenMetadata.addBootstrapTokens(tokens, endpoint); PendingRangeCalculatorService.instance.update(); tokenMetadata.updateHostId(Gossiper.instance.getHostId(endpoint), endpoint); }
/** * Handle node bootstrap * * @param endpoint bootstrapping node */ private void handleStateBootstrap(InetAddress endpoint) { Collection<Token> tokens; // explicitly check for TOKENS, because a bootstrapping node might be bootstrapping in legacy mode; that is, not using vnodes and no token specified tokens = getTokensFor(endpoint); if (logger.isDebugEnabled()) logger.debug("Node {} state bootstrapping, token {}", endpoint, tokens); // if this node is present in token metadata, either we have missed intermediate states // or the node had crashed. Print warning if needed, clear obsolete stuff and // continue. if (tokenMetadata.isMember(endpoint)) { // If isLeaving is false, we have missed both LEAVING and LEFT. However, if // isLeaving is true, we have only missed LEFT. Waiting time between completing // leave operation and rebootstrapping is relatively short, so the latter is quite // common (not enough time for gossip to spread). Therefore we report only the // former in the log. if (!tokenMetadata.isLeaving(endpoint)) logger.info("Node {} state jump to bootstrap", endpoint); tokenMetadata.removeEndpoint(endpoint); } tokenMetadata.addBootstrapTokens(tokens, endpoint); PendingRangeCalculatorService.instance.update(); tokenMetadata.updateHostId(Gossiper.instance.getHostId(endpoint), endpoint); }
/** * Handle node bootstrap * * @param endpoint bootstrapping node */ private void handleStateBootstrap(InetAddress endpoint) { Collection<Token> tokens; // explicitly check for TOKENS, because a bootstrapping node might be bootstrapping in legacy mode; that is, not using vnodes and no token specified tokens = getTokensFor(endpoint); if (logger.isDebugEnabled()) logger.debug("Node {} state bootstrapping, token {}", endpoint, tokens); // if this node is present in token metadata, either we have missed intermediate states // or the node had crashed. Print warning if needed, clear obsolete stuff and // continue. if (tokenMetadata.isMember(endpoint)) { // If isLeaving is false, we have missed both LEAVING and LEFT. However, if // isLeaving is true, we have only missed LEFT. Waiting time between completing // leave operation and rebootstrapping is relatively short, so the latter is quite // common (not enough time for gossip to spread). Therefore we report only the // former in the log. if (!tokenMetadata.isLeaving(endpoint)) logger.info("Node {} state jump to bootstrap", endpoint); tokenMetadata.removeEndpoint(endpoint); } tokenMetadata.addBootstrapTokens(tokens, endpoint); PendingRangeCalculatorService.instance.update(); tokenMetadata.updateHostId(Gossiper.instance.getHostId(endpoint), endpoint); }
tokenMetadata.addBootstrapTokens(tokens, endpoint); PendingRangeCalculatorService.instance.update();