Quieter logging for ShardCoordinator initialization (#30488)

* Log the first retry on 'info', then 'warning', and finally 'error'
This commit is contained in:
Arnout Engelen 2021-08-18 10:05:24 +02:00 committed by GitHub
parent 6b71804de3
commit 51924f5026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1432,6 +1432,7 @@ private[akka] class DDataShardCoordinator(
private var terminating = false
private var getShardHomeRequests: Set[(ActorRef, GetShardHome)] = Set.empty
private var initialStateRetries = 0
private val rememberEntitiesStore =
rememberEntitiesStoreProvider.map { provider =>
@ -1468,10 +1469,16 @@ private[akka] class DDataShardCoordinator(
onInitialState(existingState, rememberedShards)
case GetFailure(CoordinatorStateKey, _) =>
log.error(
"{}: The ShardCoordinator was unable to get an initial state within 'waiting-for-state-timeout': {} millis (retrying). Has ClusterSharding been started on all nodes?",
typeName,
stateReadConsistency.timeout.toMillis)
initialStateRetries += 1
val template =
"{}: The ShardCoordinator was unable to get an initial state within 'waiting-for-state-timeout': {} millis (retrying). Has ClusterSharding been started on all nodes?"
if (initialStateRetries == 1)
log.info(template, typeName, stateReadConsistency.timeout.toMillis)
else if (initialStateRetries < 5)
log.warning(template, typeName, stateReadConsistency.timeout.toMillis)
else
log.error(template, typeName, stateReadConsistency.timeout.toMillis)
// repeat until GetSuccess
getCoordinatorState()