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

add migration to fix notifications from pre-1.0.0 upgrade #135

Merged
merged 2 commits into from
Oct 12, 2020
Merged

add migration to fix notifications from pre-1.0.0 upgrade #135

merged 2 commits into from
Oct 12, 2020

Conversation

bmc-msft
Copy link
Contributor

Summary of the Pull Request

In pre-1.0.0, notifications mapped notification_id to RowKey and Container to PartitionKey. In the 1.0.0 release, these got swapped causing pre-1.0.0 upgraded systems to fail.

PR Checklist

  • Applies to work item: #xxx
  • CLA signed. If not, go over here and sign the CLI.
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Info on Pull Request

A migration for pre-1.0.0 keys in the notifications table

Validation Steps Performed

How does someone test & validate?

@bmc-msft bmc-msft merged commit 4735456 into microsoft:main Oct 12, 2020
@bmc-msft bmc-msft deleted the add-notification-key-migration branch October 12, 2020 20:05
@@ -48,3 +82,26 @@ def migrate(table_service: TableService, migration_names: List[str]) -> None:
print("applying migration '%s'" % name)
migrations[name](table_service)
print("migration '%s' applied" % name)


def main():
Copy link
Member

Choose a reason for hiding this comment

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

It'd be nice to have some user-facing INFO-level logging so it is clear what's going on.


count = 0
for entry in notifications:
try:
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment about why this a non-exceptional UUID parse means we don't have to do anything?

@@ -38,8 +42,38 @@ def migrate_task_os(table_service: TableService) -> None:
print("migrated %s rows" % count)


def migrate_notification_keys(table_service: TableService) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

We should maybe have much more explicit names and/or comments, including version info, for migration functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something to think about for the future.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 17, 2021
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.

4 participants