fix 1.0.x node join to mixed version cluster, other nodes >= 1.1 patch by Pavel Yaskevich; reviewed by Jonathan Ellis for CASSANDRA-4195
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/51a9fd13 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/51a9fd13 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/51a9fd13 Branch: refs/heads/cassandra-1.1 Commit: 51a9fd131a815bf4d368d89b0961429a1d51a532 Parents: 84a1d60 Author: Pavel Yaskevich <xe...@apache.org> Authored: Mon Jul 9 23:27:57 2012 +0300 Committer: Pavel Yaskevich <xe...@apache.org> Committed: Thu Jul 12 00:57:18 2012 +0300 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/service/MigrationManager.java | 30 +++++++++------ 2 files changed, 19 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/51a9fd13/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index c752244..d3cca6c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -9,6 +9,7 @@ sstables, such as when convertinb back from LCS (CASSANDRA-4287) * Oversize integer in CQL throws NumberFormatException (CASSANDRA-4291) * Set gc_grace on index CF to 0 (CASSANDRA-4314) + * fix 1.0.x node join to mixed version cluster, other nodes >= 1.1 (CASSANDRA-4195) 1.0.10 http://git-wip-us.apache.org/repos/asf/cassandra/blob/51a9fd13/src/java/org/apache/cassandra/service/MigrationManager.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/MigrationManager.java b/src/java/org/apache/cassandra/service/MigrationManager.java index f9e5c33..7adbfea 100644 --- a/src/java/org/apache/cassandra/service/MigrationManager.java +++ b/src/java/org/apache/cassandra/service/MigrationManager.java @@ -56,32 +56,29 @@ public class MigrationManager implements IEndpointStateChangeSubscriber private static volatile UUID highestKnown; - public void onJoin(InetAddress endpoint, EndpointState epState) { + public void onJoin(InetAddress endpoint, EndpointState epState) + { VersionedValue value = epState.getApplicationState(ApplicationState.SCHEMA); + if (value != null) - { - UUID theirVersion = UUID.fromString(value.value); - rectify(theirVersion, endpoint); - } + rectify(UUID.fromString(value.value), endpoint); } public void onChange(InetAddress endpoint, ApplicationState state, VersionedValue value) { if (state != ApplicationState.SCHEMA) return; - UUID theirVersion = UUID.fromString(value.value); - rectify(theirVersion, endpoint); + + rectify(UUID.fromString(value.value), endpoint); } /** gets called after a this node joins a cluster */ public void onAlive(InetAddress endpoint, EndpointState state) { VersionedValue value = state.getApplicationState(ApplicationState.SCHEMA); + if (value != null) - { - UUID theirVersion = UUID.fromString(value.value); - rectify(theirVersion, endpoint); - } + rectify(UUID.fromString(value.value), endpoint); } public void onDead(InetAddress endpoint, EndpointState state) { } @@ -89,13 +86,22 @@ public class MigrationManager implements IEndpointStateChangeSubscriber public void onRestart(InetAddress endpoint, EndpointState state) { } public void onRemove(InetAddress endpoint) { } - + /** * will either push or pull an updating depending on who is behind. * fat clients should never push their schemas (since they have no local storage). */ public static void rectify(UUID theirVersion, InetAddress endpoint) { + if (theirVersion.version() != 1) + { + logger.warn("Can't merge remove schema because node operates in the mixed version cluster " + + "(Please upgrade all nodes to >= 1.1 to be able to perform schema migrations)."); + + highestKnown = Schema.instance.getVersion(); + return; + } + updateHighestKnown(theirVersion); UUID myVersion = Schema.instance.getVersion(); if (theirVersion.timestamp() < myVersion.timestamp()