diff --git a/priam/src/main/java/com/netflix/priam/identity/token/DeadTokenRetriever.java b/priam/src/main/java/com/netflix/priam/identity/token/DeadTokenRetriever.java index c961fba1e..1e05e1317 100755 --- a/priam/src/main/java/com/netflix/priam/identity/token/DeadTokenRetriever.java +++ b/priam/src/main/java/com/netflix/priam/identity/token/DeadTokenRetriever.java @@ -94,8 +94,8 @@ public PriamInstance get() throws Exception { || super.isInstanceDummy(priamInstance)) continue; // TODO: If instance is in SHUTTING_DOWN mode, it might not show up in asg // instances (if cloud control plane is having issues), thus, we should not try - // to - // replace the instance as it will lead to "Cannot replace a live node" issue. + // to replace the instance as it will lead to "Cannot replace a live node" + // issue. logger.info("Found dead instance: {}", priamInstance.toString()); @@ -122,7 +122,6 @@ public PriamInstance get() throws Exception { // Lets not replace the instance if gossip info is not merging!! if (replacedIp == null) return null; - logger.info( "Will try to replace token: {} with replacedIp (from gossip info): {} instead of ip from Token database: {}", priamInstance.getToken(), @@ -131,6 +130,10 @@ public PriamInstance get() throws Exception { } catch (GossipParseException e) { // In case of gossip exception, fallback to IP in token database. this.replacedIp = priamInstance.getHostIP(); + logger.info( + "Will try to replace token: {} with replacedIp from Token database: {}", + priamInstance.getToken(), + priamInstance.getHostIP()); } PriamInstance result; @@ -153,7 +156,8 @@ public PriamInstance get() throws Exception { + " , will sleep for " + sleepTime + " millisecs before we retry."); - Thread.currentThread().sleep(sleepTime); + Thread.sleep(sleepTime); + throw ex; } diff --git a/priam/src/main/java/com/netflix/priam/identity/token/TokenRetrieverUtils.java b/priam/src/main/java/com/netflix/priam/identity/token/TokenRetrieverUtils.java index ff08d9d4e..66f151a58 100644 --- a/priam/src/main/java/com/netflix/priam/identity/token/TokenRetrieverUtils.java +++ b/priam/src/main/java/com/netflix/priam/identity/token/TokenRetrieverUtils.java @@ -34,10 +34,11 @@ public class TokenRetrieverUtils { * gossip info. */ public static String inferTokenOwnerFromGossip( - List allIds, String token, String dc) throws GossipParseException { + List allIds, String token, String dc) + throws GossipParseException { // Avoid using dead instance who we are trying to replace (duh!!) // Avoid other regions instances to avoid communication over public ip address. - List eligibleInstances = + List eligibleInstances = allIds.stream() .filter(priamInstance -> !priamInstance.getToken().equalsIgnoreCase(token)) .filter(priamInstance -> priamInstance.getDC().equalsIgnoreCase(dc))