You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2013/05/10 08:57:14 UTC
svn commit: r1480895 - in /lucene/dev/branches/lucene_solr_4_3: ./ solr/
solr/core/ solr/core/src/java/org/apache/solr/update/processor/
solr/core/src/test/org/apache/solr/cloud/
Author: shalin
Date: Fri May 10 06:57:13 2013
New Revision: 1480895
URL: http://svn.apache.org/r1480895
Log:
SOLR-4795: Sub shard leader should not accept any updates from parent after it goes active
Modified:
lucene/dev/branches/lucene_solr_4_3/ (props changed)
lucene/dev/branches/lucene_solr_4_3/solr/ (props changed)
lucene/dev/branches/lucene_solr_4_3/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/lucene_solr_4_3/solr/core/ (props changed)
lucene/dev/branches/lucene_solr_4_3/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
lucene/dev/branches/lucene_solr_4_3/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java
lucene/dev/branches/lucene_solr_4_3/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java
Modified: lucene/dev/branches/lucene_solr_4_3/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_3/solr/CHANGES.txt?rev=1480895&r1=1480894&r2=1480895&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_3/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_4_3/solr/CHANGES.txt Fri May 10 06:57:13 2013
@@ -37,6 +37,9 @@ Detailed Change List
Bug Fixes
----------------------
+* SOLR-4795: Sub shard leader should not accept any updates from parent after
+ it goes active (shalin)
+
Other Changes
----------------------
Modified: lucene/dev/branches/lucene_solr_4_3/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_3/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java?rev=1480895&r1=1480894&r2=1480895&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_3/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java (original)
+++ lucene/dev/branches/lucene_solr_4_3/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java Fri May 10 06:57:13 2013
@@ -321,7 +321,11 @@ public class DistributedUpdateProcessor
boolean localIsLeader = cloudDescriptor.isLeader();
if (DistribPhase.FROMLEADER == phase && localIsLeader && from != null) { // from will be null on log replay
String fromShard = req.getParams().get("distrib.from.parent");
- if (fromShard != null) {
+ if (fromShard != null) {
+ if (!Slice.CONSTRUCTION.equals(mySlice.getState())) {
+ throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE,
+ "Request says it is coming from parent shard leader but we are not in construction state");
+ }
// shard splitting case -- check ranges to see if we are a sub-shard
Slice fromSlice = zkController.getClusterState().getCollection(collection).getSlice(fromShard);
DocRouter.Range parentRange = fromSlice.getRange();
@@ -330,12 +334,12 @@ public class DistributedUpdateProcessor
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE,
"Request says it is coming from parent shard leader but parent hash range is not superset of my range");
}
- } else {
- log.error("Request says it is coming from leader, but we are the leader: " + req.getParamString());
- throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, "Request says it is coming from leader, but we are the leader");
- }
+ } else {
+ log.error("Request says it is coming from leader, but we are the leader: " + req.getParamString());
+ throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, "Request says it is coming from leader, but we are the leader");
+ }
}
-
+
if (isLeader && !localIsLeader) {
log.error("ClusterState says we are the leader, but locally we don't think so");
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, "ClusterState says we are the leader, but locally we don't think so");
Modified: lucene/dev/branches/lucene_solr_4_3/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_3/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java?rev=1480895&r1=1480894&r2=1480895&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_3/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java (original)
+++ lucene/dev/branches/lucene_solr_4_3/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java Fri May 10 06:57:13 2013
@@ -85,7 +85,8 @@ public class ChaosMonkeyShardSplitTest e
indexThread = new Thread() {
@Override
public void run() {
- for (int id = 101; id < atLeast(401); id++) {
+ int max = atLeast(401);
+ for (int id = 101; id < max; id++) {
try {
indexAndUpdateCount(ranges, docCounts, id);
Thread.sleep(atLeast(25));
Modified: lucene/dev/branches/lucene_solr_4_3/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_3/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java?rev=1480895&r1=1480894&r2=1480895&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_3/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java (original)
+++ lucene/dev/branches/lucene_solr_4_3/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java Fri May 10 06:57:13 2013
@@ -110,7 +110,8 @@ public class ShardSplitTest extends Basi
Thread indexThread = new Thread() {
@Override
public void run() {
- for (int id = 101; id < atLeast(401); id++) {
+ int max = atLeast(401);
+ for (int id = 101; id < max; id++) {
try {
indexAndUpdateCount(ranges, docCounts, id);
Thread.sleep(atLeast(25));