Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Ensure we check iterators errors when deduplicating #828

Closed
wants to merge 1 commit into from

Conversation

cyriltovena
Copy link
Collaborator

I suspect this could be the cause for couple of missing errors.

Copy link
Collaborator

@simonswine simonswine left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -261,7 +261,9 @@ func skipDuplicates(ctx context.Context, its []MergeIterator) error {
}
span.LogFields(otlog.Int("duplicates", duplicates))
span.LogFields(otlog.Int("total", total))

for _, it := range its {
errors.Add(it.Err())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not fully sure if that will really cover all bases, in theory Err needs to be called every time Next() of the particular iterator is false. So that probably should happen as part of moveNext() and kept in the tree struct.

Still better than having no errors at all. 🙂

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah this is a very good point. I think We can fix that too let me see.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Checking for each iterators errors on a false next might be expensive if we do this outside of the loser tree.

I'm wondering if we should change the tree to be aware of Err() which it is not right now. @bboreham wanted to ultimately have the same library for all project, but some doesn't have this Err() and this could impact performance.

I'm inclined to have two version and may be use that new version with Err() management in Pyroscope.

WDYT ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes I think it is worth having the extra check. I guess at least Next is most times true, before it is once false for every iterator.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll replace that PR with another one then

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

Successfully merging this pull request may close these issues.

None yet

3 participants