Suggest ClusterSharding hasn't been started in log message (#25177)
This commit is contained in:
parent
5c401584c3
commit
d03f21a35a
2 changed files with 64 additions and 2 deletions
|
|
@ -10,7 +10,6 @@ import scala.collection.immutable
|
||||||
import scala.concurrent.Future
|
import scala.concurrent.Future
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
import scala.util.Success
|
import scala.util.Success
|
||||||
|
|
||||||
import akka.actor._
|
import akka.actor._
|
||||||
import akka.actor.DeadLetterSuppression
|
import akka.actor.DeadLetterSuppression
|
||||||
import akka.cluster.Cluster
|
import akka.cluster.Cluster
|
||||||
|
|
@ -953,7 +952,7 @@ class DDataShardCoordinator(typeName: String, settings: ClusterShardingSettings,
|
||||||
|
|
||||||
case GetFailure(CoordinatorStateKey, _) ⇒
|
case GetFailure(CoordinatorStateKey, _) ⇒
|
||||||
log.error(
|
log.error(
|
||||||
"The ShardCoordinator was unable to get an initial state within 'waiting-for-state-timeout': {} millis (retrying)",
|
"The ShardCoordinator was unable to get an initial state within 'waiting-for-state-timeout': {} millis (retrying). Has ClusterSharding been started on all nodes?",
|
||||||
readMajority.timeout.toMillis)
|
readMajority.timeout.toMillis)
|
||||||
// repeat until GetSuccess
|
// repeat until GetSuccess
|
||||||
getCoordinatorState()
|
getCoordinatorState()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2017-2018 Lightbend Inc. <https://www.lightbend.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package akka.cluster.sharding
|
||||||
|
|
||||||
|
import akka.cluster.MultiNodeClusterSpec
|
||||||
|
import akka.remote.testkit.{ MultiNodeConfig, MultiNodeSpec }
|
||||||
|
import akka.testkit._
|
||||||
|
import com.typesafe.config.ConfigFactory
|
||||||
|
|
||||||
|
object ClusterShardingIncorrectSetupSpecConfig extends MultiNodeConfig {
|
||||||
|
val first = role("first")
|
||||||
|
val second = role("second")
|
||||||
|
|
||||||
|
val commonConfig = ConfigFactory.parseString(
|
||||||
|
"""
|
||||||
|
akka.loglevel = INFO
|
||||||
|
akka.cluster.sharding {
|
||||||
|
waiting-for-state-timeout = 100ms
|
||||||
|
}
|
||||||
|
""".stripMargin)
|
||||||
|
|
||||||
|
commonConfig(commonConfig.withFallback(MultiNodeClusterSpec.clusterConfig))
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClusterShardingIncorrectSetupMultiJvmNode1 extends ClusterShardingIncorrectSetupSpec
|
||||||
|
class ClusterShardingIncorrectSetupMultiJvmNode2 extends ClusterShardingIncorrectSetupSpec
|
||||||
|
|
||||||
|
object ClusterShardingIncorrectSetupSpec {
|
||||||
|
val extractEntityId: ShardRegion.ExtractEntityId = {
|
||||||
|
case id: Int ⇒ (id.toString, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
val extractShardId: ShardRegion.ExtractShardId = {
|
||||||
|
case id: Int ⇒ id.toString
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class ClusterShardingIncorrectSetupSpec extends MultiNodeSpec(ClusterShardingIncorrectSetupSpecConfig) with MultiNodeClusterSpec with ImplicitSender {
|
||||||
|
|
||||||
|
import ClusterShardingIncorrectSetupSpec._
|
||||||
|
import ClusterShardingIncorrectSetupSpecConfig._
|
||||||
|
|
||||||
|
"Cluster sharding" must {
|
||||||
|
"log useful error message if sharding not started" in {
|
||||||
|
awaitClusterUp(roles: _*)
|
||||||
|
enterBarrier("cluster-up")
|
||||||
|
runOn(first) {
|
||||||
|
EventFilter.error(pattern = """Has ClusterSharding been started on all nodes?""").intercept {
|
||||||
|
ClusterSharding(system).start(
|
||||||
|
typeName = "Entity",
|
||||||
|
entityProps = TestActors.echoActorProps,
|
||||||
|
settings = ClusterShardingSettings(system),
|
||||||
|
extractEntityId = extractEntityId,
|
||||||
|
extractShardId = extractShardId)
|
||||||
|
}
|
||||||
|
enterBarrier("helpful error message logged")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue