You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2014/06/12 21:46:33 UTC
[04/10] git commit: Add replace_address_first_boot flag to only
replace if not bootstrapped.
Add replace_address_first_boot flag to only replace if not bootstrapped.
Patch by brandonwilliams, reviewed by thobbs for CASSANDRA-7356
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/29a89d81
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/29a89d81
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/29a89d81
Branch: refs/heads/trunk
Commit: 29a89d818a8befa95408e7c6c0a1347e107c3a26
Parents: 2d6babb
Author: Brandon Williams <br...@apache.org>
Authored: Thu Jun 12 14:41:52 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Jun 12 14:41:52 2014 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/config/DatabaseDescriptor.java | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/29a89d81/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index dd58ff9..f37eda4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -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)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/29a89d81/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index 3ed82f5..3c58b57 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -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;
}