Updated Branches: refs/heads/trunk 5cde66bab -> d96e813e0
Fix SystemTable.setBootstrapState and other merge fallout from #4427. Patch by Dave Brosius and brandonwilliams, reviewed by Dave Brosius for CASSANDRA-4460 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d96e813e Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d96e813e Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d96e813e Branch: refs/heads/trunk Commit: d96e813e06cc9fdf902d79af2962f38f047b14fa Parents: 5cde66b Author: Brandon Williams <brandonwilli...@apache.org> Authored: Wed Jul 25 20:34:11 2012 -0500 Committer: Brandon Williams <brandonwilli...@apache.org> Committed: Wed Jul 25 20:36:49 2012 -0500 ---------------------------------------------------------------------- .../org/apache/cassandra/config/CFMetaData.java | 2 +- src/java/org/apache/cassandra/db/SystemTable.java | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/d96e813e/src/java/org/apache/cassandra/config/CFMetaData.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java index 906017c..4321175 100644 --- a/src/java/org/apache/cassandra/config/CFMetaData.java +++ b/src/java/org/apache/cassandra/config/CFMetaData.java @@ -166,7 +166,7 @@ public final class CFMetaData + "token_bytes blob," + "cluster_name text," + "gossip_generation int," - + "bootstrapped boolean," + + "bootstrapped text," + "ring_id uuid," + "release_version text," + "thrift_version text," http://git-wip-us.apache.org/repos/asf/cassandra/blob/d96e813e/src/java/org/apache/cassandra/db/SystemTable.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/SystemTable.java b/src/java/org/apache/cassandra/db/SystemTable.java index e852003..778f3cb 100644 --- a/src/java/org/apache/cassandra/db/SystemTable.java +++ b/src/java/org/apache/cassandra/db/SystemTable.java @@ -80,8 +80,8 @@ public class SystemTable public enum BootstrapState { - NEEDS_BOOTSTRAP, // ordered for boolean backward compatibility, false - COMPLETED, // true + NEEDS_BOOTSTRAP, + COMPLETED, IN_PROGRESS } @@ -136,8 +136,8 @@ public class SystemTable Token token = StorageService.getPartitioner().getTokenFactory().fromByteArray(oldColumns.next().value()); String tokenBytes = ByteBufferUtil.bytesToHex(serializeTokens(Collections.singleton(token))); // (assume that any node getting upgraded was bootstrapped, since that was stored in a separate row for no particular reason) - String req = "INSERT INTO system.%s (key, cluster_name, token_bytes, bootstrapped) VALUES ('%s', '%s', '%s', 'true')"; - processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, clusterName, tokenBytes)); + String req = "INSERT INTO system.%s (key, cluster_name, token_bytes, bootstrapped) VALUES ('%s', '%s', '%s', '%s')"; + processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, clusterName, tokenBytes, BootstrapState.COMPLETED.name())); oldStatusCfs.truncate(); } @@ -372,7 +372,8 @@ public class SystemTable if (result.isEmpty() || !result.one().has("bootstrapped")) return BootstrapState.NEEDS_BOOTSTRAP; - return BootstrapState.values()[result.one().getInt("bootstrapped")]; + + return BootstrapState.valueOf(result.one().getString("bootstrapped")); } public static boolean bootstrapComplete() @@ -387,8 +388,8 @@ public class SystemTable public static void setBootstrapState(BootstrapState state) { - String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%b')"; - processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, getBootstrapState())); + String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%s')"; + processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, state.name())); forceBlockingFlush(LOCAL_CF); }