Permalink
Browse files

Merge pull request #22054 from akka/wip-22053-log-join-retry-patriknw

log join retries, #22053
  • Loading branch information...
2 parents 5c79b81 + 645ae4c commit 180361868cf613e9f94b4d329b3fb7b976b52444 @patriknw patriknw committed on GitHub Jan 9, 2017
Showing with 11 additions and 0 deletions.
  1. +11 −0 akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala
@@ -1209,6 +1209,10 @@ private[cluster] final class FirstSeedNodeProcess(seedNodes: immutable.IndexedSe
remainingSeedNodes foreach { a context.actorSelection(context.parent.path.toStringWithAddress(a)) ! InitJoin }
} else {
// no InitJoinAck received, initialize new cluster by joining myself
+ if (log.isDebugEnabled)
+ log.debug(
+ "Couldn't join other seed nodes, will join myself. seed-nodes=[{}]",
+ seedNodes.mkString(", "))
context.parent ! JoinTo(selfAddress)
context.stop(self)
}
@@ -1262,11 +1266,14 @@ private[cluster] final class JoinSeedNodeProcess(seedNodes: immutable.IndexedSeq
context.setReceiveTimeout(Cluster(context.system).settings.SeedNodeTimeout)
+ var attempt = 0
+
override def preStart(): Unit = self ! JoinSeedNode
def receive = {
case JoinSeedNode
// send InitJoin to all seed nodes (except myself)
+ attempt += 1
seedNodes.collect {
case a if a != selfAddress context.actorSelection(context.parent.path.toStringWithAddress(a))
} foreach { _ ! InitJoin }
@@ -1276,6 +1283,10 @@ private[cluster] final class JoinSeedNodeProcess(seedNodes: immutable.IndexedSeq
context.become(done)
case InitJoinNack(_) // that seed was uninitialized
case ReceiveTimeout
+ if (attempt >= 2)
+ log.warning(
+ "Couldn't join seed nodes after [{}] attmpts, will try again. seed-nodes=[{}]",
+ attempt, seedNodes.filterNot(_ == selfAddress).mkString(", "))
// no InitJoinAck received, try again
self ! JoinSeedNode
}

0 comments on commit 1803618

Please sign in to comment.