)]}'
{"id":"openstack%2Foslo.db~734744","triplet_id":"openstack%2Foslo.db~master~Ib91c9e2fc287be72546f72fb2e6483e67da084b5","project":"openstack/oslo.db","branch":"master","topic":"bug/1882877","hashtags":[],"change_id":"Ib91c9e2fc287be72546f72fb2e6483e67da084b5","subject":"Call register_opts if no \u0027database\u0027 exists in conf","status":"ABANDONED","created":"2020-06-10 06:04:25.000000000","updated":"2021-07-05 15:17:03.000000000","total_comment_count":2,"unresolved_comment_count":0,"has_review_started":true,"meta_rev_id":"0854bf9bb2ed9e671aed7c973040a5c4d58c9f99","_number":734744,"virtual_id_number":734744,"owner":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"actions":{},"labels":{"Verified":{"recommended":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"all":[{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},{"date":"2020-06-22 01:16:50.000000000","_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},{"tag":"autogenerated:zuul:check","value":1,"date":"2020-06-22 02:25:12.000000000","permitted_voting_range":{"min":-2,"max":2},"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-2":"Fails","-1":"Doesn\u0027t seem to work"," 0":"No score","+1":"Works for me","+2":"Verified"},"description":"","value":1,"default_value":0,"optional":true},"Code-Review":{"disliked":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"all":[{"value":-1,"date":"2020-08-24 15:32:38.000000000","permitted_voting_range":{"min":-2,"max":2},"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},{"value":0,"permitted_voting_range":{"min":-2,"max":2},"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},{"value":0,"permitted_voting_range":{"min":-2,"max":2},"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-2":"Do not merge","-1":"This patch needs further work before it can be merged"," 0":"No score","+1":"Looks good to me, but someone else must approve","+2":"Looks good to me (core reviewer)"},"description":"","value":-1,"default_value":0,"optional":true},"Workflow":{"all":[{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},{"value":0,"permitted_voting_range":{"min":-1,"max":0},"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-1":"Work in progress"," 0":"Ready for reviews","+1":"Approved"},"description":"","default_value":0,"optional":true},"Backport-Candidate":{"all":[{"value":0,"permitted_voting_range":{"min":-2,"max":2},"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},{"value":0,"permitted_voting_range":{"min":-2,"max":2},"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},{"value":0,"permitted_voting_range":{"min":-2,"max":2},"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},{"value":0,"permitted_voting_range":{"min":-1,"max":1},"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-2":"Do Not Backport","-1":"Not A Backport Candidate"," 0":"Backport Review Needed","+1":"Proposed Backport","+2":"Should Backport"},"description":"","default_value":0,"optional":true}},"removable_reviewers":[],"reviewers":{"REVIEWER":[{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"}]},"pending_reviewers":{},"reviewer_updates":[{"updated":"2020-06-10 12:27:21.000000000","updated_by":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"reviewer":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"state":"REVIEWER"},{"updated":"2020-06-10 14:50:57.000000000","updated_by":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"reviewer":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"state":"REVIEWER"},{"updated":"2020-06-22 02:25:12.000000000","updated_by":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"reviewer":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"state":"REVIEWER"},{"updated":"2020-08-24 15:32:38.000000000","updated_by":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"reviewer":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"state":"REVIEWER"}],"messages":[{"id":"65f2cfee5466f6357f2d07ec7bffda4cb742b53b","author":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"date":"2020-06-10 06:04:25.000000000","message":"Uploaded patch set 1.","accounts_in_message":[],"_revision_number":1},{"id":"7335438279d75f357fbbd5ab480450d6d901912d","tag":"autogenerated:zuul:check","author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"date":"2020-06-10 07:22:06.000000000","message":"Patch Set 1: Verified+1\n\nBuild succeeded (check pipeline).\n\n- tempest-full-py3 https://zuul.opendev.org/t/openstack/build/da3a6cd0c2824c10b8dbc799d4bff635 : SUCCESS in 1h 13m 15s\n- openstack-tox-lower-constraints https://zuul.opendev.org/t/openstack/build/42bb50ce2e54453ba2d70a82b8c228ae : SUCCESS in 9m 36s\n- openstack-tox-pep8 https://zuul.opendev.org/t/openstack/build/f294010cd22d4f09923ae9d3f7163303 : SUCCESS in 6m 36s\n- openstack-tox-py36 https://zuul.opendev.org/t/openstack/build/9d03d5473c284302923cce5990b3691e : SUCCESS in 9m 00s\n- openstack-tox-py38 https://zuul.opendev.org/t/openstack/build/79136cbcc4d84568a8d685ef55dc4d74 : SUCCESS in 11m 42s\n- openstack-tox-docs https://zuul.opendev.org/t/openstack/build/7479e10c13d54f9f8e1bafcf0b8054e6 : SUCCESS in 7m 19s","accounts_in_message":[],"_revision_number":1},{"id":"193cc0eeca29b3d60491e70f7ef6d477bc0e7c44","author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"date":"2020-06-10 12:27:21.000000000","message":"Patch Set 1:\n\n(1 comment)","accounts_in_message":[],"_revision_number":1},{"id":"e46598c84d16103ecf7bfb6bb078cc01943eea21","author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"date":"2020-06-10 14:50:57.000000000","message":"Patch Set 1: Code-Review-1\n\nhey there -\n\nI apologize that I don\u0027t get to look at this stuff often and I may be rusty on the details, but looking again at the LegacyEngineFacade is in fact calling that _start() method and is updating cfg.CONF with the \"database\" group.  There\u0027s no difference between using either one.     it was done that way to preserve exactly what the previous EngineFacade system was doing.\n\nIIUC here, the DuplicateOpt is telling us that two different systems are attempting to write the config with potentially different values.   The change here would have that oslo.db\u0027s options are simply ignored rather than reporting on the conflict, and that does not seem to be a good idea to do by default.\n\nI would assume the Trove effort here moves around where the enginefacade is configured.  if it previously called LegacyEngineFacade up front and now it calls oslo.db enginefacade much later, I would advise making sure the new enginefacade is \"started\" at the same time as when the previous LegacyEngineFacade was started.   I would place a call to enginefacade.get_engine() at that same point to ensure the same initialization happens at the same time as it did before.","accounts_in_message":[],"_revision_number":1},{"id":"cc54d7e494f00ed06aff2d485200ad2a0fb7dc19","author":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"date":"2020-06-10 22:57:18.000000000","message":"Patch Set 1:\n\n\u003e (1 comment)\n\nHello Hervé, Thank you for your answer and suggestion!\n\nIt may be the Trove\u0027s problem, but when I looked at the migration document and changed the Trove side, I got a Duplication Error that is a new exception for Trove, so I think that it was a problem of oslo.db rather than a problem of Trove. Is it possible to avoid throwing new exceptions that did not occur before when migrating or re-throw the exception as an error in oslo.db at least? The documentation for register_opts in oslo.config states that an error will occur if the same options are given. oslo.db doesn\u0027t currently check the same group exist. If you\u0027re concerned that you\u0027re hitting where the exception was until now, you can change the patch like this:\n\n             if conf is not None:\n                 if \u0027database\u0027 in conf:\n                     raise DuplicateOptError(\u0027database\u0027) # discover errors as soon as possible\n                 conf.register_opts(options.database_opts, \u0027database\u0027)\n\nFYI：the migration document whe I changed the Trove side\nhttps://docs.openstack.org/oslo.db/latest/reference/api/oslo_db.sqlalchemy.html#oslo_db.sqlalchemy.enginefacade.LegacyEngineFacade\nhttps://docs.openstack.org/oslo.db/latest/user/usage.html\n\nHere are primary lines of my migration code in Trove. It would be great if we could migrate with all these changes!\n\n@@ -94,10 +113,12 @@ def _create_facade(options):\n\n                 #                 use enginefacade.from_config() instead\n                 database_opts \u003d dict(CONF.database)\n                 database_opts.pop(\u0027query_log\u0027)\n-                _FACADE \u003d session.EngineFacade(\n-                    options[\u0027database\u0027][\u0027connection\u0027],\n+                enginefacade.configure(sqlite_fk\u003dFalse,\n+                    __autocommit\u003dTrue,\n+                    expire_on_commit\u003dFalse, \n                     **database_opts\n                 )\n+                _FACADE \u003d MyContext()\n\nThanks in advance,\nHirotaka Wakabayashi","accounts_in_message":[],"_revision_number":1},{"id":"e242213e8a295de7a57d4ae8df72ff7f6dda5fde","author":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"date":"2020-06-11 00:18:17.000000000","message":"Patch Set 1:\n\nHello Michael, Thank you very much for comments!\n\n \u003e IIUC here, the DuplicateOpt is telling us that two different\n \u003e systems are attempting to write the config with potentially\n \u003e different values.   The change here would have that oslo.db\u0027s\n \u003e options are simply ignored rather than reporting on the conflict,\n \u003e and that does not seem to be a good idea to do by default.\nI agree with you. Is the following logic same with the current one? oslo.db raise an exception when a database group exists.\n```\n             if conf is not None:\n                 if \u0027database\u0027 in conf:\n                     raise DuplicateOptError(\u0027database\u0027) # discover errors as soon as possible\n                 conf.register_opts(options.database_opts, \u0027database\u0027)\n\n             url_args \u003d self._url_args_for_conf(conf)\n```\n\n\n \u003e I would assume the Trove effort here moves around where the\n \u003e enginefacade is configured.  if it previously called\n \u003e LegacyEngineFacade up front and now it calls oslo.db enginefacade\n \u003e much later, I would advise making sure the new enginefacade is\n \u003e \"started\" at the same time as when the previous LegacyEngineFacade\n \u003e was started.   I would place a call to enginefacade.get_engine() at\n \u003e that same point to ensure the same initialization happens at the\n \u003e same time as it did before.\nThe place where I call enginefacede is almost the same as LegacyEngineFacade... Any suggestions are appreciated for me.\n\nHere is my reference code change to migration from LegacyEngineFacade to enginefacade:\n```\ndiff --git a/trove/db/sqlalchemy/session.py b/trove/db/sqlalchemy/session.py\nindex 39a0f218..1e56ce83 100644\n--- a/trove/db/sqlalchemy/session.py\n+++ b/trove/db/sqlalchemy/session.py\n@@ -17,6 +17,7 @@ import contextlib\n import threading\n \n from oslo_db.sqlalchemy import session\n+from oslo_db.sqlalchemy import enginefacade\n from oslo_log import log as logging\n from sqlalchemy import MetaData\n \n@@ -71,6 +72,24 @@ def configure_db(options, models_mapper\u003dNone):\n             models.update(module.persisted_models())\n         mappers.map(get_engine(), models)\n \n+class MyContext(object):\n+    \"User-defined context class.\"\n+    def get_engine(self, use_slave\u003dFalse):\n+        if use_slave:\n+            ret \u003d enginefacade.reader.get_engine()\n+        else:\n+            ret \u003d enginefacade.writer.get_engine()\n+        #print(\"MyContext get_engine type(ret) {}\".format(type(ret))) # sqlalchemy.engine.base.Engine\n+        return ret\n+\n+    def get_session(self, use_slave\u003dFalse, **kwargs):\n+        if use_slave:\n+            sessionmaker \u003d enginefacade.reader.get_sessionmaker()\n+        else:\n+            sessionmaker \u003d enginefacade.writer.get_sessionmaker()\n+        session \u003d sessionmaker(**kwargs)\n+        #print(\"MyContext get_session type(ret) {}\".format(type(session))) # sqlalchemy.orm.session.Session\n+        return session\n \n def _create_facade(options):\n     global _LOCK, _FACADE\n@@ -94,10 +113,12 @@ def _create_facade(options):\n                 #                 use enginefacade.from_config() instead\n                 database_opts \u003d dict(CONF.database)\n                 database_opts.pop(\u0027query_log\u0027)\n-                _FACADE \u003d session.EngineFacade(\n-                    options[\u0027database\u0027][\u0027connection\u0027],\n+                enginefacade.configure(sqlite_fk\u003dFalse,\n+                    __autocommit\u003dTrue,\n+                    expire_on_commit\u003dFalse, \n                     **database_opts\n                 )\n+                _FACADE \u003d MyContext()\n     return _FACADE \n```\nhttps://storyboard.openstack.org/#!/story/2007498#comment-155528\n\nThanks in advance,\nHirotaka Wakabayashi","accounts_in_message":[],"_revision_number":1},{"id":"79d4b77e012db09fc951062673032b98fe1fb238","author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"date":"2020-06-11 02:53:24.000000000","message":"Patch Set 1:\n\n\u003e Hello Michael, Thank you very much for comments!\n \u003e \n \u003e \u003e IIUC here, the DuplicateOpt is telling us that two different\n \u003e \u003e systems are attempting to write the config with potentially\n \u003e \u003e different values.   The change here would have that oslo.db\u0027s\n \u003e \u003e options are simply ignored rather than reporting on the conflict,\n \u003e \u003e and that does not seem to be a good idea to do by default.\n \u003e I agree with you. Is the following logic same with the current one?\n \u003e oslo.db raise an exception when a database group exists.\n \u003e ```\n \u003e if conf is not None:\n \u003e if \u0027database\u0027 in conf:\n \u003e raise DuplicateOptError(\u0027database\u0027) # discover errors as soon as\n \u003e possible\n \u003e conf.register_opts(options.database_opts, \u0027database\u0027)\n \u003e \n \u003e url_args \u003d self._url_args_for_conf(conf)\n \u003e ```\n \u003e \n \u003e \n \u003e \u003e I would assume the Trove effort here moves around where the\n \u003e \u003e enginefacade is configured.  if it previously called\n \u003e \u003e LegacyEngineFacade up front and now it calls oslo.db enginefacade\n \u003e \u003e much later, I would advise making sure the new enginefacade is\n \u003e \u003e \"started\" at the same time as when the previous LegacyEngineFacade\n \u003e \u003e was started.   I would place a call to enginefacade.get_engine()\n \u003e at\n \u003e \u003e that same point to ensure the same initialization happens at the\n \u003e \u003e same time as it did before.\n \u003e The place where I call enginefacede is almost the same as\n \u003e LegacyEngineFacade... Any suggestions are appreciated for me.\n \u003e \n \u003e Here is my reference code change to migration from\n \u003e LegacyEngineFacade to enginefacade:\n \u003e ```\n \u003e diff --git a/trove/db/sqlalchemy/session.py b/trove/db/sqlalchemy/session.py\n \u003e index 39a0f218..1e56ce83 100644\n \u003e --- a/trove/db/sqlalchemy/session.py\n \u003e +++ b/trove/db/sqlalchemy/session.py\n \u003e @@ -17,6 +17,7 @@ import contextlib\n \u003e import threading\n \u003e \n \u003e from oslo_db.sqlalchemy import session\n \u003e +from oslo_db.sqlalchemy import enginefacade\n \u003e from oslo_log import log as logging\n \u003e from sqlalchemy import MetaData\n \u003e \n \u003e @@ -71,6 +72,24 @@ def configure_db(options, models_mapper\u003dNone):\n \u003e models.update(module.persisted_models())\n \u003e mappers.map(get_engine(), models)\n \u003e \n \u003e +class MyContext(object):\n \u003e +    \"User-defined context class.\"\n \u003e +    def get_engine(self, use_slave\u003dFalse):\n \u003e +        if use_slave:\n \u003e +            ret \u003d enginefacade.reader.get_engine()\n \u003e +        else:\n \u003e +            ret \u003d enginefacade.writer.get_engine()\n \u003e +        #print(\"MyContext get_engine type(ret) {}\".format(type(ret)))\n \u003e # sqlalchemy.engine.base.Engine\n \u003e +        return ret\n \u003e +\n \u003e +    def get_session(self, use_slave\u003dFalse, **kwargs):\n \u003e +        if use_slave:\n \u003e +            sessionmaker \u003d enginefacade.reader.get_sessionmaker()\n \u003e +        else:\n \u003e +            sessionmaker \u003d enginefacade.writer.get_sessionmaker()\n \u003e +        session \u003d sessionmaker(**kwargs)\n \u003e +        #print(\"MyContext get_session type(ret) {}\".format(type(session)))\n \u003e # sqlalchemy.orm.session.Session\n \u003e +        return session\n \u003e \n \u003e def _create_facade(options):\n \u003e global _LOCK, _FACADE\n \u003e @@ -94,10 +113,12 @@ def _create_facade(options):\n \u003e #                 use enginefacade.from_config() instead\n \u003e database_opts \u003d dict(CONF.database)\n \u003e database_opts.pop(\u0027query_log\u0027)\n \u003e -                _FACADE \u003d session.EngineFacade(\n \u003e -                    options[\u0027database\u0027][\u0027connection\u0027],\n \u003e +                enginefacade.configure(sqlite_fk\u003dFalse,\n \u003e +                    __autocommit\u003dTrue,\n \u003e +                    expire_on_commit\u003dFalse,\n \u003e **database_opts\n \u003e )\n \u003e +                _FACADE \u003d MyContext()\n \u003e return _FACADE\n \u003e ```\n \u003e https://storyboard.openstack.org/#!/story/2007498#comment-155528\n \u003e \n \u003e Thanks in advance,\n \u003e Hirotaka Wakabayashi\n\nyes, right below where you call enginefacade.configure(), then call enginefacade.get_engine(), which will call the _start()  method that LegacyEngineFacade would call at that same point.  see if that solves the problem.","accounts_in_message":[],"_revision_number":1},{"id":"6e595cdc814f6c2496512105f856db54a5b47d8b","author":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"date":"2020-06-11 06:37:59.000000000","message":"Patch Set 1:\n\nMichael, Thank you very much for your comment! Actually, I was not very confident in my reference code change.:) \n\nI surveyed the reason why no DuplicateOptError occurs when using LegacyEngineFacade. Please see the followings.\n\n1. _TransactionFactory::_start() registers options to the \"database\" group only when _start() is called with *conf is not None*. \nhttps://opendev.org/openstack/oslo.db/src/branch/master/oslo_db/sqlalchemy/enginefacade.py#L481\nhttps://opendev.org/openstack/oslo.db/src/branch/master/oslo_db/sqlalchemy/enginefacade.py#L496-L497\n\n2. However, LegacyEngineFacade::init() defaultly calls _TransactionFactory::_start(conf\u003dNone).\nhttps://opendev.org/openstack/oslo.db/src/branch/master/oslo_db/sqlalchemy/enginefacade.py#L1272-L1295\nhttps://opendev.org/openstack/trove/src/branch/master/trove/db/sqlalchemy/session.py#L97-L100\n\n3. As a result, when LegacyEngineFacade is used, DuplicateOptError exception never occurs. \n\nI wonder DuplicateOptError will not occur if _start(self, conf\u003dFalse...) were _start(self, conf\u003dNone...), because LegacyEngineFacade::init(_conf\u003dNone) calls _TransactionFactory::_start(_conf). In that case, Trove\u0027s migration might have no problem.\nhttps://opendev.org/openstack/oslo.db/src/branch/master/oslo_db/sqlalchemy/enginefacade.py#L481\nhttps://opendev.org/openstack/oslo.db/src/branch/master/oslo_db/sqlalchemy/enginefacade.py#L1272-L1274\n\nAny helps are appreciated.\n\nThanks in advance,\nHirotaka Wakabayashi","accounts_in_message":[],"_revision_number":1},{"id":"3e615144e40ed742f35d7fedf08647ca4cc66ccf","author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"date":"2020-06-11 14:27:19.000000000","message":"Patch Set 1:\n\n\u003e Michael, Thank you very much for your comment! Actually, I was not\n \u003e very confident in my reference code change.:)\n \u003e \n \u003e I surveyed the reason why no DuplicateOptError occurs when using\n \u003e LegacyEngineFacade. Please see the followings.\n \u003e \n \u003e 1. _TransactionFactory::_start() registers options to the\n \u003e \"database\" group only when _start() is called with *conf is not\n \u003e None*.\n \u003e https://opendev.org/openstack/oslo.db/src/branch/master/oslo_db/sqlalchemy/enginefacade.py#L481\n \u003e https://opendev.org/openstack/oslo.db/src/branch/master/oslo_db/sqlalchemy/enginefacade.py#L496-L497\n \u003e \n \u003e 2. However, LegacyEngineFacade::init() defaultly calls\n \u003e _TransactionFactory::_start(conf\u003dNone).\n \u003e https://opendev.org/openstack/oslo.db/src/branch/master/oslo_db/sqlalchemy/enginefacade.py#L1272-L1295\n \u003e https://opendev.org/openstack/trove/src/branch/master/trove/db/sqlalchemy/session.py#L97-L100\n \u003e \n \u003e 3. As a result, when LegacyEngineFacade is used, DuplicateOptError\n \u003e exception never occurs.\n \u003e \n \u003e I wonder DuplicateOptError will not occur if _start(self,\n \u003e conf\u003dFalse...) were _start(self, conf\u003dNone...), because\n \u003e LegacyEngineFacade::init(_conf\u003dNone) calls _TransactionFactory::_start(_conf).\n \u003e In that case, Trove\u0027s migration might have no problem.\n \u003e https://opendev.org/openstack/oslo.db/src/branch/master/oslo_db/sqlalchemy/enginefacade.py#L481\n \u003e https://opendev.org/openstack/oslo.db/src/branch/master/oslo_db/sqlalchemy/enginefacade.py#L1272-L1274\n \u003e \n \u003e Any helps are appreciated.\n \u003e \n \u003e Thanks in advance,\n \u003e Hirotaka Wakabayashi\n\nHi Hirotaka -\n\nyour analysis is correct.  hence why I am suggesting that in your new code, you add a single call to enginefacade.get_engine() which will call this _start method at this point.\n\nwhether or not we change oslo.db here, if this approach does resolve the problem, it at least confirms that we understand what\u0027s going on and also provides Trove with a workaround so that you can move forward with your patch for Trove.","accounts_in_message":[],"_revision_number":1},{"id":"b63406321eed2b3eb0400257c3f44d95f2e15857","author":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"date":"2020-06-12 09:14:05.000000000","message":"Patch Set 1:\n\nMichael, Thank you very much for looking at my comment! I will try to add a single call to enginefacade.get_engine() and check if it resolve my problem. Even if problem will not be solved, I will try another approach like singleton oslo.config that Mr. Hervé Beraud told me. If I need your help again, I will ask you again. So I will abandon this ticket at this point.\n\nThank you very much!\nHirotaka Wakabayashi","accounts_in_message":[],"_revision_number":1},{"id":"f7184965242eb66c713995a12ff461c884dbeec4","author":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"date":"2020-06-13 01:08:48.000000000","message":"Patch Set 1:\n\nHello, I don\u0027t know this can help to tell this issue well, but I add one more comment on Trove\u0027s situation. I added a single call to enginefacade.get_engine() in Trove code to check if it resolves my problem, but Zuul\u0027s openstack-tox-py36 job is now failing.\n\nhttps://review.opendev.org/#/c/735405/\nhttps://zuul.opendev.org/t/openstack/build/a36cb86910154baead04277477dd2688\n\nIf you think my code change is bad or not what you expected, please give your feedback.\n\nThanks in advance,\nHirotaka Wakabayashi","accounts_in_message":[],"_revision_number":1},{"id":"ea43deb41d10c5af768a56dec5c7d4521f9fd478","author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"date":"2020-06-13 02:15:32.000000000","message":"Patch Set 1:\n\n\u003e Hello, I don\u0027t know this can help to tell this issue well, but I\n \u003e add one more comment on Trove\u0027s situation. I added a single call to\n \u003e enginefacade.get_engine() in Trove code to check if it resolves my\n \u003e problem, but Zuul\u0027s openstack-tox-py36 job is now failing.\n \u003e \n \u003e https://review.opendev.org/#/c/735405/\n \u003e https://zuul.opendev.org/t/openstack/build/a36cb86910154baead04277477dd2688\n \u003e \n \u003e If you think my code change is bad or not what you expected, please\n \u003e give your feedback.\n \u003e \n \u003e Thanks in advance,\n \u003e Hirotaka Wakabayashi\n\nwhy don\u0027t we try to follow the approach of other openstack projects.    I\u0027m not sure why this problem is happening here and not in others, I\u0027m not that deeply familiar with oslo.config.\n\nlooking at projects like nova, keystone, neutron, they aren\u0027t doing any register_opts() of their own in the \"database\" group.  Nova is registering them for its \"api_database\" group but not for \"database\".  \n\nwhy not use the options that oslo.db is registering and leave it at that ?","accounts_in_message":[],"_revision_number":1},{"id":"e06c54ed1d91f093c42bb88a82b94074496d440e","author":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"date":"2020-06-13 05:17:21.000000000","message":"Patch Set 1:\n\nHello Michael, Thank you for teaching me other projects use cases and sorry for confusing you. I am simply wondering if it is a migration issue from LegacyEngineFacade from enginefacade because I got this error after migration code change. However, if using the \"database\" group in Trove is a bad idea(because that group is an important group for oslo.db and potentially causes a problem like this issue), then I thinik migration code change is just a opening of that problem. If so, I should close this review issue. \n\nThanks in advance, \nHirotaka Wakabayashi","accounts_in_message":[],"_revision_number":1},{"id":"3893f90b61957cc3c96e9625fad8eb55b7b9060a","author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"date":"2020-06-15 15:02:23.000000000","message":"Patch Set 1:\n\n\u003e Hello Michael, Thank you for teaching me other projects use cases\n \u003e and sorry for confusing you. I am simply wondering if it is a\n \u003e migration issue from LegacyEngineFacade from enginefacade because I\n \u003e got this error after migration code change. However, if using the\n \u003e \"database\" group in Trove is a bad idea(because that group is an\n \u003e important group for oslo.db and potentially causes a problem like\n \u003e this issue), then I thinik migration code change is just a opening\n \u003e of that problem. If so, I should close this review issue.\n \u003e \n \u003e Thanks in advance,\n \u003e Hirotaka Wakabayashi\n\nthe same condition should have occurred using LegacyEngineFacade, as this uses the same code.  so I\u0027m not sure what has changed, but in any case, oslo.db should be responsible for setting up the \"database\" group in the global CONF.  that\u0027s one of its primary purposes.","accounts_in_message":[],"_revision_number":1},{"id":"c22c5d6af738c8c1adc0fb1080867e1d15b8b8b2","author":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"date":"2020-06-16 02:58:20.000000000","message":"Patch Set 1:\n\nDear Michael, Thank you for your reply. I finally understood that first of all Trove should not register the \"database\" group to the global CONF, because oslo.db should do that, but is it correct?\n\nThanks in advance,\nHirotaka Wakabayashi","accounts_in_message":[],"_revision_number":1},{"id":"19534a0616c294c96dbc05a3a7aac153ec148b0d","author":{"_account_id":11904,"name":"Sean McGinnis","email":"sean.mcginnis@gmail.com","username":"SeanM"},"date":"2020-06-20 13:52:36.000000000","message":"Patch Set 1:\n\n(1 comment)","accounts_in_message":[],"_revision_number":1},{"id":"dc7c0d1f5174d26889f2e205628176f988015f5e","author":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"date":"2020-06-22 01:07:32.000000000","message":"Uploaded patch set 2.","accounts_in_message":[],"_revision_number":2},{"id":"6d6af482b004ef786047a1d2e125abcdcb60ffd5","author":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"date":"2020-06-22 01:16:50.000000000","message":"Patch Set 2:\n\nHello Sean, Thank you very much for your comment! I fixed my commit message. Please correct me if it is strange.\n\nThanks in advance,\nHirotaka Wakabayashi","accounts_in_message":[],"_revision_number":2},{"id":"39c826d2550f8b0be446f2314ebb4d780ce00710","tag":"autogenerated:zuul:check","author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"date":"2020-06-22 02:25:12.000000000","message":"Patch Set 2: Verified+1\n\nBuild succeeded (check pipeline).\n\n- tempest-full-py3 https://zuul.opendev.org/t/openstack/build/7e4a2acfb8e6402d82ba3d4ee7bde132 : SUCCESS in 1h 16m 41s\n- openstack-tox-lower-constraints https://zuul.opendev.org/t/openstack/build/a9ba6ad0728a4e9996496e19c701f3e5 : SUCCESS in 5m 34s\n- openstack-tox-pep8 https://zuul.opendev.org/t/openstack/build/9d2cb542f81245c78dff2fbd6b193a2d : SUCCESS in 4m 01s\n- openstack-tox-py36 https://zuul.opendev.org/t/openstack/build/80ac53f678d84b7285a5b9db7cb4c5ca : SUCCESS in 4m 47s\n- openstack-tox-py38 https://zuul.opendev.org/t/openstack/build/2e45b5eeb5f74b39a98d5e6a60bf92a3 : SUCCESS in 5m 36s\n- openstack-tox-docs https://zuul.opendev.org/t/openstack/build/aaddaa2a7c1341b5a7be395234ac3033 : SUCCESS in 5m 25s","accounts_in_message":[],"_revision_number":2},{"id":"c28790139521237344dc6170d6b8df5c50d4a4c7","author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"date":"2020-08-24 15:32:38.000000000","message":"Patch Set 2: Code-Review-1\n\n\u003e Dear Michael, Thank you for your reply. I finally understood that\n \u003e first of all Trove should not register the \"database\" group to the\n \u003e global CONF, because oslo.db should do that, but is it correct?\n \u003e \n \u003e Thanks in advance,\n \u003e Hirotaka Wakabayashi\n\nThat is correct. The same group name should not be used in multiple projects, because of exactly what you\u0027ve found here.\n\noslo.db has been using the database group for a long time. What changed that made this an issue for Trove now?","accounts_in_message":[],"_revision_number":2},{"id":"0854bf9bb2ed9e671aed7c973040a5c4d58c9f99","tag":"autogenerated:gerrit:abandon","author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"date":"2021-07-05 15:17:03.000000000","message":"Abandoned\n\nThere has been no activity on this patch for some time. Apparently this is not really a problem with oslo.db, feel free to reopen it if needed.\n\nThanks for your understanding","accounts_in_message":[],"_revision_number":2}],"current_revision_number":2,"current_revision":"949a14968c64f4e8052dedc600924d4f36e6b598","revisions":{"2855e367e96036d08f5e3a862d481dcec7e9dce4":{"kind":"REWORK","_number":1,"created":"2020-06-10 06:04:25.000000000","uploader":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"ref":"refs/changes/44/734744/1","fetch":{"anonymous http":{"url":"https://review.opendev.org/openstack/oslo.db","ref":"refs/changes/44/734744/1","commands":{"Checkout":"git fetch https://review.opendev.org/openstack/oslo.db refs/changes/44/734744/1 \u0026\u0026 git checkout FETCH_HEAD","Cherry Pick":"git fetch https://review.opendev.org/openstack/oslo.db refs/changes/44/734744/1 \u0026\u0026 git cherry-pick FETCH_HEAD","Format Patch":"git fetch https://review.opendev.org/openstack/oslo.db refs/changes/44/734744/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD","Pull":"git pull https://review.opendev.org/openstack/oslo.db refs/changes/44/734744/1"}}},"commit":{"parents":[{"commit":"c18a019484356ce15da4f60f9147f7e8c019ae0c","subject":"Fix pygments style","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/oslo.db/commit/c18a019484356ce15da4f60f9147f7e8c019ae0c"}]}],"author":{"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","date":"2020-06-10 06:02:15.000000000","tz":0},"committer":{"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","date":"2020-06-10 06:04:21.000000000","tz":0},"subject":"I try to replace LegacyEngineFacade with enginefacade but I got DuplicateOptError because Trove\u0027s library initially calls CONF.register_opts function with \u0027database\u0027 group and enginefacade also internally calls CONF.register_opts with \u0027database\u0027 group.","message":"I try to replace LegacyEngineFacade with enginefacade but I got\nDuplicateOptError because Trove\u0027s library initially calls CONF.register_opts\nfunction with \u0027database\u0027 group and enginefacade also internally calls\nCONF.register_opts with \u0027database\u0027 group.\n\nOne of my suggestion to solve this problem is to register cfg options to the\n\"database\" group only if \"database\" group is not be registered.\n\nReference: My proposal ticket to use enginefacade instead of EngineFacade\nhttps://storyboard.openstack.org/#!/story/2007498#comment-155528\n\nChange-Id: Ib91c9e2fc287be72546f72fb2e6483e67da084b5\nCloses-Bug: 1882877\n","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/oslo.db/commit/2855e367e96036d08f5e3a862d481dcec7e9dce4"}],"resolve_conflicts_web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/oslo.db/commit/2855e367e96036d08f5e3a862d481dcec7e9dce4"}]},"branch":"refs/heads/master"},"949a14968c64f4e8052dedc600924d4f36e6b598":{"kind":"REWORK","_number":2,"created":"2020-06-22 01:07:32.000000000","uploader":{"_account_id":31737,"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","username":"hiwkby"},"ref":"refs/changes/44/734744/2","fetch":{"anonymous http":{"url":"https://review.opendev.org/openstack/oslo.db","ref":"refs/changes/44/734744/2","commands":{"Checkout":"git fetch https://review.opendev.org/openstack/oslo.db refs/changes/44/734744/2 \u0026\u0026 git checkout FETCH_HEAD","Cherry Pick":"git fetch https://review.opendev.org/openstack/oslo.db refs/changes/44/734744/2 \u0026\u0026 git cherry-pick FETCH_HEAD","Format Patch":"git fetch https://review.opendev.org/openstack/oslo.db refs/changes/44/734744/2 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD","Pull":"git pull https://review.opendev.org/openstack/oslo.db refs/changes/44/734744/2"}}},"commit":{"parents":[{"commit":"c18a019484356ce15da4f60f9147f7e8c019ae0c","subject":"Fix pygments style","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/oslo.db/commit/c18a019484356ce15da4f60f9147f7e8c019ae0c"}]}],"author":{"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","date":"2020-06-10 06:02:15.000000000","tz":0},"committer":{"name":"Hirotaka Wakabayashi","email":"hiwkby@yahoo.com","date":"2020-06-22 00:56:30.000000000","tz":0},"subject":"Call register_opts if no \u0027database\u0027 exists in conf","message":"Call register_opts if no \u0027database\u0027 exists in conf\n\nI try to replace LegacyEngineFacade with enginefacade but I got\nDuplicateOptError because Trove\u0027s library initially calls\nCONF.register_opts function with \u0027database\u0027 group and enginefacade also\ninternally calls CONF.register_opts with \u0027database\u0027 group.\n\nOne of my suggestion to solve this problem is to register cfg options\nto the \"database\" group only if \"database\" group is not be registered.\n\nReference: My proposal ticket to use enginefacade instead of EngineFacade\nhttps://storyboard.openstack.org/#!/story/2007498#comment-155528\n\nChange-Id: Ib91c9e2fc287be72546f72fb2e6483e67da084b5\nCloses-Bug: 1882877\n","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/oslo.db/commit/949a14968c64f4e8052dedc600924d4f36e6b598"}],"resolve_conflicts_web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/oslo.db/commit/949a14968c64f4e8052dedc600924d4f36e6b598"}]},"branch":"refs/heads/master"}},"requirements":[],"submit_records":[],"submit_requirements":[]}
