SOLR-7989: Revert changes.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1713882 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2015-11-11 16:02:50 +00:00
parent 989afcaf86
commit e7329a7b83
2 changed files with 8 additions and 28 deletions

View File

@ -354,10 +354,8 @@ Bug Fixes
a race condition can cause that client to hang in blockUntilFinished. a race condition can cause that client to hang in blockUntilFinished.
(Mark Miller, yonik) (Mark Miller, yonik)
* SOLR-8215: Only active replicas should handle incoming requests against a collection (Varun Thacker)
* SOLR-7989: After a new leader is elected it should change it's state to ACTIVE even * SOLR-8215: Only active replicas should handle incoming requests against a collection (Varun Thacker)
if the last published state is something else (Ishan Chattopadhyaya, Mark Miller via noble )
* SOLR-8223: Avoid accidentally swallowing OutOfMemoryError (in LeaderInitiatedRecoveryThread.java * SOLR-8223: Avoid accidentally swallowing OutOfMemoryError (in LeaderInitiatedRecoveryThread.java
or CoreContainer.java) (Mike Drob via Christine Poerschke) or CoreContainer.java) (Mike Drob via Christine Poerschke)

View File

@ -11,7 +11,6 @@ import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.solr.cloud.overseer.OverseerAction; import org.apache.solr.cloud.overseer.OverseerAction;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode; import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.Replica; import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.Slice; import org.apache.solr.common.cloud.Slice;
import org.apache.solr.common.cloud.SolrZkClient; import org.apache.solr.common.cloud.SolrZkClient;
@ -108,7 +107,6 @@ class ShardLeaderElectionContextBase extends ElectionContext {
private static Logger log = LoggerFactory private static Logger log = LoggerFactory
.getLogger(ShardLeaderElectionContextBase.class); .getLogger(ShardLeaderElectionContextBase.class);
protected final SolrZkClient zkClient; protected final SolrZkClient zkClient;
protected ZkStateReader zkStateReader;
protected String shardId; protected String shardId;
protected String collection; protected String collection;
protected LeaderElector leaderElector; protected LeaderElector leaderElector;
@ -121,7 +119,6 @@ class ShardLeaderElectionContextBase extends ElectionContext {
+ "/leader_elect/" + shardId, ZkStateReader.getShardLeadersPath( + "/leader_elect/" + shardId, ZkStateReader.getShardLeadersPath(
collection, shardId), props, zkStateReader.getZkClient()); collection, shardId), props, zkStateReader.getZkClient());
this.leaderElector = leaderElector; this.leaderElector = leaderElector;
this.zkStateReader = zkStateReader;
this.zkClient = zkStateReader.getZkClient(); this.zkClient = zkStateReader.getZkClient();
this.shardId = shardId; this.shardId = shardId;
this.collection = collection; this.collection = collection;
@ -216,28 +213,13 @@ class ShardLeaderElectionContextBase extends ElectionContext {
} }
assert shardId != null; assert shardId != null;
ZkNodeProps m = ZkNodeProps.fromKeyVals(Overseer.QUEUE_OPERATION,
ZkNodeProps m; OverseerAction.LEADER.toLower(), ZkStateReader.SHARD_ID_PROP, shardId,
ClusterState clusterState = zkStateReader.getClusterState(); ZkStateReader.COLLECTION_PROP, collection, ZkStateReader.BASE_URL_PROP,
Replica rep = (clusterState == null) ? null : clusterState.getReplica(collection, leaderProps.getProperties().get(ZkStateReader.BASE_URL_PROP),
leaderProps.getStr(ZkStateReader.CORE_NODE_NAME_PROP)); ZkStateReader.CORE_NAME_PROP,
if (rep != null && rep.getState() != Replica.State.ACTIVE) { leaderProps.getProperties().get(ZkStateReader.CORE_NAME_PROP),
m = ZkNodeProps.fromKeyVals(Overseer.QUEUE_OPERATION, OverseerAction.STATE.toLower(), ZkStateReader.STATE_PROP, Replica.State.ACTIVE.toString());
ZkStateReader.STATE_PROP, Replica.State.ACTIVE.toString(),
ZkStateReader.SHARD_ID_PROP, shardId,
ZkStateReader.COLLECTION_PROP, collection,
ZkStateReader.BASE_URL_PROP, leaderProps.getProperties().get(ZkStateReader.BASE_URL_PROP),
ZkStateReader.NODE_NAME_PROP, leaderProps.getProperties().get(ZkStateReader.NODE_NAME_PROP),
ZkStateReader.CORE_NODE_NAME_PROP, leaderProps.getProperties().get(ZkStateReader.CORE_NODE_NAME_PROP),
ZkStateReader.CORE_NAME_PROP, leaderProps.getProperties().get(ZkStateReader.CORE_NAME_PROP));
Overseer.getInQueue(zkClient).offer(Utils.toJSON(m));
}
m = ZkNodeProps.fromKeyVals(Overseer.QUEUE_OPERATION, OverseerAction.LEADER.toLower(),
ZkStateReader.SHARD_ID_PROP, shardId,
ZkStateReader.COLLECTION_PROP, collection,
ZkStateReader.BASE_URL_PROP, leaderProps.getProperties().get(ZkStateReader.BASE_URL_PROP),
ZkStateReader.CORE_NAME_PROP, leaderProps.getProperties().get(ZkStateReader.CORE_NAME_PROP));
Overseer.getInQueue(zkClient).offer(Utils.toJSON(m)); Overseer.getInQueue(zkClient).offer(Utils.toJSON(m));
} }