mirror of https://github.com/apache/lucene.git
SOLR-4795: Sub shard leader should not accept any updates from parent after it goes active
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1480113 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
27ef1eb203
commit
3ffb10b13e
|
@ -90,6 +90,9 @@ Bug Fixes
|
||||||
* SOLR-4616: HitRatio on caches is now exposed over JMX MBeans as a float.
|
* SOLR-4616: HitRatio on caches is now exposed over JMX MBeans as a float.
|
||||||
(Greg Bowyer)
|
(Greg Bowyer)
|
||||||
|
|
||||||
|
* SOLR-4795: Sub shard leader should not accept any updates from parent after
|
||||||
|
it goes active (shalin)
|
||||||
|
|
||||||
Other Changes
|
Other Changes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -322,7 +322,11 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
|
||||||
boolean localIsLeader = cloudDescriptor.isLeader();
|
boolean localIsLeader = cloudDescriptor.isLeader();
|
||||||
if (DistribPhase.FROMLEADER == phase && localIsLeader && from != null) { // from will be null on log replay
|
if (DistribPhase.FROMLEADER == phase && localIsLeader && from != null) { // from will be null on log replay
|
||||||
String fromShard = req.getParams().get("distrib.from.parent");
|
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
|
// shard splitting case -- check ranges to see if we are a sub-shard
|
||||||
Slice fromSlice = zkController.getClusterState().getCollection(collection).getSlice(fromShard);
|
Slice fromSlice = zkController.getClusterState().getCollection(collection).getSlice(fromShard);
|
||||||
DocRouter.Range parentRange = fromSlice.getRange();
|
DocRouter.Range parentRange = fromSlice.getRange();
|
||||||
|
@ -331,12 +335,12 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
|
||||||
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE,
|
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");
|
"Request says it is coming from parent shard leader but parent hash range is not superset of my range");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.error("Request says it is coming from leader, but we are the leader: " + req.getParamString());
|
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");
|
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, "Request says it is coming from leader, but we are the leader");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (isLeader && !localIsLeader) {
|
if (isLeader && !localIsLeader) {
|
||||||
log.error("ClusterState says we are the leader, but locally we don't think so");
|
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");
|
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, "ClusterState says we are the leader, but locally we don't think so");
|
||||||
|
|
|
@ -85,7 +85,8 @@ public class ChaosMonkeyShardSplitTest extends ShardSplitTest {
|
||||||
indexThread = new Thread() {
|
indexThread = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (int id = 101; id < atLeast(401); id++) {
|
int max = atLeast(401);
|
||||||
|
for (int id = 101; id < max; id++) {
|
||||||
try {
|
try {
|
||||||
indexAndUpdateCount(ranges, docCounts, id);
|
indexAndUpdateCount(ranges, docCounts, id);
|
||||||
Thread.sleep(atLeast(25));
|
Thread.sleep(atLeast(25));
|
||||||
|
|
|
@ -110,7 +110,8 @@ public class ShardSplitTest extends BasicDistributedZkTest {
|
||||||
Thread indexThread = new Thread() {
|
Thread indexThread = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (int id = 101; id < atLeast(401); id++) {
|
int max = atLeast(401);
|
||||||
|
for (int id = 101; id < max; id++) {
|
||||||
try {
|
try {
|
||||||
indexAndUpdateCount(ranges, docCounts, id);
|
indexAndUpdateCount(ranges, docCounts, id);
|
||||||
Thread.sleep(atLeast(25));
|
Thread.sleep(atLeast(25));
|
||||||
|
|
Loading…
Reference in New Issue