You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2021/03/12 05:18:52 UTC

[lucene-solr] branch reference_impl updated: @1464 Don't screw up ids.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/reference_impl by this push:
     new 6d5b4c7  @1464 Don't screw up ids.
6d5b4c7 is described below

commit 6d5b4c77fc34f20c5e6fdf6b7a3f82a5b22c1ad1
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Mar 11 23:18:37 2021 -0600

    @1464 Don't screw up ids.
    
    Took 5 minutes
---
 .../org/apache/solr/cloud/overseer/ZkStateWriter.java | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

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 701d367..92eef59 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
@@ -215,15 +215,14 @@ public class ZkStateWriter {
                     continue;
                   } else {
                     if (log.isDebugEnabled()) log.debug("state cmd entry {} asOverseerCmd={}", entry, OverseerAction.get(entry.getKey()));
-                    String fullId = entry.getKey();
-                    String id = fullId.substring(fullId.indexOf("-") + 1);
+                    String id = entry.getKey();
 
                     String stateString = (String) entry.getValue();
                     if (log.isDebugEnabled()) {
                       log.debug("stateString={}", stateString);
                     }
 
-                    long collectionId = Long.parseLong(fullId.split("-")[0]);
+                    long collectionId = Long.parseLong(id.split("-")[0]);
                     String collection = idToCollection.get(collectionId);
                     if (collection == null) {
                       log.info("collection for id={} is null", collectionId);
@@ -266,7 +265,7 @@ public class ZkStateWriter {
                           dirtyState.add(docColl.getName());
                           blockedNodes.add((String) entry.getValue());
                           StateUpdate update = new StateUpdate();
-                          update.id = replica.getInternalId();
+                          update.id = replica.getId();
                           update.state = Replica.State.getShortState(Replica.State.DOWN);
                           updates.add(update);
 
@@ -288,7 +287,7 @@ public class ZkStateWriter {
                           dirtyState.add(docColl.getName());
                           //   blockedNodes.add((String) entry.getValue());
                           StateUpdate update = new StateUpdate();
-                          update.id = replica.getInternalId();
+                          update.id = replica.getId();
                           update.state = Replica.State.getShortState(Replica.State.RECOVERING);
                           updates.add(update);
                         }
@@ -394,7 +393,7 @@ public class ZkStateWriter {
                           r.getProperties().remove("leader");
                         }
                       }
-                      updates.getProperties().put(replica.getInternalId(), "l");
+                      updates.getProperties().put(replica.getId(), "l");
                       dirtyState.add(collection);
                     } else {
                       Replica.State s = Replica.State.getState(setState);
@@ -402,7 +401,7 @@ public class ZkStateWriter {
                       if (existingLeader != null && existingLeader.getName().equals(replica.getName())) {
                         docColl.getSlice(replica).setLeader(null);
                       }
-                      updates.getProperties().put(replica.getInternalId(), Replica.State.getShortState(s));
+                      updates.getProperties().put(replica.getId(), Replica.State.getShortState(s));
                       log.debug("set state {} {}", state, replica);
                       replica.setState(s);
                       dirtyState.add(collection);
@@ -436,7 +435,7 @@ public class ZkStateWriter {
               }
               updateMap.getProperties().put("_cs_ver_", ver.toString());
               for (StateUpdate theUpdate : entry.getValue()) {
-                updateMap.getProperties().put(theUpdate.id, theUpdate.state);
+                updateMap.getProperties().put(theUpdate.id.substring(theUpdate.id.indexOf("-") + 1), theUpdate.state);
               }
 
             } finally {
@@ -444,9 +443,7 @@ public class ZkStateWriter {
             }
           }
         }
-
-
-
+        
       } catch (Exception e) {
         log.error("Exception while queuing update", e);
         throw e;