cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [1/2] cassandra git commit: Add an extra version check to MigrationTask
Date Wed, 07 Jan 2015 19:51:55 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 68be72fdc -> 561293d13


Add an extra version check to MigrationTask

patch by Aleksey Yeschenko; reviewed by Tyler Hobbs for CASSANDRA-8462


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8078a58f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8078a58f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8078a58f

Branch: refs/heads/cassandra-2.1
Commit: 8078a58f2ee625e497bd938ed35514bb003d03dc
Parents: 3679b1b
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Wed Jan 7 22:39:00 2015 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Wed Jan 7 22:39:00 2015 +0300

----------------------------------------------------------------------
 CHANGES.txt                                            |  1 +
 .../org/apache/cassandra/service/MigrationManager.java |  2 +-
 .../org/apache/cassandra/service/MigrationTask.java    | 13 ++++++++++---
 3 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8078a58f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7aad4c0..c1bb28c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.12:
+ * Add an extra version check to MigrationTask (CASSANDRA-8462)
  * Ensure SSTableWriter cleans up properly after failure (CASSANDRA-8499)
  * Increase bf true positive count on key cache hit (CASSANDRA-8525)
  * Move MeteredFlusher to its own thread (CASSANDRA-8485)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8078a58f/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 b474bdc..f66b738 100644
--- a/src/java/org/apache/cassandra/service/MigrationManager.java
+++ b/src/java/org/apache/cassandra/service/MigrationManager.java
@@ -141,7 +141,7 @@ public class MigrationManager
         return StageManager.getStage(Stage.MIGRATION).submit(new MigrationTask(endpoint));
     }
 
-    private static boolean shouldPullSchemaFrom(InetAddress endpoint)
+    public static boolean shouldPullSchemaFrom(InetAddress endpoint)
     {
         /*
          * Don't request schema from nodes with a differnt or unknonw major version (may
have incompatible schema)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8078a58f/src/java/org/apache/cassandra/service/MigrationTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/MigrationTask.java b/src/java/org/apache/cassandra/service/MigrationTask.java
index 93572f0..0944c55 100644
--- a/src/java/org/apache/cassandra/service/MigrationTask.java
+++ b/src/java/org/apache/cassandra/service/MigrationTask.java
@@ -48,7 +48,14 @@ class MigrationTask extends WrappedRunnable
 
     public void runMayThrow() throws Exception
     {
-        MessageOut message = new MessageOut<>(MessagingService.Verb.MIGRATION_REQUEST,
null, MigrationManager.MigrationsSerializer.instance);
+        // There is a chance that quite some time could have passed between now and the MM#maybeScheduleSchemaPull(),
+        // potentially enough for the endpoint node to restart - which is an issue if it
does restart upgraded, with
+        // a higher major.
+        if (!MigrationManager.shouldPullSchemaFrom(endpoint))
+        {
+            logger.info("Skipped sending a migration request: node {} has a higher major
version now.", endpoint);
+            return;
+        }
 
         if (!FailureDetector.instance.isAlive(endpoint))
         {
@@ -56,9 +63,10 @@ class MigrationTask extends WrappedRunnable
             return;
         }
 
+        MessageOut message = new MessageOut<>(MessagingService.Verb.MIGRATION_REQUEST,
null, MigrationManager.MigrationsSerializer.instance);
+
         IAsyncCallback<Collection<RowMutation>> cb = new IAsyncCallback<Collection<RowMutation>>()
         {
-            @Override
             public void response(MessageIn<Collection<RowMutation>> message)
             {
                 try
@@ -75,7 +83,6 @@ class MigrationTask extends WrappedRunnable
                 }
             }
 
-            @Override
             public boolean isLatencyForSnitch()
             {
                 return false;


Mime
View raw message