public static boolean isReplacingSameAddress() { InetAddress replaceAddress = DatabaseDescriptor.getReplaceAddress(); return replaceAddress != null && replaceAddress.equals(FBUtilities.getBroadcastAddress()); }
private boolean isReplacing() { if (System.getProperty("cassandra.replace_address_first_boot", null) != null && SystemKeyspace.bootstrapComplete()) { logger.info("Replace address on first boot requested; this node is already bootstrapped"); return false; } return DatabaseDescriptor.getReplaceAddress() != null; }
public static boolean isReplacingSameAddress() { InetAddress replaceAddress = DatabaseDescriptor.getReplaceAddress(); return replaceAddress != null && replaceAddress.equals(FBUtilities.getBroadcastAddress()); }
private boolean isReplacing() { if (System.getProperty("cassandra.replace_address_first_boot", null) != null && SystemKeyspace.bootstrapComplete()) { logger.info("Replace address on first boot requested; this node is already bootstrapped"); return false; } return DatabaseDescriptor.getReplaceAddress() != null; }
private boolean isReplacing() { if (System.getProperty("cassandra.replace_address_first_boot", null) != null && SystemKeyspace.bootstrapComplete()) { logger.info("Replace address on first boot requested; this node is already bootstrapped"); return false; } return DatabaseDescriptor.getReplaceAddress() != null; }
public static boolean isReplacingSameAddress() { InetAddress replaceAddress = DatabaseDescriptor.getReplaceAddress(); return replaceAddress != null && replaceAddress.equals(FBUtilities.getBroadcastAddress()); }
public static boolean isReplacing() { if (System.getProperty("cassandra.replace_address_first_boot", null) != null && SystemKeyspace.bootstrapComplete()) { logger.info("Replace address on first boot requested; this node is already bootstrapped"); return false; } return getReplaceAddress() != null; }
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); } }
"-Dcassandra.allow_unsafe_replace=true"); InetAddress replaceAddress = DatabaseDescriptor.getReplaceAddress(); logger.info("Gathering node replacement information for {}", replaceAddress); Map<InetAddress, EndpointState> epStates = Gossiper.instance.doShadowRound();
"-Dcassandra.allow_unsafe_replace=true"); InetAddress replaceAddress = DatabaseDescriptor.getReplaceAddress(); logger.info("Gathering node replacement information for {}", replaceAddress); Map<InetAddress, EndpointState> epStates = Gossiper.instance.doShadowRound();
"-Dcassandra.allow_unsafe_replace=true"); InetAddress replaceAddress = DatabaseDescriptor.getReplaceAddress(); logger.info("Gathering node replacement information for {}", replaceAddress); Map<InetAddress, EndpointState> epStates = Gossiper.instance.doShadowRound();
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 if (replacing && DatabaseDescriptor.getReplaceAddress().equals(ep))
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 if (DatabaseDescriptor.isReplacing() && DatabaseDescriptor.getReplaceAddress().equals(ep))
states.add(Pair.create(ApplicationState.TOKENS, valueFactory.tokens(tokens))); states.add(Pair.create(ApplicationState.STATUS, replacing? valueFactory.bootReplacing(DatabaseDescriptor.getReplaceAddress()) : valueFactory.bootstrapping(tokens))); Gossiper.instance.addLocalApplicationStates(states); SystemKeyspace.removeEndpoint(DatabaseDescriptor.getReplaceAddress());
states.add(Pair.create(ApplicationState.TOKENS, valueFactory.tokens(tokens))); states.add(Pair.create(ApplicationState.STATUS, replacing? valueFactory.bootReplacing(DatabaseDescriptor.getReplaceAddress()) : valueFactory.bootstrapping(tokens))); Gossiper.instance.addLocalApplicationStates(states); SystemKeyspace.removeEndpoint(DatabaseDescriptor.getReplaceAddress());
private void bootstrap(Collection<Token> tokens) { isBootstrapMode = true; SystemKeyspace.updateTokens(tokens); // DON'T use setToken, that makes us part of the ring locally which is incorrect until we are done bootstrapping if (!DatabaseDescriptor.isReplacing()) { // if not an existing token then bootstrap List<Pair<ApplicationState, VersionedValue>> states = new ArrayList<Pair<ApplicationState, VersionedValue>>(); states.add(Pair.create(ApplicationState.TOKENS, valueFactory.tokens(tokens))); states.add(Pair.create(ApplicationState.STATUS, valueFactory.bootstrapping(tokens))); Gossiper.instance.addLocalApplicationStates(states); setMode(Mode.JOINING, "sleeping " + RING_DELAY + " ms for pending range setup", true); Uninterruptibles.sleepUninterruptibly(RING_DELAY, TimeUnit.MILLISECONDS); } else { // Dont set any state for the node which is bootstrapping the existing token... tokenMetadata.updateNormalTokens(tokens, FBUtilities.getBroadcastAddress()); SystemKeyspace.removeEndpoint(DatabaseDescriptor.getReplaceAddress()); } if (!Gossiper.instance.seenAnySeed()) throw new IllegalStateException("Unable to contact any seeds!"); setMode(Mode.JOINING, "Starting to bootstrap...", true); new BootStrapper(FBUtilities.getBroadcastAddress(), tokens, tokenMetadata).bootstrap(); // handles token update logger.info("Bootstrap completed! for the tokens {}", tokens); }
states.add(Pair.create(ApplicationState.TOKENS, valueFactory.tokens(tokens))); states.add(Pair.create(ApplicationState.STATUS, replacing? valueFactory.bootReplacing(DatabaseDescriptor.getReplaceAddress()) : valueFactory.bootstrapping(tokens))); Gossiper.instance.addLocalApplicationStates(states); SystemKeyspace.removeEndpoint(DatabaseDescriptor.getReplaceAddress());
"the node to be replaced ({}). If the previous node has been down for longer than max_hint_window_in_ms, " + "repair must be run after the replacement process in order to make this node consistent.", DatabaseDescriptor.getReplaceAddress()); appStates.put(ApplicationState.STATUS, valueFactory.hibernate(true));
"the node to be replaced ({}). If the previous node has been down for longer than max_hint_window_in_ms, " + "repair must be run after the replacement process in order to make this node consistent.", DatabaseDescriptor.getReplaceAddress()); appStates.put(ApplicationState.STATUS, valueFactory.hibernate(true));
"the node to be replaced ({}). If the previous node has been down for longer than max_hint_window_in_ms, " + "repair must be run after the replacement process in order to make this node consistent.", DatabaseDescriptor.getReplaceAddress()); appStates.put(ApplicationState.STATUS, valueFactory.hibernate(true));