Permalink
Browse files

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
  • Loading branch information...
xedin committed Jul 9, 2012
1 parent 84a1d60 commit 51a9fd131a815bf4d368d89b0961429a1d51a532
Showing with 19 additions and 12 deletions.
  1. +1 −0 CHANGES.txt
  2. +18 −12 src/java/org/apache/cassandra/service/MigrationManager.java
View
@@ -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
@@ -56,46 +56,52 @@
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) { }
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()

0 comments on commit 51a9fd1

Please sign in to comment.