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

Fixes iterator At value re-used #845

Merged
merged 3 commits into from
Jul 12, 2023
Merged

Fixes iterator At value re-used #845

merged 3 commits into from
Jul 12, 2023

Conversation

cyriltovena
Copy link
Collaborator

@cyriltovena cyriltovena commented Jul 12, 2023

This is a refactoring a bit how we deal with RowReader but also fixes a bug where we were re-used the At of the inner iterator inside the RowReader.

Currently causing no grief but did when working on compaction. Already include #842.

Closes #842

rows[n] = s.tree.Winner().At()
rows[n] = rows[n][:0]
for _, c := range it.At() {
rows[n] = append(rows[n], c.Clone())
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We have to clone each value here since At can change the current row.

Copy link
Contributor

@kolesnikovae kolesnikovae left a comment

Choose a reason for hiding this comment

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

LGTM

@cyriltovena cyriltovena enabled auto-merge (squash) July 12, 2023 09:02
@cyriltovena
Copy link
Collaborator Author

Well thanks to this PR found another bug :)

@cyriltovena cyriltovena merged commit e154533 into main Jul 12, 2023
17 checks passed
@cyriltovena cyriltovena deleted the bugfix/copy-row-iterator branch July 12, 2023 09:49
simonswine pushed a commit to simonswine/pyroscope that referenced this pull request Jul 18, 2023
* Fixes iterator At value re-used

* make fmt
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

2 participants