Limit and registered limit tables should auto-increment primary keys
Bug #1777893 reported by
Lance Bragstad
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Identity (keystone) |
Fix Released
|
Medium
|
wangxiyuan |
Bug Description
Currently, both the registered_limit and limit tables use a UUID as the primary key:
http://
Instead of using this pattern, we can optimize for performance by using an auto-incrementing primary key as the "internal_id" of the limit or registered limit. The id column can remain as the ID of the entity exposed through the API. The limit.id and registered_limit.id columns should also maintain unique constraints.
Possibly migrations to address this improvement were whiteboarded in the following etherpad:
https:/
Changed in keystone: | |
status: | New → Triaged |
importance: | Undecided → Medium |
tags: | added: limits sql |
Changed in keystone: | |
assignee: | nobody → wangxiyuan (wangxiyuan) |
Changed in keystone: | |
status: | Triaged → In Progress |
Changed in keystone: | |
milestone: | none → rocky-3 |
To post a comment you must log in.
Reviewed: https:/ /review. openstack. org/576025 /git.openstack. org/cgit/ openstack/ keystone/ commit/ ?id=209462c90d4 4df7bf58fd37868 87047adefdc22b
Committed: https:/
Submitter: Zuul
Branch: master
commit 209462c90d44df7 bf58fd378688704 7adefdc22b
Author: wangxiyuan <email address hidden>
Date: Mon Jun 18 11:39:31 2018 +0800
Add auto increase primary key for unified limit
What this patch did and why:
1. added an auto increment primary column `interenal_id` for both
registered_ limit and limit tables. Removed the primary key but
added unique index for `id` column. This change can improve
the db performance.
2. dropped the forieign keys in limit table. The `project_id`
column has a foreign key. Using foreign key between different
backends can lead some unexpected error.
3. dropped the unique constraints and foreign key constraint in both
tables. Because `region_id` can be null, in this case, both
constraints can't work well in all kinds of DBs. Instead, we'll
check the unique and foreign reference in code.
NOTE: For MySQL and PostgreSQL, we did the change inner tables. But
for SQLite, it doesn't support adding a primary column into an existed
table, so that we recreated the tables instead..
Closes-bug: #1777893 67f57bafbd4b8c9 213499f8dc3
Change-Id: Ibb408758466ff3