You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2015/09/04 15:11:09 UTC
cassandra git commit: fix
Repository: cassandra
Updated Branches:
refs/heads/cassandra-3.0 a22db5be2 -> c7557bdec
fix
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c7557bde
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c7557bde
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c7557bde
Branch: refs/heads/cassandra-3.0
Commit: c7557bdecda6ffe76bb5ee62be4c2d6c53804681
Parents: a22db5b
Author: T Jake Luciani <ja...@apache.org>
Authored: Thu Sep 3 14:53:00 2015 -0400
Committer: T Jake Luciani <ja...@apache.org>
Committed: Fri Sep 4 09:10:49 2015 -0400
----------------------------------------------------------------------
.../cassandra/db/view/MaterializedViewUtils.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/c7557bde/src/java/org/apache/cassandra/db/view/MaterializedViewUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/view/MaterializedViewUtils.java b/src/java/org/apache/cassandra/db/view/MaterializedViewUtils.java
index 4dfea75..ea81750 100644
--- a/src/java/org/apache/cassandra/db/view/MaterializedViewUtils.java
+++ b/src/java/org/apache/cassandra/db/view/MaterializedViewUtils.java
@@ -26,6 +26,7 @@ import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.dht.Token;
import org.apache.cassandra.locator.AbstractReplicationStrategy;
+import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.utils.FBUtilities;
public final class MaterializedViewUtils
@@ -87,8 +88,21 @@ public final class MaterializedViewUtils
// number of replicas for all of the tokens in the ring.
assert localBaseEndpoints.size() == localViewEndpoints.size() : "Replication strategy should have the same number of endpoints for the base and the view";
int baseIdx = localBaseEndpoints.indexOf(FBUtilities.getBroadcastAddress());
+
if (baseIdx < 0)
+ {
+
+ if (StorageService.instance.getTokenMetadata().pendingEndpointsFor(viewToken, keyspaceName).size() > 0)
+ {
+ //Since there are pending endpoints we are going to store hints this in the batchlog regardless.
+ //So we can pretend we are the views endpoint.
+
+ return FBUtilities.getBroadcastAddress();
+ }
+
throw new RuntimeException("Trying to get the view natural endpoint on a non-data replica");
+ }
+
return localViewEndpoints.get(baseIdx);
}