Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dbnode] Re-add aggregator doc limit update #3137

Merged
merged 12 commits into from
Feb 9, 2021
11 changes: 8 additions & 3 deletions src/dbnode/storage/index/aggregate_results.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,14 @@ func (r *aggregatedResults) AddFields(batch []AggregateResultsEntry) (int, int)
}
}

docs := 0
numInserts := 0
for _, entry := range batch {
var (
docs int
numInserts int
entry AggregateResultsEntry
)

for idx := 0; idx < len(batch); idx++ {
entry = batch[idx]
r.aggregateOpts.AggregateUsageMetrics.IncTotalFields(1)

if docs >= remainingDocs || numInserts >= remainingInserts {
Expand Down
3 changes: 0 additions & 3 deletions src/dbnode/storage/index/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ func NewBlock(
iopts,
)

aggAdded := opts.InstrumentOptions().MetricsScope().Counter("aggregate-added-counter")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this?

Copy link
Collaborator Author

@arnikola arnikola Feb 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This metric is essentially a copy of the total aggregate results metric here, so not too useful

// NB(bodu): The length of coldMutableSegments is always at least 1.
coldSegs := []*mutableSegments{
newMutableSegments(
Expand All @@ -261,7 +260,6 @@ func NewBlock(
metrics: newBlockMetrics(scope),
logger: iopts.Logger(),
docsLimit: opts.QueryLimits().DocsLimit(),
aggregatedAddedCounter: aggAdded,
}
b.newFieldsAndTermsIteratorFn = newFieldsAndTermsIterator
b.newExecutorWithRLockFn = b.executorWithRLock
Expand Down Expand Up @@ -745,7 +743,6 @@ func (b *block) aggregateWithSpan(

batchedFields = 1
}

}

batch, fieldAppended, termAppended = b.appendFieldAndTermToBatch(batch, field, term, iterateTerms)
Expand Down
3 changes: 1 addition & 2 deletions src/dbnode/storage/index/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1951,8 +1951,7 @@ func TestBlockAggregate(t *testing.T) {
require.Equal(t, tracepoint.BlockAggregate, spans[0].OperationName)

snap := scope.Snapshot()
tallytest.AssertCounterValue(t, 4, snap, "query-limit.total-docs-matched", nil)
tallytest.AssertCounterValue(t, 8, snap, "aggregate-added-counter", nil)
tallytest.AssertCounterValue(t, 3, snap, "query-limit.total-docs-matched", nil)
}

func TestBlockAggregateNotExhaustive(t *testing.T) {
Expand Down