This commit is contained in:
maoling 2026-07-29 13:36:32 +08:00 committed by GitHub
commit 15eea4f51c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -925,9 +925,13 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean,
if (cms.contains(getBroadcastAddressAndPort()))
return;
double probability = cms.size() / (double) (liveEndpoints.size() + unreachableEndpoints.size());
int totalEndpoints = liveEndpoints.size() + unreachableEndpoints.size();
if (totalEndpoints == 0)
return;
double probability = cms.size() / (double) totalEndpoints;
double randDbl = random.nextDouble();
if (randDbl <= probability)
if (randDbl < probability)
{
logger.trace("Sending GossipDigestSyn to the CMS {}", cms);
sendGossip(message, cms);