SOLR-5739: Sub-shards created by shard splitting have their update log set to buffering mode on restarts

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1569072 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2014-02-17 18:30:38 +00:00
parent 4cb6fa0ca8
commit 21ed14f6ad
4 changed files with 24 additions and 5 deletions

View File

@ -340,6 +340,9 @@ Bug Fixes
* SOLR-5727: LBHttpSolrServer should only retry on Connection exceptions when
sending updates. Affects CloudSolrServer. (Mark Miller)
* SOLR-5739: Sub-shards created by shard splitting have their update log set
to buffering mode on restarts. (Günther Ruck, shalin)
Optimizations
----------------------

View File

@ -379,8 +379,12 @@ public class Overseer {
Map<String, Object> sliceProps = new HashMap<String, Object>();
String shardRange = message.getStr(ZkStateReader.SHARD_RANGE_PROP);
String shardState = message.getStr(ZkStateReader.SHARD_STATE_PROP);
String shardParent = message.getStr(ZkStateReader.SHARD_PARENT_PROP);
sliceProps.put(Slice.RANGE, shardRange);
sliceProps.put(Slice.STATE, shardState);
if (shardParent != null) {
sliceProps.put(Slice.PARENT, shardParent);
}
slice = new Slice(shardId, replicas, sliceProps);
clusterState = updateSlice(clusterState, collection, slice);
} else {

View File

@ -949,6 +949,17 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
+ subSlice + " of collection " + collectionName + " on "
+ nodeName);
Map<String, Object> propMap = new HashMap<String, Object>();
propMap.put(Overseer.QUEUE_OPERATION, "createshard");
propMap.put(ZkStateReader.SHARD_ID_PROP, subSlice);
propMap.put(ZkStateReader.COLLECTION_PROP, collectionName);
propMap.put(ZkStateReader.SHARD_RANGE_PROP, subRange.toString());
propMap.put(ZkStateReader.SHARD_STATE_PROP, Slice.CONSTRUCTION);
propMap.put(ZkStateReader.SHARD_PARENT_PROP, parentSlice.getName());
ZkNodeProps m = new ZkNodeProps(propMap);
DistributedQueue inQueue = Overseer.getInQueue(zkStateReader.getZkClient());
inQueue.offer(ZkStateReader.toJSON(m));
ModifiableSolrParams params = new ModifiableSolrParams();
params.set(CoreAdminParams.ACTION, CoreAdminAction.CREATE.toString());

View File

@ -64,6 +64,7 @@ import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.LockObtainFailedException;
import org.apache.solr.cloud.CloudDescriptor;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.Slice;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.CommonParams.EchoParamStyle;
@ -866,13 +867,13 @@ public final class SolrCore implements SolrInfoMBean {
"SolrCloud will always use full index replication instead of the more efficient PeerSync method.");
}
if (Slice.CONSTRUCTION.equals(cd.getCloudDescriptor().getShardState())) {
// ZK pre-Register would have already happened so we read slice properties now
ClusterState clusterState = cc.getZkController().getClusterState();
Slice slice = clusterState.getSlice(cd.getCloudDescriptor().getCollectionName(),
cd.getCloudDescriptor().getShardId());
if (Slice.CONSTRUCTION.equals(slice.getState())) {
// set update log to buffer before publishing the core
getUpdateHandler().getUpdateLog().bufferUpdates();
cd.getCloudDescriptor().setShardState(null);
cd.getCloudDescriptor().setShardRange(null);
cd.getCloudDescriptor().setShardParent(null);
}
}
// For debugging