jbampton commented on a change in pull request #2148:
URL: https://github.com/apache/lucene-solr/pull/2148#discussion_r544255531



##########
File path: 
solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java
##########
@@ -161,9 +163,11 @@ void runLeaderProcess(boolean weAreReplacement, int 
pauseBeforeStartMs)
 
     assert shardId != null;
     boolean isAlreadyLeader = false;
+    String currentLeader = null;
     if (zkStateReader.getClusterState() != null &&
         
zkStateReader.getClusterState().getCollection(collection).getSlice(shardId).getReplicas().size()
 < 2) {
       Replica leader = zkStateReader.getLeader(collection, shardId);
+      if(leader != null) currentLeader = leader.getName();

Review comment:
       ```suggestion
         if (leader != null) currentLeader = leader.getName();
   ```

##########
File path: solr/core/src/java/org/apache/solr/cloud/ZkController.java
##########
@@ -1609,12 +1611,41 @@ public void publish(final CoreDescriptor cd, final 
Replica.State state, boolean
       if (updateLastState) {
         cd.getCloudDescriptor().setLastPublished(state);
       }
-      overseerJobQueue.offer(Utils.toJSON(m));
+      DocCollection coll = zkStateReader.getCollection(collection);
+      if(forcePublish || sendToOverseer(coll, coreNodeName)) {
+        overseerJobQueue.offer(Utils.toJSON(m));
+      } else {
+//        if(log.isInfoEnabled()) {

Review comment:
       ```suggestion
   //        if (log.isInfoEnabled()) {
   ```

##########
File path: solr/core/src/java/org/apache/solr/cloud/overseer/NodeMutator.java
##########
@@ -76,7 +80,12 @@
       }
 
       if (needToUpdateCollection) {
-        zkWriteCommands.add(new ZkWriteCommand(collection, 
docCollection.copyWithSlices(slicesCopy)));
+        if(docCollection.isPerReplicaState()) {

Review comment:
       There are more like this

##########
File path: 
solr/core/src/java/org/apache/solr/cloud/overseer/CollectionMutator.java
##########
@@ -136,8 +154,13 @@ public ZkWriteCommand modifyCollection(final ClusterState 
clusterState, ZkNodePr
       return ZkStateWriter.NO_OP;
     }
 
-    return new ZkWriteCommand(coll.getName(),
-        new DocCollection(coll.getName(), coll.getSlicesMap(), m, 
coll.getRouter(), coll.getZNodeVersion(), coll.getZNode()));
+    DocCollection collection = new DocCollection(coll.getName(), 
coll.getSlicesMap(), m, coll.getRouter(), coll.getZNodeVersion(), 
coll.getZNode());
+    if(replicaOps == null){

Review comment:
       ```suggestion
       if (replicaOps == null){
   ```

##########
File path: 
solr/core/src/java/org/apache/solr/cloud/overseer/CollectionMutator.java
##########
@@ -107,7 +111,21 @@ public ZkWriteCommand modifyCollection(final ClusterState 
clusterState, ZkNodePr
     DocCollection coll = 
clusterState.getCollection(message.getStr(COLLECTION_PROP));
     Map<String, Object> m = coll.shallowCopy();
     boolean hasAnyOps = false;
+    PerReplicaStates.WriteOps replicaOps = null;
     for (String prop : 
CollectionAdminRequest.MODIFIABLE_COLLECTION_PROPERTIES) {
+      if(prop.equals(DocCollection.PER_REPLICA_STATE)) {
+         String val = message.getStr(DocCollection.PER_REPLICA_STATE);
+         if(val == null) continue;

Review comment:
       ```suggestion
            if (val == null) continue;
   ```

##########
File path: 
solr/core/src/java/org/apache/solr/cloud/overseer/CollectionMutator.java
##########
@@ -107,7 +111,21 @@ public ZkWriteCommand modifyCollection(final ClusterState 
clusterState, ZkNodePr
     DocCollection coll = 
clusterState.getCollection(message.getStr(COLLECTION_PROP));
     Map<String, Object> m = coll.shallowCopy();
     boolean hasAnyOps = false;
+    PerReplicaStates.WriteOps replicaOps = null;
     for (String prop : 
CollectionAdminRequest.MODIFIABLE_COLLECTION_PROPERTIES) {
+      if(prop.equals(DocCollection.PER_REPLICA_STATE)) {

Review comment:
       ```suggestion
         if (prop.equals(DocCollection.PER_REPLICA_STATE)) {
   ```

##########
File path: 
solr/core/src/java/org/apache/solr/cloud/overseer/CollectionMutator.java
##########
@@ -107,7 +111,21 @@ public ZkWriteCommand modifyCollection(final ClusterState 
clusterState, ZkNodePr
     DocCollection coll = 
clusterState.getCollection(message.getStr(COLLECTION_PROP));
     Map<String, Object> m = coll.shallowCopy();
     boolean hasAnyOps = false;
+    PerReplicaStates.WriteOps replicaOps = null;
     for (String prop : 
CollectionAdminRequest.MODIFIABLE_COLLECTION_PROPERTIES) {
+      if(prop.equals(DocCollection.PER_REPLICA_STATE)) {
+         String val = message.getStr(DocCollection.PER_REPLICA_STATE);
+         if(val == null) continue;
+        boolean enable = Boolean.parseBoolean(val);
+        if(enable == coll.isPerReplicaState()) {

Review comment:
       ```suggestion
           if (enable == coll.isPerReplicaState()) {
   ```

##########
File path: solr/core/src/java/org/apache/solr/cloud/ZkController.java
##########
@@ -1609,12 +1611,41 @@ public void publish(final CoreDescriptor cd, final 
Replica.State state, boolean
       if (updateLastState) {
         cd.getCloudDescriptor().setLastPublished(state);
       }
-      overseerJobQueue.offer(Utils.toJSON(m));
+      DocCollection coll = zkStateReader.getCollection(collection);
+      if(forcePublish || sendToOverseer(coll, coreNodeName)) {

Review comment:
       ```suggestion
         if (forcePublish || sendToOverseer(coll, coreNodeName)) {
   ```

##########
File path: solr/core/src/java/org/apache/solr/cloud/overseer/NodeMutator.java
##########
@@ -76,7 +80,12 @@
       }
 
       if (needToUpdateCollection) {
-        zkWriteCommands.add(new ZkWriteCommand(collection, 
docCollection.copyWithSlices(slicesCopy)));
+        if(docCollection.isPerReplicaState()) {

Review comment:
       ```suggestion
           if (docCollection.isPerReplicaState()) {
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to