From 63e43f1bb47f7bddf3dc37ad03a2bbee6d2a9423 Mon Sep 17 00:00:00 2001 From: Billy Donahue Date: Tue, 6 Nov 2018 16:20:39 -0500 Subject: SERVER-5739 Fix races in RARELY/OCCASIONALLY. Switch to using C++ instead of macros. Fix SERVER-37247: these should fire on first hit. --- src/mongo/db/s/balancer/balancer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/mongo/db/s/balancer') diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp index f5570a52507..86a80ee5032 100644 --- a/src/mongo/db/s/balancer/balancer.cpp +++ b/src/mongo/db/s/balancer/balancer.cpp @@ -360,8 +360,10 @@ void Balancer::_mainThread() { << ", secondaryThrottle: " << balancerConfig->getSecondaryThrottle().toBSON(); - OCCASIONALLY warnOnMultiVersion( - uassertStatusOK(_clusterStats->getStats(opCtx.get()))); + static Occasionally sampler; + if (sampler.tick()) { + warnOnMultiVersion(uassertStatusOK(_clusterStats->getStats(opCtx.get()))); + } Status status = _enforceTagRanges(opCtx.get()); if (!status.isOK()) { -- cgit v1.2.1