Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

insights: add oob migration for recording times back with fix#44499

Merged
coury-clark merged 4 commits into
mainfrom
leo/try-oob-migration-again
Nov 16, 2022
Merged

insights: add oob migration for recording times back with fix#44499
coury-clark merged 4 commits into
mainfrom
leo/try-oob-migration-again

Conversation

@leonore

@leonore leonore commented Nov 16, 2022

Copy link
Copy Markdown
Contributor

closes #43496 (again)

the (second) bug was that on second iteration through sql rows I iterated through rows.Next() rather than recordingRows.Next(), which meant we would always reuse generated recording times rather than any existing timestamps.

Test plan

Manually stepped through all the logic. Wrote a unit test. Manually ran the migration again on a local instance.

@leonore leonore requested a review from a team November 16, 2022 16:58
@cla-bot cla-bot Bot added the cla-signed label Nov 16, 2022
@sourcegraph-bot

sourcegraph-bot commented Nov 16, 2022

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff 2bdefd3...8826a79.

Notify File(s)
@efritz internal/oobmigration/oobmigrations.yaml

return nil
}

func selectSeriesMetadata(ctx context.Context, tx *basestore.Store, batchSize int) (map[int]seriesMetadata, error) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is the main change: I've pulled out the logic here into helper functions. but the only change is really

for rows.Next()

is now correct for both functions

if len(existingPoints) == 0 {
return referenceTimes
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed the logic to early exit on len(existingPoints) = len(recordingTimes).

@coury-clark coury-clark merged commit 35e546f into main Nov 16, 2022
@coury-clark coury-clark deleted the leo/try-oob-migration-again branch November 16, 2022 20:50
coury-clark added a commit that referenced this pull request Nov 16, 2022
Revert "insights: add oob migration for recording times back with fix (#44499)"

This reverts commit 35e546f.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

insights: write migration to save recording times for existing insights

3 participants