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] wrong metrics calculation for block iterator #3623

Closed
asafm opened this issue Jul 26, 2021 · 0 comments · Fixed by #3624
Closed

[dbnode] wrong metrics calculation for block iterator #3623

asafm opened this issue Jul 26, 2021 · 0 comments · Fixed by #3624

Comments

@asafm
Copy link
Contributor

asafm commented Jul 26, 2021

@ryanhall07 @robskillington Just verifying with you as I read this code multiple times, and I think I found a bug:
size is the number of elements in results as effectively returned originally here:

func (r *results) AddDocuments(batch []doc.Document) (int, int, error) {
	r.Lock()
	err := r.addDocumentsBatchWithLock(batch)
	size := r.resultsMap.Len()
	docsCount := r.totalDocsCount + len(batch)
	r.totalDocsCount = docsCount
	r.Unlock()
	return size, docsCount, err
}

Since results only keeps growing, as I haven't seen any reset to this object, it means that when you call iter.Counts() to get the seriesMatched, you will get a wrong number, since the AddSeries(size) keeping adding up total and not adding delta. Maybe the correct way is to measure results before adding and after to get that delta?

Originally posted by @asafm in #3269 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant