Skip to content

Commit

Permalink
Reduce sharding warnings when there are no buffered messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaelhamed authored and web-flow committed May 11, 2021
1 parent fb61262 commit eb0d4dd
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions src/contrib/cluster/Akka.Cluster.Sharding/ShardRegion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -664,11 +664,25 @@ private void Register()
? $"Coordinator [{MembersByAge.First()}] is unreachable."
: $"Coordinator [{MembersByAge.First()}] is reachable.";

Log.Warning("{0}: Trying to register to coordinator at [{1}], but no acknowledgement. Total [{2}] buffered messages. [{3}]",
TypeName,
string.Join(", ", actorSelections.Select(i => i.PathString)),
TotalBufferSize,
coordinatorMessage);
var bufferSize = ShardBuffers.Count;
if (bufferSize > 0)
{
if (Log.IsWarningEnabled)
{
Log.Warning("{0}: Trying to register to coordinator at [{1}], but no acknowledgement. Total [{2}] buffered messages. [{3}]",
TypeName,
string.Join(", ", actorSelections.Select(i => i.PathString)),
TotalBufferSize,
coordinatorMessage);
}
}
else if (Log.IsDebugEnabled)
{
Log.Debug("{0}: Trying to register to coordinator at [{1}], but no acknowledgement. No buffered messages yet. [{2}]",
TypeName,
string.Join(", ", actorSelections.Select(i => i.PathString)),
coordinatorMessage);
}
}
else
{
Expand All @@ -678,8 +692,17 @@ private void Register()
? "Has Cluster Sharding been started on every node and nodes been configured with the correct role(s)?"
: "Probably, no seed-nodes configured and manual cluster join not performed?";

Log.Warning("{0}: No coordinator found to register. {1} Total [{2}] buffered messages.",
TypeName, possibleReason, TotalBufferSize);
var bufferSize = ShardBuffers.Count;
if (bufferSize > 0)
{
Log.Warning("{0}: No coordinator found to register. {1} Total [{2}] buffered messages.",
TypeName, possibleReason, TotalBufferSize);
}
else
{
Log.Debug("{0}: No coordinator found to register. {1} No buffered messages yet.",
TypeName, possibleReason);
}
}
}
}
Expand Down

0 comments on commit eb0d4dd

Please sign in to comment.