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

[IMP] util.dispatch_by_dbuuid #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Pirols
Copy link
Contributor

@Pirols Pirols commented Nov 5, 2024

@Pirols Pirols requested review from a team and asno-odoo November 5, 2024 16:27
@robodoo
Copy link
Contributor

robodoo commented Nov 5, 2024

Pull request status dashboard

@Pirols Pirols removed request for a team and asno-odoo November 5, 2024 16:27
@KangOl
Copy link
Contributor

KangOl commented Nov 5, 2024

Actually, prioritizing the origin.database.uuid was a mistake.
I would like to change it, but it will break a lot of custom scripts, even if most of them are now dead code as the databases have been upgraded.

I don't like the idea of introducing a new neuter flag only set by the upgrade platform.

Let's keep your ancestor=True, but change the implementation of dispatch_by_dbuuid to first try the real dbuuid. This should be retro-compatible

def dispatch_by_dbuuid(cr, version, callbacks):
    query = """
       SELECT value
         FROM ir_config_parameter
        WHERE key IN ('database.uuid', 'origin.database.uuid')
     ORDER BY key ASC
    """
    cr.execute(query)
    for uuid, in cr.fetchall():
        if uuid in callbacks:
            func = callbacks[uuid]
            _logger.info("calling dbuuid-specific function `%s`", func.__name__)
            func(cr, version)
            break

@Pirols
Copy link
Contributor Author

Pirols commented Nov 6, 2024

Actually, prioritizing the origin.database.uuid was a mistake.

I haven't looked into the history of its introduction but to me it looks like this was made necessary to have a consistent dispatch among test and production requests, due to this.

I would like to change it, but it will break a lot of custom scripts, even if most of them are now dead code as the databases have been upgraded.

I don't like the idea of introducing a new neuter flag only set by the upgrade platform.

The issue is caused by the overload of the origin.database.uuid icp key, which is why I opted for the introduction and usage of a dedicated (and overwritable1) key.

Footnotes

  1. see the companion PR for the actual details.

@Pirols Pirols force-pushed the master-dispatcher_to_distinguish_duplicated_dbs-pied branch from eaaedf8 to fb8a74a Compare November 13, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants