diff --git a/CHANGES.txt b/CHANGES.txt index c7522443a7..d3cca6c1e3 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 diff --git a/src/java/org/apache/cassandra/service/MigrationManager.java b/src/java/org/apache/cassandra/service/MigrationManager.java index f9e5c33322..7adbfeaebd 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()