You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2014/04/08 21:34:39 UTC
[04/10] git commit: Schedule schema pull in onChange.
Schedule schema pull in onChange.
Patch by brandonwilliams, reviewed by Russ Hatch for CASSANDRA-6971
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1755f65a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1755f65a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1755f65a
Branch: refs/heads/trunk
Commit: 1755f65a647da1816e2bd8229ba656a26cfcff1d
Parents: 514ce33
Author: Brandon Williams <br...@apache.org>
Authored: Tue Apr 8 14:28:58 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Apr 8 14:28:58 2014 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/service/MigrationManager.java | 12 +++++++++++-
.../org/apache/cassandra/service/StorageService.java | 2 ++
3 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1755f65a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index b3a794f..dc8e6e0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,7 @@
* Fix BatchlogManager#deleteBatch() use of millisecond timsestamps
(CASSANDRA-6822)
* Continue assassinating even if the endpoint vanishes (CASSANDRA-6787)
+ * Schedule schema pulls on change (CASSANDRA-6971)
1.2.16
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1755f65a/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 9f6113c..09caeb1 100644
--- a/src/java/org/apache/cassandra/service/MigrationManager.java
+++ b/src/java/org/apache/cassandra/service/MigrationManager.java
@@ -91,11 +91,15 @@ public class MigrationManager
private static void maybeScheduleSchemaPull(final UUID theirVersion, final InetAddress endpoint)
{
if ((Schema.instance.getVersion() != null && Schema.instance.getVersion().equals(theirVersion)) || !shouldPullSchemaFrom(endpoint))
+ {
+ logger.debug("Not pulling schema because versions match or shouldPullSchemaFrom returned false");
return;
+ }
if (Schema.emptyVersion.equals(Schema.instance.getVersion()) || runtimeMXBean.getUptime() < MIGRATION_DELAY_IN_MS)
{
// If we think we may be bootstrapping or have recently started, submit MigrationTask immediately
+ logger.debug("Submitting migration task for {}", endpoint);
submitMigrationTask(endpoint);
}
else
@@ -109,12 +113,18 @@ public class MigrationManager
// grab the latest version of the schema since it may have changed again since the initial scheduling
EndpointState epState = Gossiper.instance.getEndpointStateForEndpoint(endpoint);
if (epState == null)
+ {
+ logger.debug("epState vanished for {}, not submitting migration task", endpoint);
return;
+ }
VersionedValue value = epState.getApplicationState(ApplicationState.SCHEMA);
UUID currentVersion = UUID.fromString(value.value);
if (Schema.instance.getVersion().equals(currentVersion))
+ {
+ logger.debug("not submitting migration task for {} because our versions match", endpoint);
return;
-
+ }
+ logger.debug("submitting migration task for {}", endpoint);
submitMigrationTask(endpoint);
}
};
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1755f65a/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index d5b7bb5..473ef49 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -1377,6 +1377,8 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
case HOST_ID:
SystemTable.updatePeerInfo(endpoint, "host_id", value.value);
break;
+ case SCHEMA:
+ MigrationManager.instance.scheduleSchemaPull(endpoint, epState);
}
}
}