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

Ubuntu Focal : OperationalError: (3822, "Duplicate check constraint name 'ck_started_before_ended'.") #1069

Closed
gmannos opened this issue Sep 10, 2020 · 6 comments

Comments

@gmannos
Copy link
Contributor

gmannos commented Sep 10, 2020

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

Which version of Gnocchi are you using

How to reproduce your problem

OpenStack Ceilometer/aodh testing on Ubuntu Focal:
Example patch: https://review.opendev.org/#/c/744615/

What is the result that you get

It raises an error;

While migrating the OpenStack testing for Ubuntu Focal (20.04), below error is occuring
Build link: https://zuul.opendev.org/t/openstack/build/ae38f7cb379e40ba9a585d02a0a28a2b/log/job-output.txt

2020-09-04 21:51:37.543307 | controller | Traceback (most recent call last):
2020-09-04 21:51:37.543314 | controller | File "/usr/local/bin/gnocchi-upgrade", line 11, in
2020-09-04 21:51:37.543320 | controller | load_entry_point('gnocchi', 'console_scripts', 'gnocchi-upgrade')()
2020-09-04 21:51:37.543325 | controller | File "/opt/stack/devstack/src/gnocchi/gnocchi/cli/manage.py", line 69, in upgrade
2020-09-04 21:51:37.543331 | controller | index.upgrade()
2020-09-04 21:51:37.543337 | controller | File "/opt/stack/devstack/src/gnocchi/gnocchi/indexer/sqlalchemy.py", line 334, in upgrade
2020-09-04 21:51:37.543343 | controller | Base.metadata.create_all(connection)
2020-09-04 21:51:37.543349 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/sql/schema.py", line 4555, in create_all
2020-09-04 21:51:37.543355 | controller | bind._run_visitor(
2020-09-04 21:51:37.543361 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1656, in _run_visitor
2020-09-04 21:51:37.543366 | controller | visitorcallable(self.dialect, self, **kwargs).traverse_single(element)
2020-09-04 21:51:37.543372 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/sql/visitors.py", line 145, in traverse_single
2020-09-04 21:51:37.543378 | controller | return meth(obj, **kw)
2020-09-04 21:51:37.543384 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/sql/ddl.py", line 783, in visit_metadata
2020-09-04 21:51:37.543390 | controller | self.traverse_single(
2020-09-04 21:51:37.543396 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/sql/visitors.py", line 145, in traverse_single
2020-09-04 21:51:37.543402 | controller | return meth(obj, **kw)
2020-09-04 21:51:37.543408 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/sql/ddl.py", line 827, in visit_table
2020-09-04 21:51:37.543414 | controller | self.connection.execute(
2020-09-04 21:51:37.543419 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1011, in execute
2020-09-04 21:51:37.543425 | controller | return meth(self, multiparams, params)
2020-09-04 21:51:37.543431 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
2020-09-04 21:51:37.543437 | controller | return connection._execute_ddl(self, multiparams, params)
2020-09-04 21:51:37.543443 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1068, in _execute_ddl
2020-09-04 21:51:37.543449 | controller | ret = self._execute_context(
2020-09-04 21:51:37.543455 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1316, in execute_context
2020-09-04 21:51:37.543461 | controller | self.handle_dbapi_exception(
2020-09-04 21:51:37.543467 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1508, in handle_dbapi_exception
2020-09-04 21:51:37.543473 | controller | util.raise(newraise, with_traceback=exc_info[2], from=e)
2020-09-04 21:51:37.543478 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/compat.py", line 182, in raise
2020-09-04 21:51:37.543484 | controller | raise exception
2020-09-04 21:51:37.543490 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
2020-09-04 21:51:37.543496 | controller | self.dialect.do_execute(
2020-09-04 21:51:37.543502 | controller | File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 593, in do_execute
2020-09-04 21:51:37.543508 | controller | cursor.execute(statement, parameters)
2020-09-04 21:51:37.543514 | controller | File "/usr/local/lib/python3.8/dist-packages/pymysql/cursors.py", line 163, in execute
2020-09-04 21:51:37.543520 | controller | result = self._query(query)
2020-09-04 21:51:37.543535 | controller | File "/usr/local/lib/python3.8/dist-packages/pymysql/cursors.py", line 321, in _query
2020-09-04 21:51:37.543542 | controller | conn.query(q)
2020-09-04 21:51:37.543549 | controller | File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 505, in query
2020-09-04 21:51:37.543555 | controller | self._affected_rows = self._read_query_result(unbuffered=unbuffered)
2020-09-04 21:51:37.543560 | controller | File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 724, in _read_query_result
2020-09-04 21:51:37.543566 | controller | result.read()
2020-09-04 21:51:37.543572 | controller | File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 1069, in read
2020-09-04 21:51:37.543578 | controller | first_packet = self.connection._read_packet()
2020-09-04 21:51:37.543584 | controller | File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 676, in _read_packet
2020-09-04 21:51:37.543590 | controller | packet.raise_for_error()
2020-09-04 21:51:37.543604 | controller | File "/usr/local/lib/python3.8/dist-packages/pymysql/protocol.py", line 223, in raise_for_error
2020-09-04 21:51:37.543611 | controller | err.raise_mysql_exception(self._data)
2020-09-04 21:51:37.543622 | controller | File "/usr/local/lib/python3.8/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
2020-09-04 21:51:37.543629 | controller | raise errorclass(errno, errval)
2020-09-04 21:51:37.543635 | controller | sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (3822, "Duplicate check constraint name 'ck_started_before_ended'.")
2020-09-04 21:51:37.543641 | controller | [SQL:
2020-09-04 21:51:37.543647 | controller | CREATE TABLE resource_history (
2020-09-04 21:51:37.543653 | controller | creator VARCHAR(255),
2020-09-04 21:51:37.543659 | controller | started_at DATETIME(6) NOT NULL,
2020-09-04 21:51:37.543664 | controller | revision_start DATETIME(6) NOT NULL,
2020-09-04 21:51:37.543670 | controller | ended_at DATETIME(6),
2020-09-04 21:51:37.543676 | controller | user_id VARCHAR(255),
2020-09-04 21:51:37.543681 | controller | project_id VARCHAR(255),
2020-09-04 21:51:37.543687 | controller | original_resource_id VARCHAR(255) NOT NULL,
2020-09-04 21:51:37.543692 | controller | revision INTEGER NOT NULL AUTO_INCREMENT,
2020-09-04 21:51:37.543698 | controller | id BINARY(16) NOT NULL,
2020-09-04 21:51:37.543704 | controller | revision_end DATETIME(6) NOT NULL,
2020-09-04 21:51:37.543709 | controller | type VARCHAR(255) NOT NULL,
2020-09-04 21:51:37.543715 | controller | PRIMARY KEY (revision),
2020-09-04 21:51:37.543721 | controller | CONSTRAINT ck_started_before_ended CHECK (started_at <= ended_at),
2020-09-04 21:51:37.543726 | controller | CONSTRAINT fk_rh_id_resource_id FOREIGN KEY(id) REFERENCES resource (id) ON DELETE CASCADE,
2020-09-04 21:51:37.543732 | controller | CONSTRAINT fk_resource_history_resource_type_name FOREIGN KEY(type) REFERENCES resource_type (name) ON DELETE RESTRICT
2020-09-04 21:51:37.543738 | controller | )CHARSET=utf8 ENGINE=InnoDB
2020-09-04 21:51:37.543744 | controller |
2020-09-04 21:51:37.543749 | controller | ]
2020-09-04 21:51:37.543755 | controller | (Background on this error at: http://sqlalche.me/e/13/e3q8)
2020-09-04 21:51:37.543761 | controller |
2020-09-04 21:51:37.799250 | controller | + /opt/stack/ceilometer/devstack/plugin.sh:configure_gnocchi:1 : exit_trap

What is result that you expected

Should have passed as it is working fine on Ubuntu Bionic.

@tobias-urdin
Copy link
Contributor

related PR #1047

@tobias-urdin
Copy link
Contributor

tobias-urdin commented Sep 15, 2020

solved in PR #1047 will see if we can get a release soon enough

@gmannos
Copy link
Contributor Author

gmannos commented Sep 16, 2020

Thanks tobias-urdin , any plan when we can release it as many openstack projects need this to migrate their testing to Ubuntu Focal.

@tobias-urdin
Copy link
Contributor

We will try release a new version as soon as #1064 #1068 and #1070 is merged, currently migrating CI from Ubuntu Xenial to Ubuntu Bionic but stuck on a hung job. After that I will look into moving Gnocchi testing to Focal as well.

openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Sep 25, 2020
* Update ceilometer from branch 'master'
  - [goal] Migrate testing to ubuntu focal
    
    As per victoria cycle testing runtime and community goal[1]
    we need to migrate upstream CI/CD to Ubuntu Focal(20.04).
    
    Story: #2007865
    Task: #40223
    
    Use mariadb because myql has issue on Focal which need below issue fix to be
    released - gnocchixyz/gnocchi#1069
    
    Depends-On: https://review.opendev.org/#/c/734700/
    
    [1] https://governance.openstack.org/tc/goals/selected/victoria/migrate-ci-cd-jobs-to-ubuntu-focal.html
    
    Change-Id: I42f104a924ea09ba13f12311dfdb2f79e0d2b78f
openstack-mirroring pushed a commit to openstack/ceilometer that referenced this issue Sep 25, 2020
As per victoria cycle testing runtime and community goal[1]
we need to migrate upstream CI/CD to Ubuntu Focal(20.04).

Story: #2007865
Task: #40223

Use mariadb because myql has issue on Focal which need below issue fix to be
released - gnocchixyz/gnocchi#1069

Depends-On: https://review.opendev.org/#/c/734700/

[1] https://governance.openstack.org/tc/goals/selected/victoria/migrate-ci-cd-jobs-to-ubuntu-focal.html

Change-Id: I42f104a924ea09ba13f12311dfdb2f79e0d2b78f
@eyalb1
Copy link
Contributor

eyalb1 commented Oct 20, 2020

wasn't this fix already ?

@chungg
Copy link
Member

chungg commented Oct 20, 2020

yes, i imagine it was resolved by #1047

please reopen if the latest release does not address this.

@chungg chungg closed this as completed Oct 20, 2020
openstack-mirroring pushed a commit to openstack/ceilometer that referenced this issue Oct 21, 2020
This reverts commit 3bb7b71.

gnocchixyz/gnocchi#1069 was fixed

Change-Id: I3277ed13b4b343c553a3c21eab2187bb8abd4251
openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Oct 21, 2020
* Update ceilometer from branch 'master'
  - Merge "Revert "[goal] Migrate testing to ubuntu focal""
  - Revert "[goal] Migrate testing to ubuntu focal"
    
    This reverts commit 3bb7b71e1afb378d47b449e9ba8ff8f633abe7d9.
    
    gnocchixyz/gnocchi#1069 was fixed
    
    Change-Id: I3277ed13b4b343c553a3c21eab2187bb8abd4251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants