From b7fcf00c776a7a04d0b45c1f6c0099cf9bd20885 Mon Sep 17 00:00:00 2001 From: tsaichristine Date: Fri, 6 Dec 2019 18:40:47 -0800 Subject: [PATCH] Remove data dropping as an invalid bucket case ValueMetric's #dropData function flushes and clears the current bucket only if the drop time coincides with the end of the bucket. Otherwise, if the current bucket is a partial bucket, we keep this bucket for further aggregation so it should not be marked invalid. Test: bit statsd_test:* Bug: 145918755 Change-Id: I73bccf8fe9e223bd7927fffe2f1665744ae1b452 --- cmds/statsd/src/metrics/ValueMetricProducer.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmds/statsd/src/metrics/ValueMetricProducer.cpp b/cmds/statsd/src/metrics/ValueMetricProducer.cpp index eb78ebc521e1c..975a230df7659 100644 --- a/cmds/statsd/src/metrics/ValueMetricProducer.cpp +++ b/cmds/statsd/src/metrics/ValueMetricProducer.cpp @@ -183,11 +183,9 @@ void ValueMetricProducer::onSlicedConditionMayChangeLocked(bool overallCondition void ValueMetricProducer::dropDataLocked(const int64_t dropTimeNs) { StatsdStats::getInstance().noteBucketDropped(mMetricId); - // We are going to flush the data without doing a pull first so we need to invalidte the data. - bool pullNeeded = mIsPulled && mCondition == ConditionState::kTrue; - if (pullNeeded) { - invalidateCurrentBucket(); - } + + // The current partial bucket is not flushed and does not require a pull, + // so the data is still valid. flushIfNeededLocked(dropTimeNs); clearPastBucketsLocked(dropTimeNs); }