satellite/metabase/{meta,segment}loop: fix test flakiness

When the delta is very small from the bounds then the ratio calculation
doesn't work that well. Let's allow 100 from the bounds, since that
would be expected in any case.

We won't add a configuration for it, since it's not that useful.

Change-Id: I049066a42470b825f430b7f32ebe92d544c6cc8b
This commit is contained in:
Egon Elbre 2021-07-02 19:16:11 +03:00
parent 7cbff95090
commit c248651f3f
2 changed files with 12 additions and 0 deletions

View File

@ -429,6 +429,12 @@ func (loop *Service) verifyCount(kind string, before, after, processed int64) er
mon.IntVal("metaloop_verify_" + kind + "_outside").Observe(deltaFromBounds)
mon.FloatVal("metaloop_verify_" + kind + "_outside_ratio").Observe(ratio)
// If we have very few items from the bounds, then it's expected and the ratio does not capture it well.
const minimumDeltaThreshold = 100
if deltaFromBounds < minimumDeltaThreshold {
return nil
}
if ratio > loop.config.SuspiciousProcessedRatio {
return Error.New("%s processed count looks suspicious: before:%v after:%v processed:%v ratio:%v threshold:%v", kind, before, after, processed, ratio, loop.config.SuspiciousProcessedRatio)
}

View File

@ -393,6 +393,12 @@ func (loop *Service) verifyCount(before, after, processed int64) error {
mon.IntVal("segmentloop_verify_outside").Observe(deltaFromBounds)
mon.FloatVal("segmentloop_verify_outside_ratio").Observe(ratio)
// If we have very few items from the bounds, then it's expected and the ratio does not capture it well.
const minimumDeltaThreshold = 100
if deltaFromBounds < minimumDeltaThreshold {
return nil
}
if ratio > loop.config.SuspiciousProcessedRatio {
return Error.New("processed count looks suspicious: before:%v after:%v processed:%v ratio:%v threshold:%v", before, after, processed, ratio, loop.config.SuspiciousProcessedRatio)
}