public UUID getHostId(InetAddress endpoint) { return getHostId(endpoint, endpointStateMap); }
public UUID getHostId(InetAddress endpoint) { return getHostId(endpoint, endpointStateMap); }
public UUID getHostId(InetAddress endpoint) { return getHostId(endpoint, endpointStateMap); }
private void handleStateBootreplacing(InetAddress newNode, String[] pieces) { InetAddress oldNode; try { oldNode = InetAddress.getByName(pieces[1]); } catch (Exception e) { logger.error("Node {} tried to replace malformed endpoint {}.", newNode, pieces[1], e); return; } if (FailureDetector.instance.isAlive(oldNode)) { throw new RuntimeException(String.format("Node %s is trying to replace alive node %s.", newNode, oldNode)); } Optional<InetAddress> replacingNode = tokenMetadata.getReplacingNode(newNode); if (replacingNode.isPresent() && !replacingNode.get().equals(oldNode)) { throw new RuntimeException(String.format("Node %s is already replacing %s but is trying to replace %s.", newNode, replacingNode.get(), oldNode)); } Collection<Token> tokens = getTokensFor(newNode); if (logger.isDebugEnabled()) logger.debug("Node {} is replacing {}, tokens {}", newNode, oldNode, tokens); tokenMetadata.addReplaceTokens(tokens, newNode, oldNode); PendingRangeCalculatorService.instance.update(); tokenMetadata.updateHostId(Gossiper.instance.getHostId(newNode), newNode); }
private void handleStateBootreplacing(InetAddress newNode, String[] pieces) { InetAddress oldNode; try { oldNode = InetAddress.getByName(pieces[1]); } catch (Exception e) { logger.error("Node {} tried to replace malformed endpoint {}.", newNode, pieces[1], e); return; } if (FailureDetector.instance.isAlive(oldNode)) { throw new RuntimeException(String.format("Node %s is trying to replace alive node %s.", newNode, oldNode)); } Optional<InetAddress> replacingNode = tokenMetadata.getReplacingNode(newNode); if (replacingNode.isPresent() && !replacingNode.get().equals(oldNode)) { throw new RuntimeException(String.format("Node %s is already replacing %s but is trying to replace %s.", newNode, replacingNode.get(), oldNode)); } Collection<Token> tokens = getTokensFor(newNode); if (logger.isDebugEnabled()) logger.debug("Node {} is replacing {}, tokens {}", newNode, oldNode, tokens); tokenMetadata.addReplaceTokens(tokens, newNode, oldNode); PendingRangeCalculatorService.instance.update(); tokenMetadata.updateHostId(Gossiper.instance.getHostId(newNode), newNode); }
private void handleStateBootreplacing(InetAddress newNode, String[] pieces) { InetAddress oldNode; try { oldNode = InetAddress.getByName(pieces[1]); } catch (Exception e) { logger.error("Node {} tried to replace malformed endpoint {}.", newNode, pieces[1], e); return; } if (FailureDetector.instance.isAlive(oldNode)) { throw new RuntimeException(String.format("Node %s is trying to replace alive node %s.", newNode, oldNode)); } Optional<InetAddress> replacingNode = tokenMetadata.getReplacingNode(newNode); if (replacingNode.isPresent() && !replacingNode.get().equals(oldNode)) { throw new RuntimeException(String.format("Node %s is already replacing %s but is trying to replace %s.", newNode, replacingNode.get(), oldNode)); } Collection<Token> tokens = getTokensFor(newNode); if (logger.isDebugEnabled()) logger.debug("Node {} is replacing {}, tokens {}", newNode, oldNode, tokens); tokenMetadata.addReplaceTokens(tokens, newNode, oldNode); PendingRangeCalculatorService.instance.update(); tokenMetadata.updateHostId(Gossiper.instance.getHostId(newNode), newNode); }
localHostId = Gossiper.instance.getHostId(replaceAddress, epStates);
localHostId = Gossiper.instance.getHostId(replaceAddress, epStates);
localHostId = Gossiper.instance.getHostId(replaceAddress, epStates);
/** * 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); }
UUID hostId = Gossiper.instance.getHostId(endpoint); InetAddress existing = tokenMetadata.getEndpointForHostId(hostId); if (replacing && isReplacingSameAddress() && Gossiper.instance.getEndpointStateForEndpoint(DatabaseDescriptor.getReplaceAddress()) != null && (hostId.equals(Gossiper.instance.getHostId(DatabaseDescriptor.getReplaceAddress())))) logger.warn("Not updating token metadata for {} because I am replacing it", endpoint); else
UUID hostId = Gossiper.instance.getHostId(endpoint); InetAddress existing = tokenMetadata.getEndpointForHostId(hostId); if (replacing && isReplacingSameAddress() && Gossiper.instance.getEndpointStateForEndpoint(DatabaseDescriptor.getReplaceAddress()) != null && (hostId.equals(Gossiper.instance.getHostId(DatabaseDescriptor.getReplaceAddress())))) logger.warn("Not updating token metadata for {} because I am replacing it", endpoint); else
tokenMetadata.updateHostId(Gossiper.instance.getHostId(endpoint), endpoint);
UUID hostId = Gossiper.instance.getHostId(endpoint); InetAddress existing = tokenMetadata.getEndpointForHostId(hostId); if (DatabaseDescriptor.isReplacing() && Gossiper.instance.getEndpointStateForEndpoint(DatabaseDescriptor.getReplaceAddress()) != null && (hostId.equals(Gossiper.instance.getHostId(DatabaseDescriptor.getReplaceAddress())))) logger.warn("Not updating token metadata for {} because I am replacing it", endpoint); else
this.remoteShardRoutingStateMap.put(Gossiper.instance.getHostId(endpoint), shardsStateMap); updateRoutingTable("X1-" + endpoint, false);
public synchronized Collection<Token> prepareReplacementInfo() throws ConfigurationException { logger.info("Gathering node replacement information for {}", DatabaseDescriptor.getReplaceAddress()); if (!MessagingService.instance().isListening()) MessagingService.instance().listen(FBUtilities.getLocalAddress()); // make magic happen Gossiper.instance.doShadowRound(); UUID hostId = null; // now that we've gossiped at least once, we should be able to find the node we're replacing if (Gossiper.instance.getEndpointStateForEndpoint(DatabaseDescriptor.getReplaceAddress())== null) throw new RuntimeException("Cannot replace_address " + DatabaseDescriptor.getReplaceAddress() + " because it doesn't exist in gossip"); hostId = Gossiper.instance.getHostId(DatabaseDescriptor.getReplaceAddress()); try { VersionedValue tokensVersionedValue = Gossiper.instance.getEndpointStateForEndpoint(DatabaseDescriptor.getReplaceAddress()).getApplicationState(ApplicationState.TOKENS); if (tokensVersionedValue == null) throw new RuntimeException("Could not find tokens for " + DatabaseDescriptor.getReplaceAddress() + " to replace"); Collection<Token> tokens = TokenSerializer.deserialize(getPartitioner(), new DataInputStream(new ByteArrayInputStream(tokensVersionedValue.toBytes()))); SystemKeyspace.setLocalHostId(hostId); // use the replacee's host Id as our own so we receive hints, etc Gossiper.instance.resetEndpointStateMap(); // clean up since we have what we need return tokens; } catch (IOException e) { throw new RuntimeException(e); } }
private void doDeliverHintsToEndpoint(InetAddress endpoint) UUID hostId = Gossiper.instance.getHostId(endpoint); logger.info("Started hinted handoff for host: {} with IP: {}", hostId, endpoint); final ByteBuffer hostIdBytes = ByteBuffer.wrap(UUIDGen.decompose(hostId));
try { shardsStateMap = jsonMapper.readValue(x1.value, indexShardStateTypeReference); this.remoteShardRoutingStateMap.put(Gossiper.instance.getHostId(endpoint), shardsStateMap); } catch (IOException e) { logger.error("Failed to parse X1 for node [{}]", dn.getId());