Skip to content
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

Fix the upgrader logic if the tags db file was not created yet #6956

Merged
merged 1 commit into from
Jul 1, 2022

Conversation

kozlovsky
Copy link
Contributor

Fixes #6944

@kozlovsky kozlovsky force-pushed the fix/upgrade_tags_db branch from 6e8104b to 2c9de1a Compare June 29, 2022 12:10
@kozlovsky kozlovsky force-pushed the fix/upgrade_tags_db branch from 2c9de1a to 92bda50 Compare June 29, 2022 14:37
@drew2a drew2a self-requested a review June 29, 2022 14:44
@drew2a drew2a marked this pull request as ready for review June 29, 2022 14:44
@drew2a drew2a requested a review from a team June 29, 2022 14:44
@drew2a drew2a marked this pull request as draft June 29, 2022 14:44
@drew2a drew2a force-pushed the fix/upgrade_tags_db branch 2 times, most recently from 701f17a to 92bda50 Compare June 29, 2022 15:08
@@ -243,10 +243,12 @@ def add_column(db, table_name, column_name, column_type):

self._logger.info(f'{version.current}->{version.next}')

add_column(db=mds._db, table_name='ChannelNode', column_name='tag_processor_version', column_type='INT')
add_column(db=tags.instance, table_name='TorrentTagOp', column_name='auto_generated', column_type='BOOLEAN')
if tags is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT:
Maybe (for simplifying the logic of future upgraders) we should create tags DB in the case it does not exist.

Otherwise, in every future upgrader we should use the construction that you have used above:

if tags is non None:
    ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the suggestion! I think it is better to have this check repeated in future upgrades.

Right now, the tags database does not have a version, and we rely on the metadata store version. If we create the tags database during the upgrade, it will already have the latest schema, and the subsequent upgrades should have the logic to skip the upgrade. So, creating the database in the upgrade will not reduce the number of checks.

@kozlovsky kozlovsky marked this pull request as ready for review July 1, 2022 07:26
@kozlovsky kozlovsky merged commit c442fc0 into Tribler:release/7.12 Jul 1, 2022
@kozlovsky kozlovsky deleted the fix/upgrade_tags_db branch July 1, 2022 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants