lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tflo...@apache.org
Subject lucene-solr:jira/solr-10233: Some code cleanup
Date Fri, 28 Apr 2017 22:53:20 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-10233 0f9baa491 -> e7c8cec61


Some code cleanup


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/e7c8cec6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e7c8cec6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e7c8cec6

Branch: refs/heads/jira/solr-10233
Commit: e7c8cec61c5b27bd9ce40eaa29a2f621a0bf2640
Parents: 0f9baa4
Author: Tomas Fernandez Lobbe <tflobbe@apache.org>
Authored: Fri Apr 28 15:53:12 2017 -0700
Committer: Tomas Fernandez Lobbe <tflobbe@apache.org>
Committed: Fri Apr 28 15:53:12 2017 -0700

----------------------------------------------------------------------
 .../org/apache/solr/cloud/CloudDescriptor.java     |  1 -
 .../org/apache/solr/cloud/CreateCollectionCmd.java | 14 ++++++--------
 .../cloud/OverseerCollectionMessageHandler.java    |  4 +++-
 .../org/apache/solr/cloud/RecoveryStrategy.java    |  2 +-
 .../java/org/apache/solr/cloud/SplitShardCmd.java  |  2 +-
 .../java/org/apache/solr/cloud/ZkController.java   | 17 ++++++++---------
 .../apache/solr/cloud/overseer/ReplicaMutator.java |  4 ++--
 .../apache/solr/cloud/overseer/SliceMutator.java   |  6 ++----
 .../apache/solr/cloud/overseer/ZkStateWriter.java  |  2 +-
 .../java/org/apache/solr/core/CoreContainer.java   |  3 ++-
 .../solr/handler/admin/CoreAdminHandler.java       |  2 --
 .../handler/component/RealTimeGetComponent.java    |  1 +
 .../apache/solr/update/DefaultSolrCoreState.java   | 10 +++-------
 .../java/org/apache/solr/update/UpdateCommand.java |  1 -
 .../processor/DistributedUpdateProcessor.java      |  1 -
 .../test/org/apache/solr/cloud/OverseerTest.java   |  4 ++--
 .../java/org/apache/solr/common/cloud/Slice.java   |  2 +-
 .../apache/solr/common/cloud/ZkStateReader.java    |  2 +-
 .../apache/solr/common/params/CoreAdminParams.java |  2 +-
 .../solr/cloud/AbstractDistribZkTestBase.java      |  3 ---
 20 files changed, 35 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java b/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java
index c39272c..1f387ad 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java
@@ -64,7 +64,6 @@ public class CloudDescriptor {
     if (Strings.isNullOrEmpty(nodeName))
       this.nodeName = null;
     this.numShards = PropertiesUtil.toInteger(props.getProperty(CloudDescriptor.NUM_SHARDS),
null);
-    System.out.println("ReplicaType: " + props);
     this.replicaType = Replica.Type.valueOf(props.getProperty(CloudDescriptor.REPLICA_TYPE,
Replica.Type.REALTIME.toString()));
     for (String propName : props.stringPropertyNames()) {
       if (propName.startsWith(ZkController.COLLECTION_PARAM_PREFIX)) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java b/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
index 4b6971e..2cc3310 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
@@ -136,20 +136,19 @@ public class CreateCollectionCmd implements Cmd {
 
         positionVsNodes = new HashMap<>();
       } else {
-        if (numRealtimeReplicas > nodeList.size()) {
-          log.warn("Specified "
-              + REALTIME_REPLICAS
-              + " of "
-              + numRealtimeReplicas
+        int totalNumReplicas = numRealtimeReplicas + numAppendReplicas + numPassiveReplicas;
+        if (totalNumReplicas > nodeList.size()) {
+          log.warn("Specified number of replicas of "
+              + totalNumReplicas
               + " on collection "
               + collectionName
-              + " is higher than or equal to the number of Solr instances currently live
or live and part of your " + CREATE_NODE_SET + "("
+              + " is higher than the number of Solr instances currently live or live and
part of your " + CREATE_NODE_SET + "("
               + nodeList.size()
               + "). It's unusual to run two replica of the same slice on the same Solr-instance.");
         }
 
         int maxShardsAllowedToCreate = maxShardsPerNode * nodeList.size();
-        int requestedShardsToCreate = numSlices * (numRealtimeReplicas + numPassiveReplicas
+ numAppendReplicas);
+        int requestedShardsToCreate = numSlices * totalNumReplicas;
         if (maxShardsAllowedToCreate < requestedShardsToCreate) {
           throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Cannot create collection
" + collectionName + ". Value of "
               + MAX_SHARDS_PER_NODE + " is " + maxShardsPerNode
@@ -239,7 +238,6 @@ public class CreateCollectionCmd implements Cmd {
         params.set(CoreAdminParams.SHARD, position.shard);
         params.set(ZkStateReader.NUM_SHARDS_PROP, numSlices);
         params.set(CoreAdminParams.NEW_COLLECTION, "true");
-        // This is used to tell the CoreAdminHandler that the new core doesn't need a tlog
in case of passive replicas
         params.set(CoreAdminParams.REPLICA_TYPE, position.type.name());
 
         if (async != null) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java
b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java
index 4cae785..5b12380 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java
@@ -156,10 +156,12 @@ public class OverseerCollectionMessageHandler implements OverseerMessageHandler
 
   static final String SKIP_CREATE_REPLICA_IN_CLUSTER_STATE = "skipCreateReplicaInClusterState";
 
-  //nocommit: review
   public static final Map<String, Object> COLL_PROPS = Collections.unmodifiableMap(makeMap(
       ROUTER, DocRouter.DEFAULT_NAME,
       ZkStateReader.REPLICATION_FACTOR, "1",
+      ZkStateReader.REALTIME_REPLICAS, "1",
+      ZkStateReader.APPEND_REPLICAS, "0",
+      ZkStateReader.PASSIVE_REPLICAS, "0",
       ZkStateReader.MAX_SHARDS_PER_NODE, "1",
       ZkStateReader.AUTO_ADD_REPLICAS, "false",
       DocCollection.RULE, null,

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
index 5a952ea..53b6f3e 100644
--- a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
+++ b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
@@ -262,7 +262,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
       ureq.setParams(new ModifiableSolrParams());
       ureq.getParams().set(DistributedUpdateProcessor.COMMIT_END_POINT, true);
 //      ureq.getParams().set(UpdateParams.OPEN_SEARCHER, onlyLeaderIndexes);// nocommit:
Why do we need to open searcher if "onlyLeaderIndexes"?
-      ureq.getParams().set(UpdateParams.OPEN_SEARCHER, true);
+      ureq.getParams().set(UpdateParams.OPEN_SEARCHER, false);
       ureq.setAction(AbstractUpdateRequest.ACTION.COMMIT, false, true).process(
           client);
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/cloud/SplitShardCmd.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/SplitShardCmd.java b/solr/core/src/java/org/apache/solr/cloud/SplitShardCmd.java
index 837af79..b9494ed 100644
--- a/solr/core/src/java/org/apache/solr/cloud/SplitShardCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/SplitShardCmd.java
@@ -205,7 +205,7 @@ public class SplitShardCmd implements Cmd {
       for (int i = 0; i < subRanges.size(); i++) {
         String subSlice = slice + "_" + i;
         subSlices.add(subSlice);
-        String subShardName = collectionName + "_" + subSlice + "_replica1";
+        String subShardName = Assign.buildCoreName(collectionName, subSlice, Replica.Type.REALTIME,
1);
         subShardNames.add(subShardName);
       }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/cloud/ZkController.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index b239dd2..e4e98da 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -892,7 +892,7 @@ public class ZkController {
         if (replica == null || replica.getType() != Type.PASSIVE) {
           joinElection(desc, afterExpiration, joinAtHead);
         } else if (replica.getType() == Type.PASSIVE) {
-          log.debug("Replica {} skipping election because replica is passive", coreZkNodeName);
+          log.debug("Replica {} skipping election because it's type is {}", coreZkNodeName,
Type.PASSIVE);
           startReplicationFromLeader(coreName, false);
         }
       } catch (InterruptedException e) {
@@ -923,15 +923,15 @@ public class ZkController {
         // leader election perhaps?
         
         UpdateLog ulog = core.getUpdateHandler().getUpdateLog();
-        boolean isReplicaInOnlyLeaderIndexes = replicaType == Replica.Type.APPEND &&
!isLeader;
-        if (isReplicaInOnlyLeaderIndexes) {
+        boolean isAppendAndNotLeader = replicaType == Replica.Type.APPEND && !isLeader;
+        if (isAppendAndNotLeader) {
           String commitVersion = ReplicateFromLeader.getCommitVersion(core);
           if (commitVersion != null) {
             ulog.copyOverOldUpdates(Long.parseLong(commitVersion));
           }
         }
         // we will call register again after zk expiration and on reload
-        if (!afterExpiration && !core.isReloaded() && ulog != null &&
!isReplicaInOnlyLeaderIndexes) {
+        if (!afterExpiration && !core.isReloaded() && ulog != null &&
!isAppendAndNotLeader) {
           // disable recovery in case shard is in construction state (for shard splits)
           Slice slice = getClusterState().getSlice(collection, shardId);
           if (slice.getState() != Slice.State.CONSTRUCTION || !isLeader) {
@@ -950,7 +950,7 @@ public class ZkController {
         boolean didRecovery
             = checkRecovery(recoverReloadedCores, isLeader, skipRecovery, collection, coreZkNodeName,
core, cc, afterExpiration);
         if (!didRecovery) {
-          if (isReplicaInOnlyLeaderIndexes) {
+          if (isAppendAndNotLeader) {
             startReplicationFromLeader(coreName, true);
           }
           publish(desc, Replica.State.ACTIVE);
@@ -969,7 +969,7 @@ public class ZkController {
   }
 
   public void startReplicationFromLeader(String coreName, boolean switchTransactionLog) throws
InterruptedException {
-    log.info(coreName + " starting replication from leader");
+    log.info("{} starting replication from leader", coreName);
     ReplicateFromLeader replicateFromLeader = new ReplicateFromLeader(cc, coreName);
     if (replicateFromLeaders.putIfAbsent(coreName, replicateFromLeader) == null) {
       replicateFromLeader.startReplication(switchTransactionLog);
@@ -979,7 +979,7 @@ public class ZkController {
   }
 
   public void stopReplicationFromLeader(String coreName) {
-    log.info(coreName + " stopping replication from leader");
+    log.info("{} stopping replication from leader", coreName);
     ReplicateFromLeader replicateFromLeader = replicateFromLeaders.remove(coreName);
     if (replicateFromLeader != null) {
       replicateFromLeader.stopReplication();
@@ -1203,7 +1203,7 @@ public class ZkController {
       if (state != Replica.State.DOWN) {
         final Replica.State lirState = getLeaderInitiatedRecoveryState(collection, shardId,
coreNodeName);
         if (lirState != null) {
-          assert cd.getCloudDescriptor().getReplicaType() != Replica.Type.PASSIVE;
+          assert cd.getCloudDescriptor().getReplicaType() != Replica.Type.PASSIVE: "LIR should
not happen for passive replicas!";
           if (state == Replica.State.ACTIVE) {
             // trying to become active, so leader-initiated state must be recovering
             if (lirState == Replica.State.RECOVERING) {
@@ -1378,7 +1378,6 @@ public class ZkController {
       final String shardId = zkStateReader.getClusterState().getShardId(cd.getCollectionName(),
getNodeName(), cd.getName());
       if (shardId != null) {
         cd.getCloudDescriptor().setShardId(shardId);
-        log.debug("Shard ID is {} for core {} ", shardId, cd.getName());
         return;
       }
       try {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/cloud/overseer/ReplicaMutator.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/overseer/ReplicaMutator.java b/solr/core/src/java/org/apache/solr/cloud/overseer/ReplicaMutator.java
index c467405..9758c8f 100644
--- a/solr/core/src/java/org/apache/solr/cloud/overseer/ReplicaMutator.java
+++ b/solr/core/src/java/org/apache/solr/cloud/overseer/ReplicaMutator.java
@@ -313,7 +313,7 @@ public class ReplicaMutator {
 
     Replica replica = new Replica(coreNodeName, replicaProps);
     
-    log.debug("Will update state for replica: " + replica);
+    log.debug("Will update state for replica: {}", replica);
 
     Map<String, Object> sliceProps = null;
     Map<String, Replica> replicas;
@@ -335,7 +335,7 @@ public class ReplicaMutator {
     slice = new Slice(sliceName, replicas, sliceProps);
 
     DocCollection newCollection = CollectionMutator.updateSlice(collectionName, collection,
slice);
-    log.debug("Collection is now: " + newCollection);
+    log.debug("Collection is now: {}", newCollection);
     return new ZkWriteCommand(collectionName, newCollection);
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/cloud/overseer/SliceMutator.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/overseer/SliceMutator.java b/solr/core/src/java/org/apache/solr/cloud/overseer/SliceMutator.java
index b1e9691..5436998 100644
--- a/solr/core/src/java/org/apache/solr/cloud/overseer/SliceMutator.java
+++ b/solr/core/src/java/org/apache/solr/cloud/overseer/SliceMutator.java
@@ -67,8 +67,6 @@ public class SliceMutator {
       return ZkStateWriter.NO_OP;
     }
     String coreNodeName = Assign.assignNode(collection);
-//    Replica replica = new Replica(coreNodeName,
-    // coreNodeName overlaps?
     Replica replica = new Replica(coreNodeName,
         makeMap(
             ZkStateReader.CORE_NAME_PROP, message.getStr(ZkStateReader.CORE_NAME_PROP),
@@ -257,8 +255,8 @@ public class SliceMutator {
       replicasCopy.put(replica.getName(), replica);
     }
     Slice newSlice = new Slice(slice.getName(), replicasCopy, slice.getProperties());
-    log.info("Old Slice: " + slice);
-    log.info("New Slice: " + newSlice);
+    log.debug("Old Slice: {}", slice);
+    log.debug("New Slice: {}", newSlice);
     return CollectionMutator.updateSlice(collection.getName(), collection, newSlice);
   }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java b/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
index a906b86..880c5ac 100644
--- a/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
+++ b/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
@@ -268,7 +268,7 @@ public class ZkStateWriter {
       }
     }
 
-    log.debug("New Cluster State is: " + clusterState);
+    log.trace("New Cluster State is: {}", clusterState);
     return clusterState;
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/core/CoreContainer.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index a4f15f7..773c50c 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -1280,7 +1280,8 @@ public class CoreContainer {
     if (zkSys.getZkController() != null) {
       // cancel recovery in cloud mode
       core.getSolrCoreState().cancelRecovery();
-      if (core.getCoreDescriptor().getCloudDescriptor().getReplicaType() == Replica.Type.PASSIVE)
{ // TODO: Also for Replica.Type.ACTIVE? 
+      if (core.getCoreDescriptor().getCloudDescriptor().getReplicaType() == Replica.Type.PASSIVE
+          || core.getCoreDescriptor().getCloudDescriptor().getReplicaType() == Replica.Type.APPEND)
{ 
         // Stop replication if this is part of a passive replica before closing the code
         zkSys.getZkController().stopReplicationFromLeader(name);
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
index 31ad4f7..1710da9 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
@@ -171,9 +171,7 @@ public class CoreAdminHandler extends RequestHandlerBase implements PermissionNa
 
       final CallInfo callInfo = new CallInfo(this, req, rsp, op);
       if (taskId == null) {
-        log.info("Starting Operation: " + req);
         callInfo.call();
-        log.info("Done with Operation: " + req);
       } else {
         try {
           MDC.put("CoreAdminHandler.asyncId", taskId);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java
b/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java
index c4ee76b..d785868 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java
@@ -108,6 +108,7 @@ public class RealTimeGetComponent extends SearchComponent
 
     if (req.getCore().getCoreDescriptor().getCloudDescriptor() != null 
         && !req.getCore().getCoreDescriptor().getCloudDescriptor().requiresTransactionLog())
{
+      //nocommit: forward request to leader
       return;
     }
     

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java b/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
index f19b2df..bc2afa8 100644
--- a/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
+++ b/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
@@ -16,7 +16,6 @@
  */
 package org.apache.solr.update;
 
-import java.io.Closeable;
 import java.io.IOException;
 import java.lang.invoke.MethodHandles;
 import java.util.concurrent.ExecutionException;
@@ -33,8 +32,8 @@ import org.apache.lucene.index.MergePolicy;
 import org.apache.lucene.search.Sort;
 import org.apache.solr.cloud.ActionThrottle;
 import org.apache.solr.cloud.RecoveryStrategy;
-import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
+import org.apache.solr.common.SolrException;
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.CoreDescriptor;
 import org.apache.solr.core.DirectoryFactory;
@@ -66,8 +65,7 @@ public final class DefaultSolrCoreState extends SolrCoreState implements
Recover
   private DirectoryFactory directoryFactory;
   private final RecoveryStrategy.Builder recoveryStrategyBuilder;
 
-  private volatile RecoveryStrategy recoveryStrat; //nocommit: Make interface
-//  private volatile Thread recoveryStrat;
+  private volatile RecoveryStrategy recoveryStrat;
 
   private volatile boolean lastReplicationSuccess = true;
 
@@ -367,11 +365,9 @@ public final class DefaultSolrCoreState extends SolrCoreState implements
Recover
   public void cancelRecovery() {
     if (recoveryStrat != null) {
       try {
-        ((Closeable)recoveryStrat).close();
+        recoveryStrat.close();
       } catch (NullPointerException e) {
         // okay
-      } catch (IOException e) {
-        // okay
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/update/UpdateCommand.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/UpdateCommand.java b/solr/core/src/java/org/apache/solr/update/UpdateCommand.java
index 6c0fc50..b124271 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateCommand.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateCommand.java
@@ -34,7 +34,6 @@ public abstract class UpdateCommand implements Cloneable {
   public static int PEER_SYNC    = 0x00000004; // update command is a missing update being
provided by a peer.
   public static int IGNORE_AUTOCOMMIT = 0x00000008; // this update should not count toward
triggering of autocommits.
   public static int CLEAR_CACHES = 0x00000010; // clear caches associated with the update
log.  used when applying reordered DBQ updates when doing an add.
-  // TODO: rename to something like "APPEND_REPLICAS_IGNORE_IW", or maybe just "FROM_LEADER"?
   public static int IGNORE_INDEXWRITER = 0x00000020;
 
   public UpdateCommand(SolrQueryRequest req) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
index 41fde18..52cb034 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
@@ -1979,7 +1979,6 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor
{
       
       for (Entry<String,Replica> entry : shardMap.entrySet()) {
         if (!types.contains(entry.getValue().getType())) {
-          log.info("getCollectionUrls: Skipping replica " + entry.getValue().getName());//nocommit:
too verbose
           continue;
         }
         ZkCoreNodeProps nodeProps = new ZkCoreNodeProps(entry.getValue());

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
index f5c5db0..b0721a2 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
@@ -1210,7 +1210,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
           ZkStateReader.STATE_PROP, Replica.State.RECOVERING.toString());
 
       q.offer(Utils.toJSON(m));
-      
+
 
       m = new ZkNodeProps(Overseer.QUEUE_OPERATION, OverseerAction.STATE.toLower(),
           ZkStateReader.BASE_URL_PROP, "http://127.0.0.1/solr",
@@ -1221,7 +1221,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
           ZkStateReader.STATE_PROP, Replica.State.ACTIVE.toString());
 
       q.offer(Utils.toJSON(m));
-      
+
       Stat stat = new Stat();
       byte[] data = zkClient.getData("/clusterstate.json", null, stat, true);
       // Simulate an external modification

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java b/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
index 2cd716c..3f84e1e 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
@@ -205,7 +205,7 @@ public class Slice extends ZkNodeProps implements Iterable<Replica>
{
   private Replica findLeader() {
     for (Replica replica : replicas.values()) {
       if (replica.getStr(LEADER) != null) {
-        assert replica.getType() == Type.APPEND || replica.getType() == Type.REALTIME;
+        assert replica.getType() == Type.APPEND || replica.getType() == Type.REALTIME: "Passive
replica should not become leader!";
         return replica;
       }
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index af7ab26..625230f 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -791,7 +791,7 @@ public class ZkStateReader implements Closeable {
   
   public List<ZkCoreNodeProps> getReplicaProps(String collection, String shardId, String
thisCoreNodeName,
       Replica.State mustMatchStateFilter, Replica.State mustNotMatchStateFilter) {
-    //nocommit
+    //nocommit: We don't need all these getReplicaProps overloading. Also, it's odd that
the default is to return replicas of type APPEND and REALTIME only
     return getReplicaProps(collection, shardId, thisCoreNodeName, mustMatchStateFilter, null,
EnumSet.of(Replica.Type.APPEND,  Replica.Type.REALTIME));
   }
   

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java b/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java
index e64892d..3fc6157 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/CoreAdminParams.java
@@ -129,7 +129,7 @@ public abstract class CoreAdminParams
   public static final String NEW_COLLECTION = "newCollection";
 
   /**
-   * Tells the CoreAdminHandler that the new Core will be a replica of this type. 
+   * Tells the CoreAdminHandler that the new Core will be a replica of a particular {@link
org.apache.solr.common.cloud.Replica.Type}
    */
   public static final String REPLICA_TYPE = "replicaType";
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7c8cec6/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
index e5d2619..7141eed 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
@@ -258,7 +258,6 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes
     int maxIterations = 100;
     Replica.State coreState = null;
     while(maxIterations-->0) {
-      System.out.println("ClusterState" + reader.getClusterState());
       Slice slice = reader.getClusterState().getSlice(collection, shard);
       if(slice!=null) {
         Replica replica = slice.getReplicasMap().get(coreNodeName);
@@ -267,8 +266,6 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes
           if(coreState == expectedState) {
             return;
           }
-        } else {
-          System.out.println(slice.getReplicasMap());
         }
       }
       Thread.sleep(50);


Mime
View raw message