Add replace_address_first_boot flag to only replace if not bootstrapped.

Patch by brandonwilliams, reviewed by thobbs for CASSANDRA-7356
This commit is contained in:
Brandon Williams 2014-06-12 14:41:52 -05:00
parent 2d6babbcc9
commit 29a89d818a
2 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,5 @@
1.2.17
* Add replace_address_first_boot flag to only replace if not bootstrapped (CASSANDRA-7356)
* Enable keepalive for native protocol (CASSANDRA-7380)
* Check internal addresses for seeds (CASSANDRA-6523)
* Fix potential / by 0 in HHOM page size calculation (CASSANDRA-7354)

View File

@ -744,8 +744,9 @@ public class DatabaseDescriptor
{
if (System.getProperty("cassandra.replace_address", null) != null)
return InetAddress.getByName(System.getProperty("cassandra.replace_address", null));
else
return null;
else if (System.getProperty("cassandra.replace_address_first_boot", null) != null)
return InetAddress.getByName(System.getProperty("cassandra.replace_address_first_boot", null));
return null;
}
catch (UnknownHostException e)
{
@ -771,6 +772,13 @@ public class DatabaseDescriptor
public static boolean isReplacing()
{
if (System.getProperty("cassandra.replace_address_first_boot", null) != null && SystemTable.bootstrapComplete())
{
logger.info("Replace address on first boot requested; this node is already bootstrapped");
return false;
}
if (getReplaceAddress() != null && SystemTable.bootstrapComplete())
throw new RuntimeException("Cannot replace address with a node that is already bootstrapped");
return getReplaceAddress() != null;
}