diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/NodeAddedTrigger.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/NodeAddedTrigger.java index 62029448c97..fe49891bd64 100644 --- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/NodeAddedTrigger.java +++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/NodeAddedTrigger.java @@ -69,7 +69,8 @@ public class NodeAddedTrigger extends TriggerBase { List added = stateManager.listData(ZkStateReader.SOLR_AUTOSCALING_NODE_ADDED_PATH); added.forEach(n -> { // don't add nodes that have since gone away - if (lastLiveNodes.contains(n)) { + if (lastLiveNodes.contains(n) && !nodeNameVsTimeAdded.containsKey(n)) { + // since {@code #restoreState(AutoScaling.Trigger)} is called first, the timeAdded for a node may also be restored log.debug("Adding node from marker path: {}", n); nodeNameVsTimeAdded.put(n, cloudManager.getTimeSource().getTimeNs()); } diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/NodeLostTrigger.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/NodeLostTrigger.java index 97e855c86bd..422eac369c6 100644 --- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/NodeLostTrigger.java +++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/NodeLostTrigger.java @@ -69,7 +69,8 @@ public class NodeLostTrigger extends TriggerBase { List lost = stateManager.listData(ZkStateReader.SOLR_AUTOSCALING_NODE_LOST_PATH); lost.forEach(n -> { // don't add nodes that have since came back - if (!lastLiveNodes.contains(n)) { + if (!lastLiveNodes.contains(n) && !nodeNameVsTimeRemoved.containsKey(n)) { + // since {@code #restoreState(AutoScaling.Trigger)} is called first, the timeRemoved for a node may also be restored log.debug("Adding lost node from marker path: {}", n); nodeNameVsTimeRemoved.put(n, cloudManager.getTimeSource().getTimeNs()); } diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java index 0227cda07b6..8314b8d64d7 100644 --- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java +++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java @@ -297,9 +297,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase { } @Test - // commented 20-July-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") - // commented 4-Sep-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 09-Aug-2018 - @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 14-Oct-2018 + // commentted 190-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 14-Oct-2018 public void testNodeLostTriggerRestoreState() throws Exception { // for this test we want to update the trigger so we must assert that the actions were created twice actionInitCalled = new CountDownLatch(2);