Public bug reported:

Currently the primary key and an additional unique index are configured on the 
same column.
This is why sqlalchemy logs a warning on a database migration displaying 
following information:

```
​/usr/lib/python3/dist-packages/pymysql/cursors.py:170: Warning: (1831, 
'Duplicate index `uniq_instances0uuid`. This is deprecated and will be 
disallowed in a future release')
result = self._query(query)
```
(​This example is actually taken from the nova output, but looks just the same 
for Keystone.
There actually is the same issue within Nova schemas, see bug 
https://bugs.launchpad.net/nova/+bug/1641185)

From my understanding of the documentation of mysql (see [1] [2]) and
postgres (see [3] [4]) a unique constraint, which is created in the
first place, automatically creates an index for the column(s). So there
should be no need to create an additional index for the same column:

```
Table: access_rule 
(https://opendev.org/openstack/keystone/src/commit/7c2d0f589c8daf5c65a80ed20d1e7fbfcc282312/keystone/common/sql/migrations/versions/27e647c0fad4_initial_version.py#L120)

Column: external_id
Indexes:
    Unique Constraint: access_rule_external_id_key
    Index: external_id
```


[1] 
https://dev.mysql.com/doc/refman/8.0/en/create-index.html#create-index-unique
[2] https://dev.mysql.com/doc/refman/8.0/en/mysql-indexes.html
[3] 
https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-UNIQUE-CONSTRAINTS
[4] https://www.postgresql.org/docs/current/indexes-types.html

** Affects: keystone
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1988297

Title:
  Duplicate index external_id in table access_rule of keystone database

Status in OpenStack Identity (keystone):
  New

Bug description:
  Currently the primary key and an additional unique index are configured on 
the same column.
  This is why sqlalchemy logs a warning on a database migration displaying 
following information:

  ```
  ​/usr/lib/python3/dist-packages/pymysql/cursors.py:170: Warning: (1831, 
'Duplicate index `uniq_instances0uuid`. This is deprecated and will be 
disallowed in a future release')
  result = self._query(query)
  ```
  (​This example is actually taken from the nova output, but looks just the 
same for Keystone.
  There actually is the same issue within Nova schemas, see bug 
https://bugs.launchpad.net/nova/+bug/1641185)

  From my understanding of the documentation of mysql (see [1] [2]) and
  postgres (see [3] [4]) a unique constraint, which is created in the
  first place, automatically creates an index for the column(s). So
  there should be no need to create an additional index for the same
  column:

  ```
  Table: access_rule 
(https://opendev.org/openstack/keystone/src/commit/7c2d0f589c8daf5c65a80ed20d1e7fbfcc282312/keystone/common/sql/migrations/versions/27e647c0fad4_initial_version.py#L120)

  Column: external_id
  Indexes:
      Unique Constraint: access_rule_external_id_key
      Index: external_id
  ```


  [1] 
https://dev.mysql.com/doc/refman/8.0/en/create-index.html#create-index-unique
  [2] https://dev.mysql.com/doc/refman/8.0/en/mysql-indexes.html
  [3] 
https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-UNIQUE-CONSTRAINTS
  [4] https://www.postgresql.org/docs/current/indexes-types.html

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1988297/+subscriptions


-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to