gnocchixyz / gnocchi

Timeseries database
Apache License 2.0
299 stars 85 forks source link

gnocchi-db-sync fails with sqlalchemy-1.4.18 #1146

Closed karelyatin closed 3 years ago

karelyatin commented 3 years ago

Before reporting an issue on Gnocchi, please be sure to provide all necessary information.

Which version of Gnocchi are you using

gnocchi stable/4.3 latest commits

How to reproduce your problem

deploy with sqlalchemy-1.4.18

What is the result that you get

gnocchi-db-sync timeouts

What is result that you expected

gnocchi db-sync should succeed.

When attempting to upgrade sqlalchemy to 1.4.18 in RDO xena[1], gnocchi db sync timesout and not reporting error, also noticed sqlalchemy is pinned to <1.4 in gnocchi[2], not sure if it was for same/similar issue.

[1] https://review.rdoproject.org/r/c/rdoinfo/+/34221 [2] https://github.com/gnocchixyz/gnocchi/commit/44cf670f3159c6d21bbf9461814b7af9a917b470

karelyatin commented 3 years ago

Even with the fix, getting similar error https://review.rdoproject.org/r/c/rdoinfo/+/34221, tried to reproduce locally with sqlalchemy-1.4.18 and get below traceback with gnocchi-upgrade --config-file /etc/gnocchi/gnocchi.conf:-

2021-07-06 09:34:10,917 [104640] ERROR gnocchi.utils: Unable to initialize indexer driver Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/tenacity/init.py", line 412, in call result = fn(*args, **kwargs) File "/usr/lib/python3.6/site-packages/gnocchi/indexer/init.py", line 107, in get_driver split.scheme).driver File "/usr/lib/python3.6/site-packages/stevedore/driver.py", line 62, in init warn_on_missing_entrypoint=warn_on_missing_entrypoint File "/usr/lib/python3.6/site-packages/stevedore/named.py", line 81, in init verify_requirements) File "/usr/lib/python3.6/site-packages/stevedore/extension.py", line 233, in _load_plugins self._on_load_failure_callback(self, ep, err) File "/usr/lib/python3.6/site-packages/stevedore/extension.py", line 225, in _load_plugins verify_requirements, File "/usr/lib/python3.6/site-packages/stevedore/named.py", line 158, in _load_one_plugin verify_requirements, File "/usr/lib/python3.6/site-packages/stevedore/extension.py", line 255, in _load_one_plugin plugin = ep.load() File "/usr/local/lib/python3.6/site-packages/importlib_metadata/init.py", line 178, in load module = import_module(match.group('module')) File "/usr/lib64/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/usr/lib/python3.6/site-packages/gnocchi/indexer/sqlalchemy.py", line 46, in import sqlalchemy_utils File "/usr/lib/python3.6/site-packages/sqlalchemy_utils/init.py", line 1, in from .aggregates import aggregated # noqa File "/usr/lib/python3.6/site-packages/sqlalchemy_utils/aggregates.py", line 372, in from .functions.orm import get_column_key File "/usr/lib/python3.6/site-packages/sqlalchemy_utils/functions/init.py", line 1, in from .database import ( # noqa File "/usr/lib/python3.6/site-packages/sqlalchemy_utils/functions/database.py", line 13, in from ..expressions import explain_analyze File "/usr/lib/python3.6/site-packages/sqlalchemy_utils/expressions.py", line 4, in from sqlalchemy.sql.expression import ( ImportError: cannot import name '_literal_as_text' 2021-07-06 09:34:11,424 [104640] ERROR gnocchi.utils: Unable to initialize indexer driver

So seems needs more work to get gnocchi compatible with both sqlalchemy-1.3 and 1.4, related sqlalchemy commit https://github.com/sqlalchemy/sqlalchemy/commit/f07e050c9ce4afdeb9c0c136dbcc547f7e5ac7b8

tobias-urdin commented 3 years ago

Seems like a newer version of sqlalchemy-utils is required no?

tobias-urdin commented 3 years ago

do you have >= 0.37.0?

karelyatin commented 3 years ago

@tobias-urdin we have python-sqlalchemy-utils-0.34.2-2.el8 currently, unsure if upgrade is needed, but will try with sqlalchemy-utils-0.37.8 + sqlalchemy-1.4.18 and update you with results.

karelyatin commented 3 years ago

@tobias-urdin The combo sqlalchemy-utils-0.37.8 + sqlalchemy-1.4.18 worked fine in my local tests, will get it updated in RDO together. Thanks.

tobias-urdin commented 3 years ago

Great!