-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Update migrations list command to show migrations that no longer exist in the codebase #6299
Conversation
…t in the codebase
❌ 1 Tests Failed:
View the top 1 failed tests by shortest run time
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add unit test covering the case of completed but non-existent migrations?
Also, is such a migration configuration possible? MigrationDetails("0001", Status.COMPLETED, True, False)
where migration status is completed and it's non-existent but still blocked?
snuba/migrations/runner.py
Outdated
for group, migration_id in migration_status.keys(): | ||
clickhouse_group_migrations.setdefault(group, []).append(migration_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Would defaultdict()
be a better choice here?
clickhouse_group_migrations = defaultdict(set)
for group, migration_id in migration_status.keys():
clickhouse_group_migrations[group].add(migration_id)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably better yeah
I'm not sure if this is possible (maybe if a migration file is deleted while the migration is still being processed). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 thanks for addressing the comments.
Fixes #2159
Running
snuba migrations list
will now show migrations that are in clickhouse but no longer in the codebase (e.g. because snuba was downgraded).Testing
Deleted migration in codebase to check that it shows up in the list.